Compare commits
3 Commits
master
...
icc-effect
Author | SHA1 | Date |
---|---|---|
Vitaliy Filippov | 6d58c4d980 | |
Jonathan Riddell | 5ea30fdf9f | |
l10n daemon script | 22be8e1feb |
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"phabricator.uri" : "https://phabricator.kde.org/"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 380 B |
Before Width: | Height: | Size: 611 B After Width: | Height: | Size: 611 B |
|
@ -1,978 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2002 Keith Packard
|
||||
*
|
||||
* 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 "xcursor.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
|
||||
/*
|
||||
* From libXcursor/include/X11/extensions/Xcursor.h
|
||||
*/
|
||||
|
||||
#define XcursorTrue 1
|
||||
#define XcursorFalse 0
|
||||
|
||||
/*
|
||||
* Cursor files start with a header. The header
|
||||
* contains a magic number, a version number and a
|
||||
* table of contents which has type and offset information
|
||||
* for the remaining tables in the file.
|
||||
*
|
||||
* File minor versions increment for compatible changes
|
||||
* File major versions increment for incompatible changes (never, we hope)
|
||||
*
|
||||
* Chunks of the same type are always upward compatible. Incompatible
|
||||
* changes are made with new chunk types; the old data can remain under
|
||||
* the old type. Upward compatible changes can add header data as the
|
||||
* header lengths are specified in the file.
|
||||
*
|
||||
* File:
|
||||
* FileHeader
|
||||
* LISTofChunk
|
||||
*
|
||||
* FileHeader:
|
||||
* CARD32 magic magic number
|
||||
* CARD32 header bytes in file header
|
||||
* CARD32 version file version
|
||||
* CARD32 ntoc number of toc entries
|
||||
* LISTofFileToc toc table of contents
|
||||
*
|
||||
* FileToc:
|
||||
* CARD32 type entry type
|
||||
* CARD32 subtype entry subtype (size for images)
|
||||
* CARD32 position absolute file position
|
||||
*/
|
||||
|
||||
#define XCURSOR_MAGIC 0x72756358 /* "Xcur" LSBFirst */
|
||||
|
||||
/*
|
||||
* Current Xcursor version number. Will be substituted by configure
|
||||
* from the version in the libXcursor configure.ac file.
|
||||
*/
|
||||
|
||||
#define XCURSOR_LIB_MAJOR 1
|
||||
#define XCURSOR_LIB_MINOR 1
|
||||
#define XCURSOR_LIB_REVISION 13
|
||||
#define XCURSOR_LIB_VERSION ((XCURSOR_LIB_MAJOR * 10000) + \
|
||||
(XCURSOR_LIB_MINOR * 100) + \
|
||||
(XCURSOR_LIB_REVISION))
|
||||
|
||||
/*
|
||||
* This version number is stored in cursor files; changes to the
|
||||
* file format require updating this version number
|
||||
*/
|
||||
#define XCURSOR_FILE_MAJOR 1
|
||||
#define XCURSOR_FILE_MINOR 0
|
||||
#define XCURSOR_FILE_VERSION ((XCURSOR_FILE_MAJOR << 16) | (XCURSOR_FILE_MINOR))
|
||||
#define XCURSOR_FILE_HEADER_LEN (4 * 4)
|
||||
#define XCURSOR_FILE_TOC_LEN (3 * 4)
|
||||
|
||||
typedef struct _XcursorFileToc {
|
||||
XcursorUInt type; /* chunk type */
|
||||
XcursorUInt subtype; /* subtype (size for images) */
|
||||
XcursorUInt position; /* absolute position in file */
|
||||
} XcursorFileToc;
|
||||
|
||||
typedef struct _XcursorFileHeader {
|
||||
XcursorUInt magic; /* magic number */
|
||||
XcursorUInt header; /* byte length of header */
|
||||
XcursorUInt version; /* file version number */
|
||||
XcursorUInt ntoc; /* number of toc entries */
|
||||
XcursorFileToc *tocs; /* table of contents */
|
||||
} XcursorFileHeader;
|
||||
|
||||
/*
|
||||
* The rest of the file is a list of chunks, each tagged by type
|
||||
* and version.
|
||||
*
|
||||
* Chunk:
|
||||
* ChunkHeader
|
||||
* <extra type-specific header fields>
|
||||
* <type-specific data>
|
||||
*
|
||||
* ChunkHeader:
|
||||
* CARD32 header bytes in chunk header + type header
|
||||
* CARD32 type chunk type
|
||||
* CARD32 subtype chunk subtype
|
||||
* CARD32 version chunk type version
|
||||
*/
|
||||
|
||||
#define XCURSOR_CHUNK_HEADER_LEN (4 * 4)
|
||||
|
||||
typedef struct _XcursorChunkHeader {
|
||||
XcursorUInt header; /* bytes in chunk header */
|
||||
XcursorUInt type; /* chunk type */
|
||||
XcursorUInt subtype; /* chunk subtype (size for images) */
|
||||
XcursorUInt version; /* version of this type */
|
||||
} XcursorChunkHeader;
|
||||
|
||||
/*
|
||||
* Here's a list of the known chunk types
|
||||
*/
|
||||
|
||||
/*
|
||||
* Comments consist of a 4-byte length field followed by
|
||||
* UTF-8 encoded text
|
||||
*
|
||||
* Comment:
|
||||
* ChunkHeader header chunk header
|
||||
* CARD32 length bytes in text
|
||||
* LISTofCARD8 text UTF-8 encoded text
|
||||
*/
|
||||
|
||||
#define XCURSOR_COMMENT_TYPE 0xfffe0001
|
||||
#define XCURSOR_COMMENT_VERSION 1
|
||||
#define XCURSOR_COMMENT_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (1 *4))
|
||||
#define XCURSOR_COMMENT_COPYRIGHT 1
|
||||
#define XCURSOR_COMMENT_LICENSE 2
|
||||
#define XCURSOR_COMMENT_OTHER 3
|
||||
#define XCURSOR_COMMENT_MAX_LEN 0x100000
|
||||
|
||||
typedef struct _XcursorComment {
|
||||
XcursorUInt version;
|
||||
XcursorUInt comment_type;
|
||||
char *comment;
|
||||
} XcursorComment;
|
||||
|
||||
/*
|
||||
* Each cursor image occupies a separate image chunk.
|
||||
* The length of the image header follows the chunk header
|
||||
* so that future versions can extend the header without
|
||||
* breaking older applications
|
||||
*
|
||||
* Image:
|
||||
* ChunkHeader header chunk header
|
||||
* CARD32 width actual width
|
||||
* CARD32 height actual height
|
||||
* CARD32 xhot hot spot x
|
||||
* CARD32 yhot hot spot y
|
||||
* CARD32 delay animation delay
|
||||
* LISTofCARD32 pixels ARGB pixels
|
||||
*/
|
||||
|
||||
#define XCURSOR_IMAGE_TYPE 0xfffd0002
|
||||
#define XCURSOR_IMAGE_VERSION 1
|
||||
#define XCURSOR_IMAGE_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (5*4))
|
||||
#define XCURSOR_IMAGE_MAX_SIZE 0x7fff /* 32767x32767 max cursor size */
|
||||
|
||||
typedef struct _XcursorFile XcursorFile;
|
||||
|
||||
struct _XcursorFile {
|
||||
void *closure;
|
||||
int (*read) (XcursorFile *file, unsigned char *buf, int len);
|
||||
int (*write) (XcursorFile *file, unsigned char *buf, int len);
|
||||
int (*seek) (XcursorFile *file, long offset, int whence);
|
||||
};
|
||||
|
||||
typedef struct _XcursorComments {
|
||||
int ncomment; /* number of comments */
|
||||
XcursorComment **comments; /* array of XcursorComment pointers */
|
||||
} XcursorComments;
|
||||
|
||||
/*
|
||||
* From libXcursor/src/file.c
|
||||
*/
|
||||
|
||||
static XcursorImage *
|
||||
XcursorImageCreate (int width, int height)
|
||||
{
|
||||
XcursorImage *image;
|
||||
|
||||
if (width < 0 || height < 0)
|
||||
return NULL;
|
||||
if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
|
||||
return NULL;
|
||||
|
||||
image = malloc (sizeof (XcursorImage) +
|
||||
width * height * sizeof (XcursorPixel));
|
||||
if (!image)
|
||||
return NULL;
|
||||
image->version = XCURSOR_IMAGE_VERSION;
|
||||
image->pixels = (XcursorPixel *) (image + 1);
|
||||
image->size = width > height ? width : height;
|
||||
image->width = width;
|
||||
image->height = height;
|
||||
image->delay = 0;
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
XcursorImageDestroy (XcursorImage *image)
|
||||
{
|
||||
free (image);
|
||||
}
|
||||
|
||||
static XcursorImages *
|
||||
XcursorImagesCreate (int size)
|
||||
{
|
||||
XcursorImages *images;
|
||||
|
||||
images = malloc (sizeof (XcursorImages) +
|
||||
size * sizeof (XcursorImage *));
|
||||
if (!images)
|
||||
return NULL;
|
||||
images->nimage = 0;
|
||||
images->images = (XcursorImage **) (images + 1);
|
||||
images->name = NULL;
|
||||
return images;
|
||||
}
|
||||
|
||||
void
|
||||
XcursorImagesDestroy (XcursorImages *images)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (!images)
|
||||
return;
|
||||
|
||||
for (n = 0; n < images->nimage; n++)
|
||||
XcursorImageDestroy (images->images[n]);
|
||||
if (images->name)
|
||||
free (images->name);
|
||||
free (images);
|
||||
}
|
||||
|
||||
static void
|
||||
XcursorImagesSetName (XcursorImages *images, const char *name)
|
||||
{
|
||||
char *new;
|
||||
|
||||
if (!images || !name)
|
||||
return;
|
||||
|
||||
new = malloc (strlen (name) + 1);
|
||||
|
||||
if (!new)
|
||||
return;
|
||||
|
||||
strcpy (new, name);
|
||||
if (images->name)
|
||||
free (images->name);
|
||||
images->name = new;
|
||||
}
|
||||
|
||||
static XcursorBool
|
||||
_XcursorReadUInt (XcursorFile *file, XcursorUInt *u)
|
||||
{
|
||||
unsigned char bytes[4];
|
||||
|
||||
if (!file || !u)
|
||||
return XcursorFalse;
|
||||
|
||||
if ((*file->read) (file, bytes, 4) != 4)
|
||||
return XcursorFalse;
|
||||
|
||||
*u = ((XcursorUInt)(bytes[0]) << 0) |
|
||||
((XcursorUInt)(bytes[1]) << 8) |
|
||||
((XcursorUInt)(bytes[2]) << 16) |
|
||||
((XcursorUInt)(bytes[3]) << 24);
|
||||
return XcursorTrue;
|
||||
}
|
||||
|
||||
static void
|
||||
_XcursorFileHeaderDestroy (XcursorFileHeader *fileHeader)
|
||||
{
|
||||
free (fileHeader);
|
||||
}
|
||||
|
||||
static XcursorFileHeader *
|
||||
_XcursorFileHeaderCreate (int ntoc)
|
||||
{
|
||||
XcursorFileHeader *fileHeader;
|
||||
|
||||
if (ntoc > 0x10000)
|
||||
return NULL;
|
||||
fileHeader = malloc (sizeof (XcursorFileHeader) +
|
||||
ntoc * sizeof (XcursorFileToc));
|
||||
if (!fileHeader)
|
||||
return NULL;
|
||||
fileHeader->magic = XCURSOR_MAGIC;
|
||||
fileHeader->header = XCURSOR_FILE_HEADER_LEN;
|
||||
fileHeader->version = XCURSOR_FILE_VERSION;
|
||||
fileHeader->ntoc = ntoc;
|
||||
fileHeader->tocs = (XcursorFileToc *) (fileHeader + 1);
|
||||
return fileHeader;
|
||||
}
|
||||
|
||||
static XcursorFileHeader *
|
||||
_XcursorReadFileHeader (XcursorFile *file)
|
||||
{
|
||||
XcursorFileHeader head, *fileHeader;
|
||||
XcursorUInt skip;
|
||||
unsigned int n;
|
||||
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
if (!_XcursorReadUInt (file, &head.magic))
|
||||
return NULL;
|
||||
if (head.magic != XCURSOR_MAGIC)
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.header))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.version))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.ntoc))
|
||||
return NULL;
|
||||
skip = head.header - XCURSOR_FILE_HEADER_LEN;
|
||||
if (skip)
|
||||
if ((*file->seek) (file, skip, SEEK_CUR) == EOF)
|
||||
return NULL;
|
||||
fileHeader = _XcursorFileHeaderCreate (head.ntoc);
|
||||
if (!fileHeader)
|
||||
return NULL;
|
||||
fileHeader->magic = head.magic;
|
||||
fileHeader->header = head.header;
|
||||
fileHeader->version = head.version;
|
||||
fileHeader->ntoc = head.ntoc;
|
||||
for (n = 0; n < fileHeader->ntoc; n++)
|
||||
{
|
||||
if (!_XcursorReadUInt (file, &fileHeader->tocs[n].type))
|
||||
break;
|
||||
if (!_XcursorReadUInt (file, &fileHeader->tocs[n].subtype))
|
||||
break;
|
||||
if (!_XcursorReadUInt (file, &fileHeader->tocs[n].position))
|
||||
break;
|
||||
}
|
||||
if (n != fileHeader->ntoc)
|
||||
{
|
||||
_XcursorFileHeaderDestroy (fileHeader);
|
||||
return NULL;
|
||||
}
|
||||
return fileHeader;
|
||||
}
|
||||
|
||||
static XcursorBool
|
||||
_XcursorSeekToToc (XcursorFile *file,
|
||||
XcursorFileHeader *fileHeader,
|
||||
int toc)
|
||||
{
|
||||
if (!file || !fileHeader || \
|
||||
(*file->seek) (file, fileHeader->tocs[toc].position, SEEK_SET) == EOF)
|
||||
return XcursorFalse;
|
||||
return XcursorTrue;
|
||||
}
|
||||
|
||||
static XcursorBool
|
||||
_XcursorFileReadChunkHeader (XcursorFile *file,
|
||||
XcursorFileHeader *fileHeader,
|
||||
int toc,
|
||||
XcursorChunkHeader *chunkHeader)
|
||||
{
|
||||
if (!file || !fileHeader || !chunkHeader)
|
||||
return XcursorFalse;
|
||||
if (!_XcursorSeekToToc (file, fileHeader, toc))
|
||||
return XcursorFalse;
|
||||
if (!_XcursorReadUInt (file, &chunkHeader->header))
|
||||
return XcursorFalse;
|
||||
if (!_XcursorReadUInt (file, &chunkHeader->type))
|
||||
return XcursorFalse;
|
||||
if (!_XcursorReadUInt (file, &chunkHeader->subtype))
|
||||
return XcursorFalse;
|
||||
if (!_XcursorReadUInt (file, &chunkHeader->version))
|
||||
return XcursorFalse;
|
||||
/* sanity check */
|
||||
if (chunkHeader->type != fileHeader->tocs[toc].type ||
|
||||
chunkHeader->subtype != fileHeader->tocs[toc].subtype)
|
||||
return XcursorFalse;
|
||||
return XcursorTrue;
|
||||
}
|
||||
|
||||
#define dist(a,b) ((a) > (b) ? (a) - (b) : (b) - (a))
|
||||
|
||||
static XcursorDim
|
||||
_XcursorFindBestSize (XcursorFileHeader *fileHeader,
|
||||
XcursorDim size,
|
||||
int *nsizesp)
|
||||
{
|
||||
unsigned int n;
|
||||
int nsizes = 0;
|
||||
XcursorDim bestSize = 0;
|
||||
XcursorDim thisSize;
|
||||
|
||||
if (!fileHeader || !nsizesp)
|
||||
return 0;
|
||||
|
||||
for (n = 0; n < fileHeader->ntoc; n++)
|
||||
{
|
||||
if (fileHeader->tocs[n].type != XCURSOR_IMAGE_TYPE)
|
||||
continue;
|
||||
thisSize = fileHeader->tocs[n].subtype;
|
||||
if (!bestSize || dist (thisSize, size) < dist (bestSize, size))
|
||||
{
|
||||
bestSize = thisSize;
|
||||
nsizes = 1;
|
||||
}
|
||||
else if (thisSize == bestSize)
|
||||
nsizes++;
|
||||
}
|
||||
*nsizesp = nsizes;
|
||||
return bestSize;
|
||||
}
|
||||
|
||||
static int
|
||||
_XcursorFindImageToc (XcursorFileHeader *fileHeader,
|
||||
XcursorDim size,
|
||||
int count)
|
||||
{
|
||||
unsigned int toc;
|
||||
XcursorDim thisSize;
|
||||
|
||||
if (!fileHeader)
|
||||
return 0;
|
||||
|
||||
for (toc = 0; toc < fileHeader->ntoc; toc++)
|
||||
{
|
||||
if (fileHeader->tocs[toc].type != XCURSOR_IMAGE_TYPE)
|
||||
continue;
|
||||
thisSize = fileHeader->tocs[toc].subtype;
|
||||
if (thisSize != size)
|
||||
continue;
|
||||
if (!count)
|
||||
break;
|
||||
count--;
|
||||
}
|
||||
if (toc == fileHeader->ntoc)
|
||||
return -1;
|
||||
return toc;
|
||||
}
|
||||
|
||||
static XcursorImage *
|
||||
_XcursorReadImage (XcursorFile *file,
|
||||
XcursorFileHeader *fileHeader,
|
||||
int toc)
|
||||
{
|
||||
XcursorChunkHeader chunkHeader;
|
||||
XcursorImage head;
|
||||
XcursorImage *image;
|
||||
int n;
|
||||
XcursorPixel *p;
|
||||
|
||||
if (!file || !fileHeader)
|
||||
return NULL;
|
||||
|
||||
if (!_XcursorFileReadChunkHeader (file, fileHeader, toc, &chunkHeader))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.width))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.height))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.xhot))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.yhot))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.delay))
|
||||
return NULL;
|
||||
/* sanity check data */
|
||||
if (head.width > XCURSOR_IMAGE_MAX_SIZE ||
|
||||
head.height > XCURSOR_IMAGE_MAX_SIZE)
|
||||
return NULL;
|
||||
if (head.width == 0 || head.height == 0)
|
||||
return NULL;
|
||||
if (head.xhot > head.width || head.yhot > head.height)
|
||||
return NULL;
|
||||
|
||||
/* Create the image and initialize it */
|
||||
image = XcursorImageCreate (head.width, head.height);
|
||||
if (image == NULL)
|
||||
return NULL;
|
||||
if (chunkHeader.version < image->version)
|
||||
image->version = chunkHeader.version;
|
||||
image->size = chunkHeader.subtype;
|
||||
image->xhot = head.xhot;
|
||||
image->yhot = head.yhot;
|
||||
image->delay = head.delay;
|
||||
n = image->width * image->height;
|
||||
p = image->pixels;
|
||||
while (n--)
|
||||
{
|
||||
if (!_XcursorReadUInt (file, p))
|
||||
{
|
||||
XcursorImageDestroy (image);
|
||||
return NULL;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
static XcursorImages *
|
||||
XcursorXcFileLoadImages (XcursorFile *file, int size)
|
||||
{
|
||||
XcursorFileHeader *fileHeader;
|
||||
XcursorDim bestSize;
|
||||
int nsize;
|
||||
XcursorImages *images;
|
||||
int n;
|
||||
int toc;
|
||||
|
||||
if (!file || size < 0)
|
||||
return NULL;
|
||||
fileHeader = _XcursorReadFileHeader (file);
|
||||
if (!fileHeader)
|
||||
return NULL;
|
||||
bestSize = _XcursorFindBestSize (fileHeader, (XcursorDim) size, &nsize);
|
||||
if (!bestSize)
|
||||
{
|
||||
_XcursorFileHeaderDestroy (fileHeader);
|
||||
return NULL;
|
||||
}
|
||||
images = XcursorImagesCreate (nsize);
|
||||
if (!images)
|
||||
{
|
||||
_XcursorFileHeaderDestroy (fileHeader);
|
||||
return NULL;
|
||||
}
|
||||
for (n = 0; n < nsize; n++)
|
||||
{
|
||||
toc = _XcursorFindImageToc (fileHeader, bestSize, n);
|
||||
if (toc < 0)
|
||||
break;
|
||||
images->images[images->nimage] = _XcursorReadImage (file, fileHeader,
|
||||
toc);
|
||||
if (!images->images[images->nimage])
|
||||
break;
|
||||
images->nimage++;
|
||||
}
|
||||
_XcursorFileHeaderDestroy (fileHeader);
|
||||
if (images->nimage != nsize)
|
||||
{
|
||||
XcursorImagesDestroy (images);
|
||||
images = NULL;
|
||||
}
|
||||
return images;
|
||||
}
|
||||
|
||||
static int
|
||||
_XcursorStdioFileRead (XcursorFile *file, unsigned char *buf, int len)
|
||||
{
|
||||
FILE *f = file->closure;
|
||||
return fread (buf, 1, len, f);
|
||||
}
|
||||
|
||||
static int
|
||||
_XcursorStdioFileWrite (XcursorFile *file, unsigned char *buf, int len)
|
||||
{
|
||||
FILE *f = file->closure;
|
||||
return fwrite (buf, 1, len, f);
|
||||
}
|
||||
|
||||
static int
|
||||
_XcursorStdioFileSeek (XcursorFile *file, long offset, int whence)
|
||||
{
|
||||
FILE *f = file->closure;
|
||||
return fseek (f, offset, whence);
|
||||
}
|
||||
|
||||
static void
|
||||
_XcursorStdioFileInitialize (FILE *stdfile, XcursorFile *file)
|
||||
{
|
||||
file->closure = stdfile;
|
||||
file->read = _XcursorStdioFileRead;
|
||||
file->write = _XcursorStdioFileWrite;
|
||||
file->seek = _XcursorStdioFileSeek;
|
||||
}
|
||||
|
||||
static XcursorImages *
|
||||
XcursorFileLoadImages (FILE *file, int size)
|
||||
{
|
||||
XcursorFile f;
|
||||
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
_XcursorStdioFileInitialize (file, &f);
|
||||
return XcursorXcFileLoadImages (&f, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* From libXcursor/src/library.c
|
||||
*/
|
||||
|
||||
#ifndef ICONDIR
|
||||
#define ICONDIR "/usr/X11R6/lib/X11/icons"
|
||||
#endif
|
||||
|
||||
#ifndef XCURSORPATH
|
||||
#define XCURSORPATH "~/.icons:/usr/share/icons:/usr/share/pixmaps:~/.cursors:/usr/share/cursors/xorg-x11:"ICONDIR
|
||||
#endif
|
||||
|
||||
static const char *
|
||||
XcursorLibraryPath (void)
|
||||
{
|
||||
static const char *path;
|
||||
|
||||
if (!path)
|
||||
{
|
||||
path = getenv ("XCURSOR_PATH");
|
||||
if (!path)
|
||||
path = XCURSORPATH;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
static void
|
||||
_XcursorAddPathElt (char *path, const char *elt, int len)
|
||||
{
|
||||
int pathlen = strlen (path);
|
||||
|
||||
/* append / if the path doesn't currently have one */
|
||||
if (path[0] == '\0' || path[pathlen - 1] != '/')
|
||||
{
|
||||
strcat (path, "/");
|
||||
pathlen++;
|
||||
}
|
||||
if (len == -1)
|
||||
len = strlen (elt);
|
||||
/* strip leading slashes */
|
||||
while (len && elt[0] == '/')
|
||||
{
|
||||
elt++;
|
||||
len--;
|
||||
}
|
||||
strncpy (path + pathlen, elt, len);
|
||||
path[pathlen + len] = '\0';
|
||||
}
|
||||
|
||||
static char *
|
||||
_XcursorBuildThemeDir (const char *dir, const char *theme)
|
||||
{
|
||||
const char *colon;
|
||||
const char *tcolon;
|
||||
char *full;
|
||||
char *home;
|
||||
int dirlen;
|
||||
int homelen;
|
||||
int themelen;
|
||||
int len;
|
||||
|
||||
if (!dir || !theme)
|
||||
return NULL;
|
||||
|
||||
colon = strchr (dir, ':');
|
||||
if (!colon)
|
||||
colon = dir + strlen (dir);
|
||||
|
||||
dirlen = colon - dir;
|
||||
|
||||
tcolon = strchr (theme, ':');
|
||||
if (!tcolon)
|
||||
tcolon = theme + strlen (theme);
|
||||
|
||||
themelen = tcolon - theme;
|
||||
|
||||
home = NULL;
|
||||
homelen = 0;
|
||||
if (*dir == '~')
|
||||
{
|
||||
home = getenv ("HOME");
|
||||
if (!home)
|
||||
return NULL;
|
||||
homelen = strlen (home);
|
||||
dir++;
|
||||
dirlen--;
|
||||
}
|
||||
|
||||
/*
|
||||
* add space for any needed directory separators, one per component,
|
||||
* and one for the trailing null
|
||||
*/
|
||||
len = 1 + homelen + 1 + dirlen + 1 + themelen + 1;
|
||||
|
||||
full = malloc (len);
|
||||
if (!full)
|
||||
return NULL;
|
||||
full[0] = '\0';
|
||||
|
||||
if (home)
|
||||
_XcursorAddPathElt (full, home, -1);
|
||||
_XcursorAddPathElt (full, dir, dirlen);
|
||||
_XcursorAddPathElt (full, theme, themelen);
|
||||
return full;
|
||||
}
|
||||
|
||||
static char *
|
||||
_XcursorBuildFullname (const char *dir, const char *subdir, const char *file)
|
||||
{
|
||||
char *full;
|
||||
|
||||
if (!dir || !subdir || !file)
|
||||
return NULL;
|
||||
|
||||
full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1);
|
||||
if (!full)
|
||||
return NULL;
|
||||
full[0] = '\0';
|
||||
_XcursorAddPathElt (full, dir, -1);
|
||||
_XcursorAddPathElt (full, subdir, -1);
|
||||
_XcursorAddPathElt (full, file, -1);
|
||||
return full;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_XcursorNextPath (const char *path)
|
||||
{
|
||||
char *colon = strchr (path, ':');
|
||||
|
||||
if (!colon)
|
||||
return NULL;
|
||||
return colon + 1;
|
||||
}
|
||||
|
||||
#define XcursorWhite(c) ((c) == ' ' || (c) == '\t' || (c) == '\n')
|
||||
#define XcursorSep(c) ((c) == ';' || (c) == ',')
|
||||
|
||||
static char *
|
||||
_XcursorThemeInherits (const char *full)
|
||||
{
|
||||
char line[8192];
|
||||
char *result = NULL;
|
||||
FILE *f;
|
||||
|
||||
if (!full)
|
||||
return NULL;
|
||||
|
||||
f = fopen (full, "r");
|
||||
if (f)
|
||||
{
|
||||
while (fgets (line, sizeof (line), f))
|
||||
{
|
||||
if (!strncmp (line, "Inherits", 8))
|
||||
{
|
||||
char *l = line + 8;
|
||||
char *r;
|
||||
while (*l == ' ') l++;
|
||||
if (*l != '=') continue;
|
||||
l++;
|
||||
while (*l == ' ') l++;
|
||||
result = malloc (strlen (l) + 1);
|
||||
if (result)
|
||||
{
|
||||
r = result;
|
||||
while (*l)
|
||||
{
|
||||
while (XcursorSep(*l) || XcursorWhite (*l)) l++;
|
||||
if (!*l)
|
||||
break;
|
||||
if (r != result)
|
||||
*r++ = ':';
|
||||
while (*l && !XcursorWhite(*l) &&
|
||||
!XcursorSep(*l))
|
||||
*r++ = *l++;
|
||||
}
|
||||
*r++ = '\0';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose (f);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static FILE *
|
||||
XcursorScanTheme (const char *theme, const char *name)
|
||||
{
|
||||
FILE *f = NULL;
|
||||
char *full;
|
||||
char *dir;
|
||||
const char *path;
|
||||
char *inherits = NULL;
|
||||
const char *i;
|
||||
|
||||
if (!theme || !name)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* Scan this theme
|
||||
*/
|
||||
for (path = XcursorLibraryPath ();
|
||||
path && f == NULL;
|
||||
path = _XcursorNextPath (path))
|
||||
{
|
||||
dir = _XcursorBuildThemeDir (path, theme);
|
||||
if (dir)
|
||||
{
|
||||
full = _XcursorBuildFullname (dir, "cursors", name);
|
||||
if (full)
|
||||
{
|
||||
f = fopen (full, "r");
|
||||
free (full);
|
||||
}
|
||||
if (!f && !inherits)
|
||||
{
|
||||
full = _XcursorBuildFullname (dir, "", "index.theme");
|
||||
if (full)
|
||||
{
|
||||
inherits = _XcursorThemeInherits (full);
|
||||
free (full);
|
||||
}
|
||||
}
|
||||
free (dir);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Recurse to scan inherited themes
|
||||
*/
|
||||
for (i = inherits; i && f == NULL; i = _XcursorNextPath (i))
|
||||
f = XcursorScanTheme (i, name);
|
||||
if (inherits != NULL)
|
||||
free (inherits);
|
||||
return f;
|
||||
}
|
||||
|
||||
XcursorImages *
|
||||
XcursorLibraryLoadImages (const char *file, const char *theme, int size)
|
||||
{
|
||||
FILE *f = NULL;
|
||||
XcursorImages *images = NULL;
|
||||
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
if (theme)
|
||||
f = XcursorScanTheme (theme, file);
|
||||
if (!f)
|
||||
f = XcursorScanTheme ("default", file);
|
||||
if (f)
|
||||
{
|
||||
images = XcursorFileLoadImages (f, size);
|
||||
if (images)
|
||||
XcursorImagesSetName (images, file);
|
||||
fclose (f);
|
||||
}
|
||||
return images;
|
||||
}
|
||||
|
||||
static void
|
||||
load_all_cursors_from_dir(const char *path, int size,
|
||||
void (*load_callback)(XcursorImages *, void *),
|
||||
void *user_data)
|
||||
{
|
||||
FILE *f;
|
||||
DIR *dir = opendir(path);
|
||||
struct dirent *ent;
|
||||
char *full;
|
||||
XcursorImages *images;
|
||||
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
for(ent = readdir(dir); ent; ent = readdir(dir)) {
|
||||
#ifdef _DIRENT_HAVE_D_TYPE
|
||||
if (ent->d_type != DT_UNKNOWN &&
|
||||
(ent->d_type != DT_REG && ent->d_type != DT_LNK))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
full = _XcursorBuildFullname(path, "", ent->d_name);
|
||||
if (!full)
|
||||
continue;
|
||||
|
||||
f = fopen(full, "r");
|
||||
if (!f) {
|
||||
free(full);
|
||||
continue;
|
||||
}
|
||||
|
||||
images = XcursorFileLoadImages(f, size);
|
||||
|
||||
if (images) {
|
||||
XcursorImagesSetName(images, ent->d_name);
|
||||
load_callback(images, user_data);
|
||||
}
|
||||
|
||||
fclose (f);
|
||||
free(full);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
/** Load all the cursor of a theme
|
||||
*
|
||||
* This function loads all the cursor images of a given theme and its
|
||||
* inherited themes. Each cursor is loaded into an XcursorImages object
|
||||
* which is passed to the caller's load callback. If a cursor appears
|
||||
* more than once across all the inherited themes, the load callback
|
||||
* will be called multiple times, with possibly different XcursorImages
|
||||
* object which have the same name. The user is expected to destroy the
|
||||
* XcursorImages objects passed to the callback with
|
||||
* XcursorImagesDestroy().
|
||||
*
|
||||
* \param theme The name of theme that should be loaded
|
||||
* \param size The desired size of the cursor images
|
||||
* \param load_callback A callback function that will be called
|
||||
* for each cursor loaded. The first parameter is the XcursorImages
|
||||
* object representing the loaded cursor and the second is a pointer
|
||||
* to data provided by the user.
|
||||
* \param user_data The data that should be passed to the load callback
|
||||
*/
|
||||
void
|
||||
xcursor_load_theme(const char *theme, int size,
|
||||
void (*load_callback)(XcursorImages *, void *),
|
||||
void *user_data)
|
||||
{
|
||||
char *full, *dir;
|
||||
char *inherits = NULL;
|
||||
const char *path, *i;
|
||||
|
||||
if (!theme)
|
||||
theme = "default";
|
||||
|
||||
for (path = XcursorLibraryPath();
|
||||
path;
|
||||
path = _XcursorNextPath(path)) {
|
||||
dir = _XcursorBuildThemeDir(path, theme);
|
||||
if (!dir)
|
||||
continue;
|
||||
|
||||
full = _XcursorBuildFullname(dir, "cursors", "");
|
||||
|
||||
if (full) {
|
||||
load_all_cursors_from_dir(full, size, load_callback,
|
||||
user_data);
|
||||
free(full);
|
||||
}
|
||||
|
||||
if (!inherits) {
|
||||
full = _XcursorBuildFullname(dir, "", "index.theme");
|
||||
if (full) {
|
||||
inherits = _XcursorThemeInherits(full);
|
||||
free(full);
|
||||
}
|
||||
}
|
||||
|
||||
free(dir);
|
||||
}
|
||||
|
||||
for (i = inherits; i; i = _XcursorNextPath(i))
|
||||
xcursor_load_theme(i, size, load_callback, user_data);
|
||||
|
||||
if (inherits)
|
||||
free(inherits);
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2002 Keith Packard
|
||||
*
|
||||
* 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 XCURSOR_H
|
||||
#define XCURSOR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int XcursorBool;
|
||||
typedef uint32_t XcursorUInt;
|
||||
|
||||
typedef XcursorUInt XcursorDim;
|
||||
typedef XcursorUInt XcursorPixel;
|
||||
|
||||
typedef struct _XcursorImage {
|
||||
XcursorUInt version; /* version of the image data */
|
||||
XcursorDim size; /* nominal size for matching */
|
||||
XcursorDim width; /* actual width */
|
||||
XcursorDim height; /* actual height */
|
||||
XcursorDim xhot; /* hot spot x (must be inside image) */
|
||||
XcursorDim yhot; /* hot spot y (must be inside image) */
|
||||
XcursorUInt delay; /* animation delay to next frame (ms) */
|
||||
XcursorPixel *pixels; /* pointer to pixels */
|
||||
} XcursorImage;
|
||||
|
||||
/*
|
||||
* Other data structures exposed by the library API
|
||||
*/
|
||||
typedef struct _XcursorImages {
|
||||
int nimage; /* number of images */
|
||||
XcursorImage **images; /* array of XcursorImage pointers */
|
||||
char *name; /* name used to load images */
|
||||
} XcursorImages;
|
||||
|
||||
XcursorImages *
|
||||
XcursorLibraryLoadImages (const char *file, const char *theme, int size);
|
||||
|
||||
void
|
||||
XcursorImagesDestroy (XcursorImages *images);
|
||||
|
||||
void
|
||||
xcursor_load_theme(const char *theme, int size,
|
||||
void (*load_callback)(XcursorImages *, void *),
|
||||
void *user_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Before Width: | Height: | Size: 877 B After Width: | Height: | Size: 877 B |
708
CMakeLists.txt
708
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,254 @@
|
|||
W A R N I N G:
|
||||
--------------
|
||||
This document is a work in progress and is in no way complete or accurate!
|
||||
Its current purpose is in aiding the KWin NetWM audit for a future KWin release.
|
||||
|
||||
NetWM Compliance Document:
|
||||
==========================
|
||||
|
||||
Listed below are all the NetWM (or EWM) hints decided upon on freedesktop.org
|
||||
(as of version 1.3draft, Nov 27, 2002) and KWin's current level of
|
||||
compliance with the spec. Some parts also involve the pager and clients which
|
||||
this document will cater for as well where applicable.
|
||||
|
||||
If you modify the level of NetWM compliance (via modification of kwin/*,
|
||||
kdecore/netwm.* or kdecore/kwin.* etc.), or notice any new hints that
|
||||
were added after version 1.2, please modify this document appropriately.
|
||||
Properties are ordered in the table in the order they are found in the
|
||||
specification. To list any important notes regarding a property, just
|
||||
add them as follows:
|
||||
|
||||
_NET_NUMBER_OF_DESKTOPS root window property done
|
||||
+----------------------------------------------------------------+
|
||||
| This property SHOULD be updated by the Window Manager to |
|
||||
| indicate the number of virtual desktops. KWin DOES update this |
|
||||
| property when the pager changes the number of desktops. |
|
||||
+----------------------------------------------------------------+
|
||||
|
||||
If you have any questions regarding the specification, feel free to ask on the KWin
|
||||
mailing list <kwin@kde.org>, or on the Window Manager Spec list <wm-spec-list@gnome.org>.
|
||||
-- Karol <kszwed@kde.org>
|
||||
|
||||
(
|
||||
compliance :
|
||||
- = none,
|
||||
/ = partial,
|
||||
+ = complete,
|
||||
* = KWin is compliant, but something else needs checking (e.g. Qt)
|
||||
? = unknown
|
||||
)
|
||||
|
||||
|
||||
NETWM spec compliance (whole document):
|
||||
version 1.2
|
||||
======================
|
||||
|
||||
+ 1.
|
||||
+ 2.3. Feature not implemented.
|
||||
+ 2.4. Feature not implemented.
|
||||
+ 2.5.
|
||||
+ 2. (rest of the section)
|
||||
+ 3.1.
|
||||
This property is complete in the sense that all implemented properties
|
||||
are listed here.
|
||||
CHECKME : check it's complete
|
||||
/ 3.2.
|
||||
The spec requires that _NET_CLIENT_LIST contains the windows in their
|
||||
initial mapping order, which is currently not true for NET::Desktop
|
||||
windows.
|
||||
Note that xprop lists only first element in WINDOW type properties.
|
||||
+ 3.3.
|
||||
Note that KWin does not use the virtual root windows technique,
|
||||
so it doesn't set _NET_VIRTUAL_ROOTS at all.
|
||||
+ 3.4.
|
||||
KWin doesn't implement large desktops, so it ignores
|
||||
the message, and only sets the property to the screen size.
|
||||
+ 3.5.
|
||||
KWin doesn't implement viewports, so it correctly sets
|
||||
the property to (0,0) pairs and ignores the message.
|
||||
+ 3.6.
|
||||
+ 3.7.
|
||||
+ 3.8.
|
||||
KWin currently extends the message a bit, with data.l[0] being 1 or 2,
|
||||
meaning 'from application'/'from pager', and data.l[1] contains
|
||||
timestamp. This is used for focus stealing prevention purposes, and
|
||||
will be proposed for next version of the spec.
|
||||
+ 3.9.
|
||||
+ 3.10.
|
||||
+ 3.11.
|
||||
KWin doesn't use the virtual roots technique for creating virtual
|
||||
desktops, so it doesn't set the property.
|
||||
- 3.12.
|
||||
- 3.13.
|
||||
+ 4.1.
|
||||
+ 4.2.
|
||||
+ 4.3.
|
||||
Due to implementation details KWin actually allows moving or resizing
|
||||
by keyboard when requested to be done by mouse, and vice versa.
|
||||
+ 5.1.
|
||||
+ 5.2.
|
||||
+ 5.3.
|
||||
+ 5.4.
|
||||
+ 5.5.
|
||||
/ 5.6. The handling of _NET_WM_WINDOW_TYPE itself is correct and complete.
|
||||
Supported window types: DESKTOP, DOCK, TOOLBAR, MENU, UTILITY,
|
||||
SPLASH, DIALOG, NORMAL.
|
||||
UTILITY should get better placement.
|
||||
TOOLBAR - many parts in KDE still treat this as "tool" window.
|
||||
- should the decoration be shown for the toolbars?
|
||||
KDE extensions:
|
||||
_KDE_NET_WM_WINDOW_TYPE_OVERRIDE - this seems to mean "this window
|
||||
should be borderless", but it's actually used also for other
|
||||
things, like fullscreen windows. The plan is to get rid of this
|
||||
flawed thing as soon as possible.
|
||||
/ 5.7.
|
||||
The handling of _NET_WM_STATE itself is correct and complete.
|
||||
Supported states: MODAL, MAXIMIZED_VERT, MAXIMIZED_HORZ, SHADED,
|
||||
SKIP_TASKBAR, SKIP_PAGER, HIDDEN, ABOVE, BELOW.
|
||||
STICKY is not supported, because KWin doesn't implement viewports.
|
||||
BELOW - in order to make 'allow windows to cover the panel' feature
|
||||
in Kicker work KWin interprets this state a bit differently
|
||||
for DOCK windows. While normal DOCK windows are in their
|
||||
extra layer above normal windows, making them BELOW doesn't
|
||||
move them below normal windows, but only to the same layer, so
|
||||
that windows can hide Kicker, but Kicker can be also raised
|
||||
above the windows. A bit hacky, but it's not really against
|
||||
the spec, and I have no better idea.
|
||||
KDE extensions:
|
||||
_NET_WM_STATE_STAYS_ON_TOP - has the same meaning like ABOVE,
|
||||
and is deprecated in favour of it; it lacks the _KDE prefix
|
||||
* 5.8.
|
||||
The handling of _NET_WM_ALLOWED_ACTIONS itself is correct and complete.
|
||||
Supported actions: MOVE, RESIZE, MINIMIZE, SHADE, MAXIMIZE_HORZ,
|
||||
MAXIMIZE_VERT, CHANGE_DESKTOP, CLOSE
|
||||
STICK is not supported, because KWin does not implement viewports.
|
||||
Kicker etc. need to be updated.
|
||||
+ 5.9.
|
||||
* 5.10.
|
||||
Property is not used in KWin.
|
||||
Kicker needs to be checked.
|
||||
* 5.11.
|
||||
KWin's handling of the property is correct.
|
||||
Qt should be checked.
|
||||
+ 5.12.
|
||||
- 5.13.
|
||||
Property is not used in KWin, KWin never provides icons for iconified windows.
|
||||
Kicker or its taskbar don't set it either. However, the property is flawed,
|
||||
and should be replaced by manager selection or similar mechanism.
|
||||
+ 6.1.
|
||||
+ 6. (rest)
|
||||
+ 7.4.
|
||||
The urgency hint is mapped to the _NET_WM_DEMANDS_ATTENTION flag.
|
||||
* 7.5.
|
||||
Qt often sets maximum size smaller than minimum size. This seems to be caused
|
||||
by delayed layout calculations.
|
||||
* 7.6.
|
||||
Kicker should be checked.
|
||||
? 7.7.
|
||||
+ 7. (rest of the section)
|
||||
|
||||
|
||||
+ _NET_WM_FULLSCREEN_MONITORS Status: Done.
|
||||
+----------------------------------------------------------------+
|
||||
| The Window Manager MUST keep this list updated to reflect the |
|
||||
| current state of the window. The application window sends this |
|
||||
| in a ClientMessage to the root window. KWin persists this info |
|
||||
| both internally as well as against the application window. |
|
||||
| This data is used to spread the fullscreen application window |
|
||||
| across the requested topology, if valid. |
|
||||
+----------------------------------------------------------------+
|
||||
|
||||
ICCCM spec compliance (whole document):
|
||||
version 2.0
|
||||
======================
|
||||
|
||||
/ 1.2.3.
|
||||
KWin uses KWIN_RUNNING atom that's missing the leading underscore.
|
||||
Some parts of KDE perhaps may be missing the leading underscore.
|
||||
/ 1.2.6.
|
||||
Should be checked.
|
||||
+ 1. (rest of the section)
|
||||
+ 2.8. kmanagerselection.* in kdecore
|
||||
+ 2. (rest of the section)
|
||||
Not a KWin thing.
|
||||
* - patch sent to TT to make QClipboard sufficiently compliant
|
||||
+ 3.
|
||||
Feature not supported, obsolete.
|
||||
+ 4.1.1
|
||||
+ 4.1.2 (intro)
|
||||
+ 4.1.2.1
|
||||
Used as a fallback for _NET_WM_NAME.
|
||||
+ 4.1.2.2
|
||||
Used as a fallback for _NET_WM_ICON_NAME.
|
||||
? 4.1.2.3
|
||||
? - PSize, PPosition, USize, UPosition
|
||||
? - clients - Qt simply sets both
|
||||
+ - PWinGravity - window geometry constraints have higher priority than gravity
|
||||
/ - PBaseSize - PMinSize is not used as a fallback for size increments
|
||||
+ - (the rest)
|
||||
/ 4.1.2.4
|
||||
+ - input - see 4.1.7
|
||||
+ - initial_state
|
||||
+ - icon - feature not supported
|
||||
+ - window_group
|
||||
+ - urgency - mapped to _NET_WM_DEMANDS_ATTENTION
|
||||
/ 4.1.2.5 - it should be checked it's used correctly in Kicker etc.
|
||||
/ 4.1.2.6 - should be checked
|
||||
NETWM section 7.3. is supported too, even though it's a slight ICCCM violation.
|
||||
+ 4.1.2.7
|
||||
- 4.1.2.8
|
||||
See 4.1.8.
|
||||
+ 4.1.2.9 - handled by Xlib call
|
||||
+ 4.1.3.1
|
||||
+ 4.1.3.2
|
||||
Feature not supported (4.1.2.4 - icons)
|
||||
* 4.1.4 it should be checked Qt/KDE clients handle this properly
|
||||
/ 4.1.5
|
||||
This needs fixing.
|
||||
+ 4.1.6
|
||||
+ 4.1.7
|
||||
- 4.1.8
|
||||
KWin only installs colormap required by the active window.
|
||||
- 4.1.9
|
||||
Feature not supported, except for WM_ICON_NAME as a fallback for _NET_WM_ICON_NAME.
|
||||
+ 4.1.10
|
||||
+ 4.1.11
|
||||
Window groups are only used for supporting NETWM section 7.3.
|
||||
+ 4.2.5
|
||||
/ 4.2.7
|
||||
Qt doesn't set revert-to to Parent.
|
||||
+ 4.2.8.1 frozen clients may be XKill-ed upon a user request though
|
||||
+ 4.3
|
||||
? 4.4
|
||||
+ 4. (rest of the section)
|
||||
+ 5.3. not KWin related
|
||||
+ 5. (rest of the section )
|
||||
? 6.1. clients thing
|
||||
? 6.2. clients thing - Qt perhaps should force rule 2.
|
||||
+ 6.3.
|
||||
? 6. (rest of the section)
|
||||
+ 7. - no idea what it is, but it doesn't seem to be KWin related
|
||||
+ 8.
|
||||
|
||||
|
||||
KDE-specific extensions (for completeness):
|
||||
|
||||
Property Name Type
|
||||
==========================================================================
|
||||
_KDE_WM_CHANGE_STATE root window message
|
||||
_KDE_NET_SYSTEM_TRAY_WINDOWS root window property
|
||||
_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR window property
|
||||
_KDE_NET_WM_FRAME_STRUT window property
|
||||
_NET_WM_CONTEXT_HELP
|
||||
- Qt extension
|
||||
- has no vendor prefix even though it's not part of the spec
|
||||
_NET_WM_STATE_STAYS_ON_TOP
|
||||
- KDE extension
|
||||
- has no vendor prefix even though it's not part of the spec
|
||||
- deprecated in favor of _NET_WM_STATE_KEEP_ABOVE
|
||||
_KDE_NET_WM_WINDOW_TYPE_OVERRIDE
|
||||
- window type, makes the window borderless
|
||||
- unclear semantics, used also for fullscreen windows
|
||||
- deprecated in favor of other window types
|
||||
|
||||
==========================================================================
|
|
@ -0,0 +1,73 @@
|
|||
CONTENTS:
|
||||
=========
|
||||
|
||||
|
||||
1. Pre-configuring window-specific settings
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1. Pre-configuring window-specific settings
|
||||
===========================================
|
||||
|
||||
Window-specific settings is a feature of KWin that allows specifying some
|
||||
settings only for a specific window or windows. See the Window-specific
|
||||
settings section in the KWin configuration and the Special settings
|
||||
menu entries in Alt+F3/Advanced menu.
|
||||
|
||||
One aspect of window-specific settings is the ability to specify various
|
||||
workarounds for (usually broken) applications that otherwise don't work
|
||||
properly with KWin. This section describes how to create additional
|
||||
window-specific settings that will be automatically used by all users
|
||||
without any need of manual configuration.
|
||||
|
||||
Example case:
|
||||
|
||||
Application FooBar does not specify any maximum size for its main window,
|
||||
but when resized to larger size than 1600x1200 it crashes because of a bug.
|
||||
Manual configuration of a window-specific setting that avoids this problem
|
||||
is opening and activating this window, selecting
|
||||
Alt+F3/Advanced/Special window settings, activating tab Workarounds, enabling
|
||||
setting Maximum size, changing it to Force and entering "1600,1200" as
|
||||
the maximum size, which will make KWin force this size as the maximum size.
|
||||
|
||||
To create such window-specific setting automatically without a need of doing
|
||||
it manually for every user (for example when doing a large deployment), follow
|
||||
these steps:
|
||||
|
||||
- Back up your $KDEHOME/share/config/kwinrulesrc ($KDEHOME usually being $HOME/.kde)
|
||||
and remove it
|
||||
- Run 'dcop kwin default reconfigure'
|
||||
- Create manually all window-specific settings that should be included (see above)
|
||||
- When done, check in Window-specific settings configuration module
|
||||
(Alt+F3/Configure window behavior/Window-specific settings) that all rules are
|
||||
included
|
||||
- Create a copy of $KDEHOME/share/config/kwinrulesrc and restore the original one
|
||||
- Rename the copy (i.e. the newly created kwinrulesrc) to have its unique name
|
||||
(e.g. foobar_fix_maxsize in this example case)
|
||||
- Be careful with manual modifications of the file, especially make sure the count=
|
||||
field in the [General] group is updated if needed
|
||||
- Create a file for kconfig_update like this (named kwin_foobar_fix_maxsize.upd
|
||||
in this example):
|
||||
|
||||
# kwin_foobar_fix_maxsize.upd start #
|
||||
Id=foobar_fix_maxsize
|
||||
File=kwinrules_update
|
||||
Group=Dummy
|
||||
Options=overwrite
|
||||
ScriptArguments=foobar_fix_maxsize
|
||||
Script=kwin_update_default_rules
|
||||
|
||||
# kwin_foobar_fix_maxsize.upd end #
|
||||
|
||||
- The kconfig_file (kwin_foobar_fix_maxsize.upd) is to be placed
|
||||
in $KDEDIR/share/apps/kconf_update/
|
||||
- The file with the window-specific settings (foobar_fix_maxsize) is to be placed
|
||||
in $KDEDIR/share/apps/kwin/default_rules/
|
||||
|
||||
|
||||
All KDE user accounts should have these new window-specific settings added
|
||||
automatically during next KDE startup (or within few seconds if they are active).
|
||||
They can be checked again in the Window-specific settings configuration module of KWin.
|
||||
|
|
@ -0,0 +1,346 @@
|
|||
NOTE! The GPL below is copyrighted by the Free Software Foundation, but
|
||||
the instance of code that it refers to (the kde programs) are copyrighted
|
||||
by the authors who actually wrote it.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 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.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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 or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
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 give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
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 Program or any portion
|
||||
of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
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 Program, 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 Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) 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; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, 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 executable. However, as a
|
||||
special exception, the source code 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.
|
||||
|
||||
If distribution of executable or 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 counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program 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.
|
||||
|
||||
5. 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 Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program 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 to
|
||||
this License.
|
||||
|
||||
7. 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 Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program 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 Program.
|
||||
|
||||
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.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program 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.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 Program
|
||||
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 Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, 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
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), 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 Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. 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.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; 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.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,397 @@
|
|||
GNU Free Documentation License
|
||||
Version 1.2, November 2002
|
||||
|
||||
|
||||
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
|
||||
51 Franklin St, 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.
|
||||
|
||||
|
||||
0. PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document "free" in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
This License is a kind of "copyleft", which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
|
||||
1. APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The "Document", below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as "you". You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
A "Modified Version" of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A "Secondary Section" is a named appendix or a front-matter section of
|
||||
the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall subject
|
||||
(or to related matters) and contains nothing that could fall directly
|
||||
within that overall subject. (Thus, if the Document is in part a
|
||||
textbook of mathematics, a Secondary Section may not explain any
|
||||
mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The "Invariant Sections" are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
The "Cover Texts" are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
A "Transparent" copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not "Transparent" is called "Opaque".
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||
or XML using a publicly available DTD, and standard-conforming simple
|
||||
HTML, PostScript or PDF designed for human modification. Examples of
|
||||
transparent image formats include PNG, XCF and JPG. Opaque formats
|
||||
include proprietary formats that can be read and edited only by
|
||||
proprietary word processors, SGML or XML for which the DTD and/or
|
||||
processing tools are not generally available, and the
|
||||
machine-generated HTML, PostScript or PDF produced by some word
|
||||
processors for output purposes only.
|
||||
|
||||
The "Title Page" means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, "Title Page" means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
A section "Entitled XYZ" means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as "Acknowledgements",
|
||||
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section "Entitled XYZ" according to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
|
||||
|
||||
2. VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
|
||||
3. COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
|
||||
|
||||
4. MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
B. List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
C. State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
D. Preserve all the copyright notices of the Document.
|
||||
E. Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
F. Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
G. Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
H. Include an unaltered copy of this License.
|
||||
I. Preserve the section Entitled "History", Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled "History" in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
J. Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the "History" section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
K. For any section Entitled "Acknowledgements" or "Dedications",
|
||||
Preserve the Title of the section, and preserve in the section all
|
||||
the substance and tone of each of the contributor acknowledgements
|
||||
and/or dedications given therein.
|
||||
L. Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
M. Delete any section Entitled "Endorsements". Such a section
|
||||
may not be included in the Modified Version.
|
||||
N. Do not retitle any existing section to be Entitled "Endorsements"
|
||||
or to conflict in title with any Invariant Section.
|
||||
O. Preserve any Warranty Disclaimers.
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section Entitled "Endorsements", provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties--for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
|
||||
5. COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled "History"
|
||||
in the various original documents, forming one section Entitled
|
||||
"History"; likewise combine any sections Entitled "Acknowledgements",
|
||||
and any sections Entitled "Dedications". You must delete all sections
|
||||
Entitled "Endorsements".
|
||||
|
||||
|
||||
6. COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
|
||||
|
||||
7. AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an "aggregate" if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
|
||||
|
||||
8. TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
If a section in the Document is Entitled "Acknowledgements",
|
||||
"Dedications", or "History", the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
|
||||
|
||||
9. TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document except
|
||||
as expressly provided for under this License. Any other attempt to
|
||||
copy, modify, sublicense or distribute the Document 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.
|
||||
|
||||
|
||||
10. FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation 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. See
|
||||
http://www.gnu.org/copyleft/.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation.
|
||||
|
||||
|
||||
ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
Copyright (c) YEAR YOUR NAME.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the "with...Texts." line with this:
|
||||
|
||||
with the Invariant Sections being LIST THEIR TITLES, with the
|
||||
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
|
@ -0,0 +1,4 @@
|
|||
#! /bin/sh
|
||||
#This file outputs in a separate line each file with a .desktop syntax
|
||||
#that needs to be translated but has a non .desktop extension
|
||||
find -name \*.kwinrules -print
|
|
@ -0,0 +1,5 @@
|
|||
Developer documentation can be found in the KDE Community Wiki:
|
||||
|
||||
* http://community.kde.org/KWin - KWin start page
|
||||
* http://community.kde.org/KWin/Hacking - Hacking information
|
||||
* http://community.kde.org/KWin/Class_Diagram - Class Diagram
|
98
HACKING.md
98
HACKING.md
|
@ -1,98 +0,0 @@
|
|||
# Quick building
|
||||
|
||||
KWin uses CMake. This means that KWin can be build in a normal cmake-style out of source tree.
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ../
|
||||
make
|
||||
|
||||
# Dependencies
|
||||
|
||||
All of KWin's dependencies are found through CMake. CMake will report what is missing. The dependencies can be installed using system packages. For the master branch it is possible that system packages are not up to date. KWin master sometimes depends from the master branch of some KDE frameworks (mostly KWayland and KWindowSystems) and other components inside Plasma (KDecoration). KWin never depends on unreleased third party components. In such a case it is required to build these components also from master. Alternatively some distributions provide daily build packages which can also be used instead. Stable branches never depend on unstable components. On Debian based distributions the easiest way to install all build dependencies is
|
||||
|
||||
sudo apt build-dep kwin-wayland
|
||||
|
||||
# Running the build KWin
|
||||
KWin can be executed directly from the build directory. All binaries are put into a subdirectory bin. From there KWin and its tests can be started.
|
||||
|
||||
## Nested KWin/Wayland
|
||||
The best way to test changes in KWin is through using the nested KWin Wayland in a running X11 or Wayland session.
|
||||
|
||||
To start a nested KWin Wayland use:
|
||||
|
||||
cd build
|
||||
cd bin
|
||||
QT_PLUGIN_PATH=`pwd` dbus-run-session ./kwin_wayland --xwayland --socket=wayland-1
|
||||
|
||||
The socket option is not required if KWin is started from an X11 session. On Wayland of course a socket not matching the session's socket must be chosen. To show windows in the nested KWin adjust the environment variables DISPLAY (for X11 windows) and WAYLAND_DISPLAY (for Wayland windows). Alternatively it's possible to pass applications to launch as command line arguments to kwin_wayland command. E.g.
|
||||
|
||||
QT_PLUGIN_PATH=`pwd` dbus-run-session ./kwin_wayland --xwayland --socket=wayland-1 konsole
|
||||
|
||||
Will start a konsole in the nested KWin.
|
||||
|
||||
### Why adjusting QT_PLUGIN_PATH?
|
||||
|
||||
Qt's plugin path needs to point to the build directory so that KWin can load the plugins from the build directory instead of using the system installed plugins which would normally be preferred.
|
||||
|
||||
### Why start a dedicated DBus session?
|
||||
|
||||
KWin interacts with kglobalaccel, so starting KWin without a dedicated DBus session would steal all global shortcuts from the running session. KGlobalaccel is just a very prominent example, there are further DBus interaction problems without a dedicated DBus session.
|
||||
|
||||
## DRM platform
|
||||
|
||||
The nested setup only works for the X11 and Wayland platform plugins. Changes in the DRM platform plugin or libinput cannot be tested in a nested setup. To test these, change to a tty, login and start kwin_wayland with the same command as for nested. KWin automatically picks the DRM platform as neither DISPLAY nor WAYLAND_DISPLAY environment variables should be defined.
|
||||
|
||||
## KWin/X11
|
||||
|
||||
KWin for the X11 windowing system cannot be tested with a nested Wayland setup. Instead the common way is to run KWin and replace the existing window manager of the X session:
|
||||
|
||||
cd build
|
||||
cd bin
|
||||
QT_PLUGIN_PATH=`pwd` ./kwin_x11 --replace
|
||||
|
||||
In this case also the current DBus session should be used and dbus-run-session should not be used. Of course it's only possible to start kwin_x11 in an X session. On Wayland kwin_x11 will refuse to start.
|
||||
|
||||
### Xephyr
|
||||
|
||||
It is possible to run kwin_x11 in a Xephyr window, but this is rather limited and especially the OpenGL compositor cannot really be tested. For X11 it's better to replace the running session. On Wayland using Xephyr is better than nothing.
|
||||
|
||||
## Containers
|
||||
While it is possible to run KWin through container technologies such as docker this is not recommended. KWin needs to interact with the actual hardware such as the OpenGL drivers, input devices, etc. Getting this setup is possible, but complicated. With containers one can only achieve a nested setup and this requires passing through the socket of the host's windowing system, device files for graphics stack, etc.
|
||||
|
||||
# Attaching a debugger
|
||||
|
||||
Debugging KWin is challenging as KWin is drawing the screen. If you gdb into a running kwin_x11 or kwin_wayland from your current session, it's probably the last thing you'll do in the session. The session hard locks the moment the debugger is attached to the process. Due to that never attach a debugger from your running session.
|
||||
|
||||
It is possible to attach gdb from another tty, but that is only a solution for X11. On Wayland one would not be able to switch back to the tty once a breakpoint is hit as KWin is responsible for tty switching.
|
||||
|
||||
Overall the only sensible solution for attaching gdb is from another system through ssh.
|
||||
|
||||
## Better ways of debugging
|
||||
As attaching gdb to a running session is not a satisfying solution it is better to run nested KWin Wayland in gdb. E.g.
|
||||
|
||||
cd build
|
||||
cd bin
|
||||
QT_PLUGIN_PATH=`pwd` dbus-run-session gdb --args ./kwin_wayland --xwayland --socket=wayland-1
|
||||
|
||||
Another solution is using KWin's extensive test suite and run the appropriate test binary through gdb.
|
||||
|
||||
# Automatic tests
|
||||
KWin's test suite is explained in document [TESTING](TESTING.md).
|
||||
|
||||
# Contributing patches
|
||||
|
||||
KWin uses [KDE's phabricator instance](https://phabricator.kde.org) for code review. Patches can be uploaded automatically using the tool arcanist. A possible workflow could look like:
|
||||
|
||||
git checkout -b my-feature-branch
|
||||
git add ...
|
||||
git commit
|
||||
arc diff
|
||||
|
||||
More complete documentation can be found in [KDE's wiki](https://community.kde.org/Infrastructure/Phabricator). Please add "#KWin" as reviewers. Please run KWin's automated test suite prior to uploading a patch to ensure that the change does not break existing code.
|
||||
|
||||
# Coding conventions
|
||||
KWin's coding conventions are explained in document [coding-conventions.md](doc/coding-conventions.md).
|
||||
|
||||
# Coding style
|
||||
KWin code follows the [Frameworks coding style](https://techbase.kde.org/Policies/Frameworks_Coding_Style).
|
|
@ -1,22 +0,0 @@
|
|||
Copyright (c) <year> <owner>. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
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 HOLDER 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.
|
|
@ -1,26 +0,0 @@
|
|||
Copyright (c) <year> <owner>. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 HOLDER 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.
|
|
@ -1,319 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 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.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public License is intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users. This General Public License applies to
|
||||
most of the Free Software Foundation's software and to any other program whose
|
||||
authors commit to using it. (Some other Free Software Foundation software
|
||||
is covered by the GNU Lesser General Public License instead.) You can apply
|
||||
it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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 or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or
|
||||
for a fee, you must give the recipients all the rights that you have. You
|
||||
must make sure that they, too, receive or can get the source code. And you
|
||||
must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2)
|
||||
offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that
|
||||
everyone understands that there is no warranty for this free software. If
|
||||
the software is modified by someone else and passed on, we want its recipients
|
||||
to know that what they have is not the original, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that redistributors of a free program will individually
|
||||
obtain patent licenses, in effect making the program proprietary. To prevent
|
||||
this, we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains a notice
|
||||
placed by the copyright holder saying it may be distributed under the terms
|
||||
of this General Public License. The "Program", below, refers to any such program
|
||||
or work, and a "work based on the Program" means either the Program or any
|
||||
derivative work under copyright law: that is to say, a work containing the
|
||||
Program or a portion of it, either verbatim or with modifications and/or translated
|
||||
into another language. (Hereinafter, translation is included without limitation
|
||||
in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running the Program
|
||||
is not restricted, and the output from the Program is covered only if its
|
||||
contents constitute a work based on the Program (independent of having been
|
||||
made by running the Program). Whether that is true depends on what the Program
|
||||
does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's 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 give any other recipients of the Program a copy of this
|
||||
License along with the Program.
|
||||
|
||||
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 Program or any portion of it,
|
||||
thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in whole or
|
||||
in part contains or is derived from the Program or any part thereof, to be
|
||||
licensed as a whole at no charge to all third parties under the terms of this
|
||||
License.
|
||||
|
||||
c) If the modified program normally reads commands interactively when run,
|
||||
you must cause it, when started running for such interactive use in the most
|
||||
ordinary way, to print or display an announcement including an appropriate
|
||||
copyright notice and a notice that there is no warranty (or else, saying that
|
||||
you provide a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this License.
|
||||
(Exception: if the Program itself is interactive but does not normally print
|
||||
such an announcement, your work based on the Program is not required to print
|
||||
an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Program, 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 Program, 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 Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with
|
||||
the Program (or with a work based on the Program) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section
|
||||
2) in object code or executable form under the terms of Sections 1 and 2 above
|
||||
provided that you also do one of the following:
|
||||
|
||||
a) 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; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three years, to give
|
||||
any third party, for a charge no more than your cost of physically performing
|
||||
source distribution, a complete machine-readable copy of the corresponding
|
||||
source code, to be distributed under the terms of Sections 1 and 2 above on
|
||||
a medium customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer to distribute
|
||||
corresponding source code. (This alternative is allowed only for noncommercial
|
||||
distribution and only if you received the program in object code or executable
|
||||
form with such an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for making
|
||||
modifications to it. For an executable work, 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 executable. However, as a special exception, the source code 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.
|
||||
|
||||
If distribution of executable or 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 counts as distribution of the source code,
|
||||
even though third parties are not compelled to copy the source along with
|
||||
the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except
|
||||
as expressly provided under this License. Any attempt otherwise to copy, modify,
|
||||
sublicense or distribute the Program 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.
|
||||
|
||||
5. 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
|
||||
Program or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Program
|
||||
(or any work based on the Program), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute or modify the Program 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 to this License.
|
||||
|
||||
7. 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 Program at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Program
|
||||
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 Program.
|
||||
|
||||
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.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Program 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.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of
|
||||
the 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 Program 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
|
||||
Program does not specify a version number of this License, you may choose
|
||||
any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs
|
||||
whose distribution conditions are different, 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
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
|
||||
"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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 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 Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible
|
||||
use to the public, the best way to achieve this is to make it free software
|
||||
which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. 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.
|
||||
|
||||
<one line to give the program's name and an idea of what it does.>
|
||||
|
||||
Copyright (C)< yyyy> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; 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.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when
|
||||
it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
|
||||
with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software,
|
||||
and you are welcome to redistribute it under certain conditions; type `show
|
||||
c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may be
|
||||
called something other than `show w' and `show c'; they could even be mouse-clicks
|
||||
or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'
|
||||
(which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon >, 1 April 1989 Ty Coon, President of Vice This General
|
||||
Public License does not permit incorporating your program into proprietary
|
||||
programs. If your program is a subroutine library, you may consider it more
|
||||
useful to permit linking proprietary applications with the library. If this
|
||||
is what you want to do, use the GNU Lesser General Public License instead
|
||||
of this License.
|
|
@ -1,319 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 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.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public License is intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users. This General Public License applies to
|
||||
most of the Free Software Foundation's software and to any other program whose
|
||||
authors commit to using it. (Some other Free Software Foundation software
|
||||
is covered by the GNU Lesser General Public License instead.) You can apply
|
||||
it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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 or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or
|
||||
for a fee, you must give the recipients all the rights that you have. You
|
||||
must make sure that they, too, receive or can get the source code. And you
|
||||
must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2)
|
||||
offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that
|
||||
everyone understands that there is no warranty for this free software. If
|
||||
the software is modified by someone else and passed on, we want its recipients
|
||||
to know that what they have is not the original, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that redistributors of a free program will individually
|
||||
obtain patent licenses, in effect making the program proprietary. To prevent
|
||||
this, we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains a notice
|
||||
placed by the copyright holder saying it may be distributed under the terms
|
||||
of this General Public License. The "Program", below, refers to any such program
|
||||
or work, and a "work based on the Program" means either the Program or any
|
||||
derivative work under copyright law: that is to say, a work containing the
|
||||
Program or a portion of it, either verbatim or with modifications and/or translated
|
||||
into another language. (Hereinafter, translation is included without limitation
|
||||
in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running the Program
|
||||
is not restricted, and the output from the Program is covered only if its
|
||||
contents constitute a work based on the Program (independent of having been
|
||||
made by running the Program). Whether that is true depends on what the Program
|
||||
does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's 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 give any other recipients of the Program a copy of this
|
||||
License along with the Program.
|
||||
|
||||
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 Program or any portion of it,
|
||||
thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in whole or
|
||||
in part contains or is derived from the Program or any part thereof, to be
|
||||
licensed as a whole at no charge to all third parties under the terms of this
|
||||
License.
|
||||
|
||||
c) If the modified program normally reads commands interactively when run,
|
||||
you must cause it, when started running for such interactive use in the most
|
||||
ordinary way, to print or display an announcement including an appropriate
|
||||
copyright notice and a notice that there is no warranty (or else, saying that
|
||||
you provide a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this License.
|
||||
(Exception: if the Program itself is interactive but does not normally print
|
||||
such an announcement, your work based on the Program is not required to print
|
||||
an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Program, 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 Program, 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 Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with
|
||||
the Program (or with a work based on the Program) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section
|
||||
2) in object code or executable form under the terms of Sections 1 and 2 above
|
||||
provided that you also do one of the following:
|
||||
|
||||
a) 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; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three years, to give
|
||||
any third party, for a charge no more than your cost of physically performing
|
||||
source distribution, a complete machine-readable copy of the corresponding
|
||||
source code, to be distributed under the terms of Sections 1 and 2 above on
|
||||
a medium customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer to distribute
|
||||
corresponding source code. (This alternative is allowed only for noncommercial
|
||||
distribution and only if you received the program in object code or executable
|
||||
form with such an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for making
|
||||
modifications to it. For an executable work, 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 executable. However, as a special exception, the source code 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.
|
||||
|
||||
If distribution of executable or 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 counts as distribution of the source code,
|
||||
even though third parties are not compelled to copy the source along with
|
||||
the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except
|
||||
as expressly provided under this License. Any attempt otherwise to copy, modify,
|
||||
sublicense or distribute the Program 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.
|
||||
|
||||
5. 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
|
||||
Program or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Program
|
||||
(or any work based on the Program), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute or modify the Program 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 to this License.
|
||||
|
||||
7. 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 Program at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Program
|
||||
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 Program.
|
||||
|
||||
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.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Program 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.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of
|
||||
the 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 Program 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
|
||||
Program does not specify a version number of this License, you may choose
|
||||
any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs
|
||||
whose distribution conditions are different, 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
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
|
||||
"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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 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 Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible
|
||||
use to the public, the best way to achieve this is to make it free software
|
||||
which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. 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.
|
||||
|
||||
<one line to give the program's name and an idea of what it does.>
|
||||
|
||||
Copyright (C) <yyyy> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; 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.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when
|
||||
it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
|
||||
with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software,
|
||||
and you are welcome to redistribute it under certain conditions; type `show
|
||||
c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may be
|
||||
called something other than `show w' and `show c'; they could even be mouse-clicks
|
||||
or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'
|
||||
(which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General
|
||||
Public License does not permit incorporating your program into proprietary
|
||||
programs. If your program is a subroutine library, you may consider it more
|
||||
useful to permit linking proprietary applications with the library. If this
|
||||
is what you want to do, use the GNU Lesser General Public License instead
|
||||
of this License.
|
|
@ -1,625 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and
|
||||
other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take
|
||||
away your freedom to share and change the works. By contrast, the GNU General
|
||||
Public License is intended to guarantee your freedom to share and change all
|
||||
versions of a program--to make sure it remains free software for all its users.
|
||||
We, the Free Software Foundation, use the GNU General Public License for most
|
||||
of our software; it applies also to any other work released this way by its
|
||||
authors. You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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 them if you wish), that
|
||||
you receive source code or can get it if you want it, that you can change
|
||||
the software or use pieces of it in new free programs, and that you know you
|
||||
can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights
|
||||
or asking you to surrender the rights. Therefore, you have certain responsibilities
|
||||
if you distribute copies of the software, or if you modify it: responsibilities
|
||||
to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or
|
||||
for a fee, you must pass on to the recipients the same freedoms that you received.
|
||||
You must make sure that they, too, receive or can get the source code. And
|
||||
you must show them these terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert
|
||||
copyright on the software, and (2) offer you this License giving you legal
|
||||
permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that
|
||||
there is no warranty for this free software. For both users' and authors'
|
||||
sake, the GPL requires that modified versions be marked as changed, so that
|
||||
their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified
|
||||
versions of the software inside them, although the manufacturer can do so.
|
||||
This is fundamentally incompatible with the aim of protecting users' freedom
|
||||
to change the software. The systematic pattern of such abuse occurs in the
|
||||
area of products for individuals to use, which is precisely where it is most
|
||||
unacceptable. Therefore, we have designed this version of the GPL to prohibit
|
||||
the practice for those products. If such problems arise substantially in other
|
||||
domains, we stand ready to extend this provision to those domains in future
|
||||
versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States
|
||||
should not allow patents to restrict development and use of software on general-purpose
|
||||
computers, but in those that do, we wish to avoid the special danger that
|
||||
patents applied to a free program could make it effectively proprietary. To
|
||||
prevent this, the GPL assures that patents cannot be used to render the program
|
||||
non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works,
|
||||
such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License.
|
||||
Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals
|
||||
or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in
|
||||
a fashion requiring copyright permission, other than the making of an exact
|
||||
copy. The resulting work is called a "modified version" of the earlier work
|
||||
or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the
|
||||
Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission,
|
||||
would make you directly or secondarily liable for infringement under applicable
|
||||
copyright law, except executing it on a computer or modifying a private copy.
|
||||
Propagation includes copying, distribution (with or without modification),
|
||||
making available to the public, and in some countries other activities as
|
||||
well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties
|
||||
to make or receive copies. Mere interaction with a user through a computer
|
||||
network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the
|
||||
extent that it includes a convenient and prominently visible feature that
|
||||
(1) displays an appropriate copyright notice, and (2) tells the user that
|
||||
there is no warranty for the work (except to the extent that warranties are
|
||||
provided), that licensees may convey the work under this License, and how
|
||||
to view a copy of this License. If the interface presents a list of user commands
|
||||
or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work for making
|
||||
modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard
|
||||
defined by a recognized standards body, or, in the case of interfaces specified
|
||||
for a particular programming language, one that is widely used among developers
|
||||
working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than
|
||||
the work as a whole, that (a) is included in the normal form of packaging
|
||||
a Major Component, but which is not part of that Major Component, and (b)
|
||||
serves only to enable use of the work with that Major Component, or to implement
|
||||
a Standard Interface for which an implementation is available to the public
|
||||
in source code form. A "Major Component", in this context, means a major essential
|
||||
component (kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to produce
|
||||
the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source
|
||||
code needed to generate, install, and (for an executable work) run the object
|
||||
code and to modify the work, including scripts to control those activities.
|
||||
However, it does not include the work's System Libraries, or general-purpose
|
||||
tools or generally available free programs which are used unmodified in performing
|
||||
those activities but which are not part of the work. For example, Corresponding
|
||||
Source includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically linked
|
||||
subprograms that the work is specifically designed to require, such as by
|
||||
intimate data communication or control flow between those subprograms and
|
||||
other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate
|
||||
automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of copyright
|
||||
on the Program, and are irrevocable provided the stated conditions are met.
|
||||
This License explicitly affirms your unlimited permission to run the unmodified
|
||||
Program. The output from running a covered work is covered by this License
|
||||
only if the output, given its content, constitutes a covered work. This License
|
||||
acknowledges your rights of fair use or other equivalent, as provided by copyright
|
||||
law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without
|
||||
conditions so long as your license otherwise remains in force. You may convey
|
||||
covered works to others for the sole purpose of having them make modifications
|
||||
exclusively for you, or provide you with facilities for running those works,
|
||||
provided that you comply with the terms of this License in conveying all material
|
||||
for which you do not control copyright. Those thus making or running the covered
|
||||
works for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of your copyrighted
|
||||
material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions
|
||||
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological measure
|
||||
under any applicable law fulfilling obligations under article 11 of the WIPO
|
||||
copyright treaty adopted on 20 December 1996, or similar laws prohibiting
|
||||
or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention
|
||||
of technological measures to the extent such circumvention is effected by
|
||||
exercising rights under this License with respect to the covered work, and
|
||||
you disclaim any intention to limit operation or modification of the work
|
||||
as a means of enforcing, against the work's users, your or third parties'
|
||||
legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you receive
|
||||
it, in any medium, provided that you conspicuously and appropriately publish
|
||||
on each copy an appropriate copyright notice; keep intact all notices stating
|
||||
that this License and any non-permissive terms added in accord with section
|
||||
7 apply to the code; keep intact all notices of the absence of any warranty;
|
||||
and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you
|
||||
may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to produce
|
||||
it from the Program, in the form of source code under the terms of section
|
||||
4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and
|
||||
giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under
|
||||
this License and any conditions added under section 7. This requirement modifies
|
||||
the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone
|
||||
who comes into possession of a copy. This License will therefore apply, along
|
||||
with any applicable section 7 additional terms, to the whole of the work,
|
||||
and all its parts, regardless of how they are packaged. This License gives
|
||||
no permission to license the work in any other way, but it does not invalidate
|
||||
such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate
|
||||
Legal Notices; however, if the Program has interactive interfaces that do
|
||||
not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works,
|
||||
which are not by their nature extensions of the covered work, and which are
|
||||
not combined with it such as to form a larger program, in or on a volume of
|
||||
a storage or distribution medium, is called an "aggregate" if the compilation
|
||||
and its resulting copyright are not used to limit the access or legal rights
|
||||
of the compilation's users beyond what the individual works permit. Inclusion
|
||||
of a covered work in an aggregate does not cause this License to apply to
|
||||
the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms of sections
|
||||
4 and 5, provided that you also convey the machine-readable Corresponding
|
||||
Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including
|
||||
a physical distribution medium), accompanied by the Corresponding Source fixed
|
||||
on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including
|
||||
a physical distribution medium), accompanied by a written offer, valid for
|
||||
at least three years and valid for as long as you offer spare parts or customer
|
||||
support for that product model, to give anyone who possesses the object code
|
||||
either (1) a copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical medium customarily
|
||||
used for software interchange, for a price no more than your reasonable cost
|
||||
of physically performing this conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written
|
||||
offer to provide the Corresponding Source. This alternative is allowed only
|
||||
occasionally and noncommercially, and only if you received the object code
|
||||
with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis
|
||||
or for a charge), and offer equivalent access to the Corresponding Source
|
||||
in the same way through the same place at no further charge. You need not
|
||||
require recipients to copy the Corresponding Source along with the object
|
||||
code. If the place to copy the object code is a network server, the Corresponding
|
||||
Source may be on a different server (operated by you or a third party) that
|
||||
supports equivalent copying facilities, provided you maintain clear directions
|
||||
next to the object code saying where to find the Corresponding Source. Regardless
|
||||
of what server hosts the Corresponding Source, you remain obligated to ensure
|
||||
that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform
|
||||
other peers where the object code and Corresponding Source of the work are
|
||||
being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from
|
||||
the Corresponding Source as a System Library, need not be included in conveying
|
||||
the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible
|
||||
personal property which is normally used for personal, family, or household
|
||||
purposes, or (2) anything designed or sold for incorporation into a dwelling.
|
||||
In determining whether a product is a consumer product, doubtful cases shall
|
||||
be resolved in favor of coverage. For a particular product received by a particular
|
||||
user, "normally used" refers to a typical or common use of that class of product,
|
||||
regardless of the status of the particular user or of the way in which the
|
||||
particular user actually uses, or expects or is expected to use, the product.
|
||||
A product is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent the
|
||||
only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures,
|
||||
authorization keys, or other information required to install and execute modified
|
||||
versions of a covered work in that User Product from a modified version of
|
||||
its Corresponding Source. The information must suffice to ensure that the
|
||||
continued functioning of the modified object code is in no case prevented
|
||||
or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically
|
||||
for use in, a User Product, and the conveying occurs as part of a transaction
|
||||
in which the right of possession and use of the User Product is transferred
|
||||
to the recipient in perpetuity or for a fixed term (regardless of how the
|
||||
transaction is characterized), the Corresponding Source conveyed under this
|
||||
section must be accompanied by the Installation Information. But this requirement
|
||||
does not apply if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has been installed
|
||||
in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement
|
||||
to continue to provide support service, warranty, or updates for a work that
|
||||
has been modified or installed by the recipient, or for the User Product in
|
||||
which it has been modified or installed. Access to a network may be denied
|
||||
when the modification itself materially and adversely affects the operation
|
||||
of the network or violates the rules and protocols for communication across
|
||||
the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord
|
||||
with this section must be in a format that is publicly documented (and with
|
||||
an implementation available to the public in source code form), and must require
|
||||
no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this License
|
||||
by making exceptions from one or more of its conditions. Additional permissions
|
||||
that are applicable to the entire Program shall be treated as though they
|
||||
were included in this License, to the extent that they are valid under applicable
|
||||
law. If additional permissions apply only to part of the Program, that part
|
||||
may be used separately under those permissions, but the entire Program remains
|
||||
governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any
|
||||
additional permissions from that copy, or from any part of it. (Additional
|
||||
permissions may be written to require their own removal in certain cases when
|
||||
you modify the work.) You may place additional permissions on material, added
|
||||
by you to a covered work, for which you have or can give appropriate copyright
|
||||
permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add
|
||||
to a covered work, you may (if authorized by the copyright holders of that
|
||||
material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of
|
||||
sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author
|
||||
attributions in that material or in the Appropriate Legal Notices displayed
|
||||
by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring
|
||||
that modified versions of such material be marked in reasonable ways as different
|
||||
from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors
|
||||
of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names,
|
||||
trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by
|
||||
anyone who conveys the material (or modified versions of it) with contractual
|
||||
assumptions of liability to the recipient, for any liability that these contractual
|
||||
assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions"
|
||||
within the meaning of section 10. If the Program as you received it, or any
|
||||
part of it, contains a notice stating that it is governed by this License
|
||||
along with a term that is a further restriction, you may remove that term.
|
||||
If a license document contains a further restriction but permits relicensing
|
||||
or conveying under this License, you may add to a covered work material governed
|
||||
by the terms of that license document, provided that the further restriction
|
||||
does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place,
|
||||
in the relevant source files, a statement of the additional terms that apply
|
||||
to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form
|
||||
of a separately written license, or stated as exceptions; the above requirements
|
||||
apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided
|
||||
under this License. Any attempt otherwise to propagate or modify it is void,
|
||||
and will automatically terminate your rights under this License (including
|
||||
any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from
|
||||
a particular copyright holder is reinstated (a) provisionally, unless and
|
||||
until the copyright holder explicitly and finally terminates your license,
|
||||
and (b) permanently, if the copyright holder fails to notify you of the violation
|
||||
by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently
|
||||
if the copyright holder notifies you of the violation by some reasonable means,
|
||||
this is the first time you have received notice of violation of this License
|
||||
(for any work) from that copyright holder, and you cure the violation prior
|
||||
to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses
|
||||
of parties who have received copies or rights from you under this License.
|
||||
If your rights have been terminated and not permanently reinstated, you do
|
||||
not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy
|
||||
of the Program. Ancillary propagation of a covered work occurring solely as
|
||||
a consequence of using peer-to-peer transmission to receive a copy likewise
|
||||
does not require acceptance. However, nothing other than this License grants
|
||||
you permission to propagate or modify any covered work. These actions infringe
|
||||
copyright if you do not accept this License. Therefore, by modifying or propagating
|
||||
a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives
|
||||
a license from the original licensors, to run, modify and propagate that work,
|
||||
subject to this License. You are not responsible for enforcing compliance
|
||||
by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization,
|
||||
or substantially all assets of one, or subdividing an organization, or merging
|
||||
organizations. If propagation of a covered work results from an entity transaction,
|
||||
each party to that transaction who receives a copy of the work also receives
|
||||
whatever licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the Corresponding
|
||||
Source of the work from the predecessor in interest, if the predecessor has
|
||||
it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights
|
||||
granted or affirmed under this License. For example, you may not impose a
|
||||
license fee, royalty, or other charge for exercise of rights granted under
|
||||
this License, and you may not initiate litigation (including a cross-claim
|
||||
or counterclaim in a lawsuit) alleging that any patent claim is infringed
|
||||
by making, using, selling, offering for sale, or importing the Program or
|
||||
any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License
|
||||
of the Program or a work on which the Program is based. The work thus licensed
|
||||
is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled
|
||||
by the contributor, whether already acquired or hereafter acquired, that would
|
||||
be infringed by some manner, permitted by this License, of making, using,
|
||||
or selling its contributor version, but do not include claims that would be
|
||||
infringed only as a consequence of further modification of the contributor
|
||||
version. For purposes of this definition, "control" includes the right to
|
||||
grant patent sublicenses in a manner consistent with the requirements of this
|
||||
License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent
|
||||
license under the contributor's essential patent claims, to make, use, sell,
|
||||
offer for sale, import and otherwise run, modify and propagate the contents
|
||||
of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement
|
||||
or commitment, however denominated, not to enforce a patent (such as an express
|
||||
permission to practice a patent or covenant not to sue for patent infringement).
|
||||
To "grant" such a patent license to a party means to make such an agreement
|
||||
or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the
|
||||
Corresponding Source of the work is not available for anyone to copy, free
|
||||
of charge and under the terms of this License, through a publicly available
|
||||
network server or other readily accessible means, then you must either (1)
|
||||
cause the Corresponding Source to be so available, or (2) arrange to deprive
|
||||
yourself of the benefit of the patent license for this particular work, or
|
||||
(3) arrange, in a manner consistent with the requirements of this License,
|
||||
to extend the patent license to downstream recipients. "Knowingly relying"
|
||||
means you have actual knowledge that, but for the patent license, your conveying
|
||||
the covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that country
|
||||
that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement,
|
||||
you convey, or propagate by procuring conveyance of, a covered work, and grant
|
||||
a patent license to some of the parties receiving the covered work authorizing
|
||||
them to use, propagate, modify or convey a specific copy of the covered work,
|
||||
then the patent license you grant is automatically extended to all recipients
|
||||
of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope
|
||||
of its coverage, prohibits the exercise of, or is conditioned on the non-exercise
|
||||
of one or more of the rights that are specifically granted under this License.
|
||||
You may not convey a covered work if you are a party to an arrangement with
|
||||
a third party that is in the business of distributing software, under which
|
||||
you make payment to the third party based on the extent of your activity of
|
||||
conveying the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory patent
|
||||
license (a) in connection with copies of the covered work conveyed by you
|
||||
(or copies made from those copies), or (b) primarily for and in connection
|
||||
with specific products or compilations that contain the covered work, unless
|
||||
you entered into that arrangement, or that patent license was granted, prior
|
||||
to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied
|
||||
license or other defenses to infringement that may otherwise be available
|
||||
to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a covered work so as
|
||||
to satisfy simultaneously your obligations under this License and any other
|
||||
pertinent obligations, then as a consequence you may not convey it at all.
|
||||
For example, if you agree to terms that obligate you to collect a royalty
|
||||
for further conveying from those to whom you convey the Program, the only
|
||||
way you could satisfy both those terms and this License would be to refrain
|
||||
entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to
|
||||
link or combine any covered work with a work licensed under version 3 of the
|
||||
GNU Affero General Public License into a single combined work, and to convey
|
||||
the resulting work. The terms of this License will continue to apply to the
|
||||
part which is the covered work, but the special requirements of the GNU Affero
|
||||
General Public License, section 13, concerning interaction through a network
|
||||
will apply to the combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the
|
||||
GNU 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 Program specifies
|
||||
that a certain numbered version of the GNU General Public License "or any
|
||||
later version" applies to it, you have the option of following the terms and
|
||||
conditions either of that numbered version or of any later version published
|
||||
by the Free Software Foundation. If the Program does not specify a version
|
||||
number of the GNU General Public License, you may choose any version ever
|
||||
published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of
|
||||
the GNU General Public License can be used, that proxy's public statement
|
||||
of acceptance of a version permanently authorizes you to choose that version
|
||||
for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However,
|
||||
no additional obligations are imposed on any author or copyright holder as
|
||||
a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
|
||||
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM
|
||||
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||
CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
|
||||
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM
|
||||
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 PROGRAM (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
|
||||
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot
|
||||
be given local legal effect according to their terms, reviewing courts shall
|
||||
apply local law that most closely approximates an absolute waiver of all civil
|
||||
liability in connection with the Program, unless a warranty or assumption
|
||||
of liability accompanies a copy of the Program in return for a fee. END OF
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible
|
||||
use to the public, the best way to achieve this is to make it free software
|
||||
which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach
|
||||
them to the start of each source file to most effectively state the exclusion
|
||||
of warranty; and each file should have at least the "copyright" line and a
|
||||
pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like
|
||||
this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
|
||||
This is free software, and you are welcome to redistribute it under certain
|
||||
conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands might
|
||||
be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary. For
|
||||
more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General Public
|
||||
License instead of this License. But first, please read <https://www.gnu.org/
|
||||
licenses /why-not-lgpl.html>.
|
|
@ -1,625 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and
|
||||
other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take
|
||||
away your freedom to share and change the works. By contrast, the GNU General
|
||||
Public License is intended to guarantee your freedom to share and change all
|
||||
versions of a program--to make sure it remains free software for all its users.
|
||||
We, the Free Software Foundation, use the GNU General Public License for most
|
||||
of our software; it applies also to any other work released this way by its
|
||||
authors. You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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 them if you wish), that
|
||||
you receive source code or can get it if you want it, that you can change
|
||||
the software or use pieces of it in new free programs, and that you know you
|
||||
can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights
|
||||
or asking you to surrender the rights. Therefore, you have certain responsibilities
|
||||
if you distribute copies of the software, or if you modify it: responsibilities
|
||||
to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or
|
||||
for a fee, you must pass on to the recipients the same freedoms that you received.
|
||||
You must make sure that they, too, receive or can get the source code. And
|
||||
you must show them these terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert
|
||||
copyright on the software, and (2) offer you this License giving you legal
|
||||
permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that
|
||||
there is no warranty for this free software. For both users' and authors'
|
||||
sake, the GPL requires that modified versions be marked as changed, so that
|
||||
their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified
|
||||
versions of the software inside them, although the manufacturer can do so.
|
||||
This is fundamentally incompatible with the aim of protecting users' freedom
|
||||
to change the software. The systematic pattern of such abuse occurs in the
|
||||
area of products for individuals to use, which is precisely where it is most
|
||||
unacceptable. Therefore, we have designed this version of the GPL to prohibit
|
||||
the practice for those products. If such problems arise substantially in other
|
||||
domains, we stand ready to extend this provision to those domains in future
|
||||
versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States
|
||||
should not allow patents to restrict development and use of software on general-purpose
|
||||
computers, but in those that do, we wish to avoid the special danger that
|
||||
patents applied to a free program could make it effectively proprietary. To
|
||||
prevent this, the GPL assures that patents cannot be used to render the program
|
||||
non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works,
|
||||
such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License.
|
||||
Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals
|
||||
or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in
|
||||
a fashion requiring copyright permission, other than the making of an exact
|
||||
copy. The resulting work is called a "modified version" of the earlier work
|
||||
or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the
|
||||
Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission,
|
||||
would make you directly or secondarily liable for infringement under applicable
|
||||
copyright law, except executing it on a computer or modifying a private copy.
|
||||
Propagation includes copying, distribution (with or without modification),
|
||||
making available to the public, and in some countries other activities as
|
||||
well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties
|
||||
to make or receive copies. Mere interaction with a user through a computer
|
||||
network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the
|
||||
extent that it includes a convenient and prominently visible feature that
|
||||
(1) displays an appropriate copyright notice, and (2) tells the user that
|
||||
there is no warranty for the work (except to the extent that warranties are
|
||||
provided), that licensees may convey the work under this License, and how
|
||||
to view a copy of this License. If the interface presents a list of user commands
|
||||
or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work for making
|
||||
modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard
|
||||
defined by a recognized standards body, or, in the case of interfaces specified
|
||||
for a particular programming language, one that is widely used among developers
|
||||
working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than
|
||||
the work as a whole, that (a) is included in the normal form of packaging
|
||||
a Major Component, but which is not part of that Major Component, and (b)
|
||||
serves only to enable use of the work with that Major Component, or to implement
|
||||
a Standard Interface for which an implementation is available to the public
|
||||
in source code form. A "Major Component", in this context, means a major essential
|
||||
component (kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to produce
|
||||
the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source
|
||||
code needed to generate, install, and (for an executable work) run the object
|
||||
code and to modify the work, including scripts to control those activities.
|
||||
However, it does not include the work's System Libraries, or general-purpose
|
||||
tools or generally available free programs which are used unmodified in performing
|
||||
those activities but which are not part of the work. For example, Corresponding
|
||||
Source includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically linked
|
||||
subprograms that the work is specifically designed to require, such as by
|
||||
intimate data communication or control flow between those subprograms and
|
||||
other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate
|
||||
automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of copyright
|
||||
on the Program, and are irrevocable provided the stated conditions are met.
|
||||
This License explicitly affirms your unlimited permission to run the unmodified
|
||||
Program. The output from running a covered work is covered by this License
|
||||
only if the output, given its content, constitutes a covered work. This License
|
||||
acknowledges your rights of fair use or other equivalent, as provided by copyright
|
||||
law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without
|
||||
conditions so long as your license otherwise remains in force. You may convey
|
||||
covered works to others for the sole purpose of having them make modifications
|
||||
exclusively for you, or provide you with facilities for running those works,
|
||||
provided that you comply with the terms of this License in conveying all material
|
||||
for which you do not control copyright. Those thus making or running the covered
|
||||
works for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of your copyrighted
|
||||
material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions
|
||||
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological measure
|
||||
under any applicable law fulfilling obligations under article 11 of the WIPO
|
||||
copyright treaty adopted on 20 December 1996, or similar laws prohibiting
|
||||
or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention
|
||||
of technological measures to the extent such circumvention is effected by
|
||||
exercising rights under this License with respect to the covered work, and
|
||||
you disclaim any intention to limit operation or modification of the work
|
||||
as a means of enforcing, against the work's users, your or third parties'
|
||||
legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you receive
|
||||
it, in any medium, provided that you conspicuously and appropriately publish
|
||||
on each copy an appropriate copyright notice; keep intact all notices stating
|
||||
that this License and any non-permissive terms added in accord with section
|
||||
7 apply to the code; keep intact all notices of the absence of any warranty;
|
||||
and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you
|
||||
may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to produce
|
||||
it from the Program, in the form of source code under the terms of section
|
||||
4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and
|
||||
giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under
|
||||
this License and any conditions added under section 7. This requirement modifies
|
||||
the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone
|
||||
who comes into possession of a copy. This License will therefore apply, along
|
||||
with any applicable section 7 additional terms, to the whole of the work,
|
||||
and all its parts, regardless of how they are packaged. This License gives
|
||||
no permission to license the work in any other way, but it does not invalidate
|
||||
such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate
|
||||
Legal Notices; however, if the Program has interactive interfaces that do
|
||||
not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works,
|
||||
which are not by their nature extensions of the covered work, and which are
|
||||
not combined with it such as to form a larger program, in or on a volume of
|
||||
a storage or distribution medium, is called an "aggregate" if the compilation
|
||||
and its resulting copyright are not used to limit the access or legal rights
|
||||
of the compilation's users beyond what the individual works permit. Inclusion
|
||||
of a covered work in an aggregate does not cause this License to apply to
|
||||
the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms of sections
|
||||
4 and 5, provided that you also convey the machine-readable Corresponding
|
||||
Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including
|
||||
a physical distribution medium), accompanied by the Corresponding Source fixed
|
||||
on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including
|
||||
a physical distribution medium), accompanied by a written offer, valid for
|
||||
at least three years and valid for as long as you offer spare parts or customer
|
||||
support for that product model, to give anyone who possesses the object code
|
||||
either (1) a copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical medium customarily
|
||||
used for software interchange, for a price no more than your reasonable cost
|
||||
of physically performing this conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written
|
||||
offer to provide the Corresponding Source. This alternative is allowed only
|
||||
occasionally and noncommercially, and only if you received the object code
|
||||
with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis
|
||||
or for a charge), and offer equivalent access to the Corresponding Source
|
||||
in the same way through the same place at no further charge. You need not
|
||||
require recipients to copy the Corresponding Source along with the object
|
||||
code. If the place to copy the object code is a network server, the Corresponding
|
||||
Source may be on a different server (operated by you or a third party) that
|
||||
supports equivalent copying facilities, provided you maintain clear directions
|
||||
next to the object code saying where to find the Corresponding Source. Regardless
|
||||
of what server hosts the Corresponding Source, you remain obligated to ensure
|
||||
that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform
|
||||
other peers where the object code and Corresponding Source of the work are
|
||||
being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from
|
||||
the Corresponding Source as a System Library, need not be included in conveying
|
||||
the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible
|
||||
personal property which is normally used for personal, family, or household
|
||||
purposes, or (2) anything designed or sold for incorporation into a dwelling.
|
||||
In determining whether a product is a consumer product, doubtful cases shall
|
||||
be resolved in favor of coverage. For a particular product received by a particular
|
||||
user, "normally used" refers to a typical or common use of that class of product,
|
||||
regardless of the status of the particular user or of the way in which the
|
||||
particular user actually uses, or expects or is expected to use, the product.
|
||||
A product is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent the
|
||||
only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures,
|
||||
authorization keys, or other information required to install and execute modified
|
||||
versions of a covered work in that User Product from a modified version of
|
||||
its Corresponding Source. The information must suffice to ensure that the
|
||||
continued functioning of the modified object code is in no case prevented
|
||||
or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically
|
||||
for use in, a User Product, and the conveying occurs as part of a transaction
|
||||
in which the right of possession and use of the User Product is transferred
|
||||
to the recipient in perpetuity or for a fixed term (regardless of how the
|
||||
transaction is characterized), the Corresponding Source conveyed under this
|
||||
section must be accompanied by the Installation Information. But this requirement
|
||||
does not apply if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has been installed
|
||||
in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement
|
||||
to continue to provide support service, warranty, or updates for a work that
|
||||
has been modified or installed by the recipient, or for the User Product in
|
||||
which it has been modified or installed. Access to a network may be denied
|
||||
when the modification itself materially and adversely affects the operation
|
||||
of the network or violates the rules and protocols for communication across
|
||||
the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord
|
||||
with this section must be in a format that is publicly documented (and with
|
||||
an implementation available to the public in source code form), and must require
|
||||
no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this License
|
||||
by making exceptions from one or more of its conditions. Additional permissions
|
||||
that are applicable to the entire Program shall be treated as though they
|
||||
were included in this License, to the extent that they are valid under applicable
|
||||
law. If additional permissions apply only to part of the Program, that part
|
||||
may be used separately under those permissions, but the entire Program remains
|
||||
governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any
|
||||
additional permissions from that copy, or from any part of it. (Additional
|
||||
permissions may be written to require their own removal in certain cases when
|
||||
you modify the work.) You may place additional permissions on material, added
|
||||
by you to a covered work, for which you have or can give appropriate copyright
|
||||
permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add
|
||||
to a covered work, you may (if authorized by the copyright holders of that
|
||||
material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of
|
||||
sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author
|
||||
attributions in that material or in the Appropriate Legal Notices displayed
|
||||
by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring
|
||||
that modified versions of such material be marked in reasonable ways as different
|
||||
from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors
|
||||
of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names,
|
||||
trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by
|
||||
anyone who conveys the material (or modified versions of it) with contractual
|
||||
assumptions of liability to the recipient, for any liability that these contractual
|
||||
assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions"
|
||||
within the meaning of section 10. If the Program as you received it, or any
|
||||
part of it, contains a notice stating that it is governed by this License
|
||||
along with a term that is a further restriction, you may remove that term.
|
||||
If a license document contains a further restriction but permits relicensing
|
||||
or conveying under this License, you may add to a covered work material governed
|
||||
by the terms of that license document, provided that the further restriction
|
||||
does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place,
|
||||
in the relevant source files, a statement of the additional terms that apply
|
||||
to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form
|
||||
of a separately written license, or stated as exceptions; the above requirements
|
||||
apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided
|
||||
under this License. Any attempt otherwise to propagate or modify it is void,
|
||||
and will automatically terminate your rights under this License (including
|
||||
any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from
|
||||
a particular copyright holder is reinstated (a) provisionally, unless and
|
||||
until the copyright holder explicitly and finally terminates your license,
|
||||
and (b) permanently, if the copyright holder fails to notify you of the violation
|
||||
by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently
|
||||
if the copyright holder notifies you of the violation by some reasonable means,
|
||||
this is the first time you have received notice of violation of this License
|
||||
(for any work) from that copyright holder, and you cure the violation prior
|
||||
to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses
|
||||
of parties who have received copies or rights from you under this License.
|
||||
If your rights have been terminated and not permanently reinstated, you do
|
||||
not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy
|
||||
of the Program. Ancillary propagation of a covered work occurring solely as
|
||||
a consequence of using peer-to-peer transmission to receive a copy likewise
|
||||
does not require acceptance. However, nothing other than this License grants
|
||||
you permission to propagate or modify any covered work. These actions infringe
|
||||
copyright if you do not accept this License. Therefore, by modifying or propagating
|
||||
a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives
|
||||
a license from the original licensors, to run, modify and propagate that work,
|
||||
subject to this License. You are not responsible for enforcing compliance
|
||||
by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization,
|
||||
or substantially all assets of one, or subdividing an organization, or merging
|
||||
organizations. If propagation of a covered work results from an entity transaction,
|
||||
each party to that transaction who receives a copy of the work also receives
|
||||
whatever licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the Corresponding
|
||||
Source of the work from the predecessor in interest, if the predecessor has
|
||||
it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights
|
||||
granted or affirmed under this License. For example, you may not impose a
|
||||
license fee, royalty, or other charge for exercise of rights granted under
|
||||
this License, and you may not initiate litigation (including a cross-claim
|
||||
or counterclaim in a lawsuit) alleging that any patent claim is infringed
|
||||
by making, using, selling, offering for sale, or importing the Program or
|
||||
any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License
|
||||
of the Program or a work on which the Program is based. The work thus licensed
|
||||
is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled
|
||||
by the contributor, whether already acquired or hereafter acquired, that would
|
||||
be infringed by some manner, permitted by this License, of making, using,
|
||||
or selling its contributor version, but do not include claims that would be
|
||||
infringed only as a consequence of further modification of the contributor
|
||||
version. For purposes of this definition, "control" includes the right to
|
||||
grant patent sublicenses in a manner consistent with the requirements of this
|
||||
License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent
|
||||
license under the contributor's essential patent claims, to make, use, sell,
|
||||
offer for sale, import and otherwise run, modify and propagate the contents
|
||||
of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement
|
||||
or commitment, however denominated, not to enforce a patent (such as an express
|
||||
permission to practice a patent or covenant not to sue for patent infringement).
|
||||
To "grant" such a patent license to a party means to make such an agreement
|
||||
or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the
|
||||
Corresponding Source of the work is not available for anyone to copy, free
|
||||
of charge and under the terms of this License, through a publicly available
|
||||
network server or other readily accessible means, then you must either (1)
|
||||
cause the Corresponding Source to be so available, or (2) arrange to deprive
|
||||
yourself of the benefit of the patent license for this particular work, or
|
||||
(3) arrange, in a manner consistent with the requirements of this License,
|
||||
to extend the patent license to downstream recipients. "Knowingly relying"
|
||||
means you have actual knowledge that, but for the patent license, your conveying
|
||||
the covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that country
|
||||
that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement,
|
||||
you convey, or propagate by procuring conveyance of, a covered work, and grant
|
||||
a patent license to some of the parties receiving the covered work authorizing
|
||||
them to use, propagate, modify or convey a specific copy of the covered work,
|
||||
then the patent license you grant is automatically extended to all recipients
|
||||
of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope
|
||||
of its coverage, prohibits the exercise of, or is conditioned on the non-exercise
|
||||
of one or more of the rights that are specifically granted under this License.
|
||||
You may not convey a covered work if you are a party to an arrangement with
|
||||
a third party that is in the business of distributing software, under which
|
||||
you make payment to the third party based on the extent of your activity of
|
||||
conveying the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory patent
|
||||
license (a) in connection with copies of the covered work conveyed by you
|
||||
(or copies made from those copies), or (b) primarily for and in connection
|
||||
with specific products or compilations that contain the covered work, unless
|
||||
you entered into that arrangement, or that patent license was granted, prior
|
||||
to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied
|
||||
license or other defenses to infringement that may otherwise be available
|
||||
to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a covered work so as
|
||||
to satisfy simultaneously your obligations under this License and any other
|
||||
pertinent obligations, then as a consequence you may not convey it at all.
|
||||
For example, if you agree to terms that obligate you to collect a royalty
|
||||
for further conveying from those to whom you convey the Program, the only
|
||||
way you could satisfy both those terms and this License would be to refrain
|
||||
entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to
|
||||
link or combine any covered work with a work licensed under version 3 of the
|
||||
GNU Affero General Public License into a single combined work, and to convey
|
||||
the resulting work. The terms of this License will continue to apply to the
|
||||
part which is the covered work, but the special requirements of the GNU Affero
|
||||
General Public License, section 13, concerning interaction through a network
|
||||
will apply to the combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the
|
||||
GNU 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 Program specifies
|
||||
that a certain numbered version of the GNU General Public License "or any
|
||||
later version" applies to it, you have the option of following the terms and
|
||||
conditions either of that numbered version or of any later version published
|
||||
by the Free Software Foundation. If the Program does not specify a version
|
||||
number of the GNU General Public License, you may choose any version ever
|
||||
published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of
|
||||
the GNU General Public License can be used, that proxy's public statement
|
||||
of acceptance of a version permanently authorizes you to choose that version
|
||||
for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However,
|
||||
no additional obligations are imposed on any author or copyright holder as
|
||||
a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
|
||||
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM
|
||||
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||
CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
|
||||
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM
|
||||
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 PROGRAM (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
|
||||
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot
|
||||
be given local legal effect according to their terms, reviewing courts shall
|
||||
apply local law that most closely approximates an absolute waiver of all civil
|
||||
liability in connection with the Program, unless a warranty or assumption
|
||||
of liability accompanies a copy of the Program in return for a fee. END OF
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible
|
||||
use to the public, the best way to achieve this is to make it free software
|
||||
which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach
|
||||
them to the start of each source file to most effectively state the exclusion
|
||||
of warranty; and each file should have at least the "copyright" line and a
|
||||
pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like
|
||||
this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
|
||||
This is free software, and you are welcome to redistribute it under certain
|
||||
conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands might
|
||||
be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary. For
|
||||
more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General Public
|
||||
License instead of this License. But first, please read <https://www.gnu.org/
|
||||
licenses /why-not-lgpl.html>.
|
|
@ -1,446 +0,0 @@
|
|||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin St, 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 library GPL. It is numbered 2 because
|
||||
it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
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 Library General Public License, applies to some specially
|
||||
designated Free Software Foundation software, and to any other libraries whose
|
||||
authors decide to use it. You can use it for your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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 or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the 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
|
||||
a program 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.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright the library,
|
||||
and (2) offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain that everyone
|
||||
understands that there is no warranty for this free library. If the library
|
||||
is modified by someone else and passed on, we want its recipients to know
|
||||
that what they have is not the original version, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that companies distributing free software will individually
|
||||
obtain patent licenses, thus in effect transforming the program into proprietary
|
||||
software. To prevent this, we have made it clear that any patent must be licensed
|
||||
for everyone's free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License, which was designed for utility programs. This license,
|
||||
the GNU Library General Public License, applies to certain designated libraries.
|
||||
This license is quite different from the ordinary one; be sure to read it
|
||||
in full, and don't assume that anything in it is the same as in the ordinary
|
||||
license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that they
|
||||
blur the distinction we usually make between modifying or adding to a program
|
||||
and simply using it. Linking a program with a library, without changing the
|
||||
library, is in some sense simply using the library, and is analogous to running
|
||||
a utility program or application program. However, in a textual and legal
|
||||
sense, the linked executable is a combined work, a derivative of the original
|
||||
library, and the ordinary General Public License treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General Public License
|
||||
for libraries did not effectively promote software sharing, because most developers
|
||||
did not use the libraries. We concluded that weaker conditions might promote
|
||||
sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the users
|
||||
of those programs of all benefit from the free status of the libraries themselves.
|
||||
This Library General Public License is intended to permit developers of non-free
|
||||
programs to use free libraries, while preserving your freedom as a user of
|
||||
such programs to change the free libraries that are incorporated in them.
|
||||
(We have not seen how to achieve this as regards changes in header files,
|
||||
but we have achieved it as regards changes in the actual functions of the
|
||||
Library.) The hope is that this will lead to faster development of free libraries.
|
||||
|
||||
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, while the latter only works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary General
|
||||
Public License rather than by this special one.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which contains a
|
||||
notice placed by the copyright holder or other authorized party saying it
|
||||
may be distributed under the terms of this Library 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 compile 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) 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.
|
||||
|
||||
c) 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.
|
||||
|
||||
d) 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 source code 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 to 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 Library 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.
|
||||
|
||||
one line to give the library's name and an idea of what it does.
|
||||
|
||||
Copyright (C) year name of author
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Library General Public License as published by the Free
|
||||
Software Foundation; either version 2 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 Library General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, 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!
|
|
@ -1,446 +0,0 @@
|
|||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin St, 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 library GPL. It is numbered 2 because
|
||||
it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
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 Library General Public License, applies to some specially
|
||||
designated Free Software Foundation software, and to any other libraries whose
|
||||
authors decide to use it. You can use it for your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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 or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the 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
|
||||
a program 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.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright the library,
|
||||
and (2) offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain that everyone
|
||||
understands that there is no warranty for this free library. If the library
|
||||
is modified by someone else and passed on, we want its recipients to know
|
||||
that what they have is not the original version, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that companies distributing free software will individually
|
||||
obtain patent licenses, thus in effect transforming the program into proprietary
|
||||
software. To prevent this, we have made it clear that any patent must be licensed
|
||||
for everyone's free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License, which was designed for utility programs. This license,
|
||||
the GNU Library General Public License, applies to certain designated libraries.
|
||||
This license is quite different from the ordinary one; be sure to read it
|
||||
in full, and don't assume that anything in it is the same as in the ordinary
|
||||
license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that they
|
||||
blur the distinction we usually make between modifying or adding to a program
|
||||
and simply using it. Linking a program with a library, without changing the
|
||||
library, is in some sense simply using the library, and is analogous to running
|
||||
a utility program or application program. However, in a textual and legal
|
||||
sense, the linked executable is a combined work, a derivative of the original
|
||||
library, and the ordinary General Public License treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General Public License
|
||||
for libraries did not effectively promote software sharing, because most developers
|
||||
did not use the libraries. We concluded that weaker conditions might promote
|
||||
sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the users
|
||||
of those programs of all benefit from the free status of the libraries themselves.
|
||||
This Library General Public License is intended to permit developers of non-free
|
||||
programs to use free libraries, while preserving your freedom as a user of
|
||||
such programs to change the free libraries that are incorporated in them.
|
||||
(We have not seen how to achieve this as regards changes in header files,
|
||||
but we have achieved it as regards changes in the actual functions of the
|
||||
Library.) The hope is that this will lead to faster development of free libraries.
|
||||
|
||||
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, while the latter only works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary General
|
||||
Public License rather than by this special one.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which contains a
|
||||
notice placed by the copyright holder or other authorized party saying it
|
||||
may be distributed under the terms of this Library 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 compile 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) 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.
|
||||
|
||||
c) 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.
|
||||
|
||||
d) 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 source code 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 to 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 Library 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.
|
||||
|
||||
one line to give the library's name and an idea of what it does.
|
||||
|
||||
Copyright (C) year name of author
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Library General Public License as published by the Free
|
||||
Software Foundation; either version 2 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 Library General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, 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!
|
|
@ -1,467 +0,0 @@
|
|||
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.
|
||||
|
||||
< one line to give the library's name and an idea of what it does. >
|
||||
|
||||
Copyright (C) < year > < name of author >
|
||||
|
||||
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!
|
|
@ -1,163 +0,0 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates the terms
|
||||
and conditions of version 3 of the GNU General Public License, supplemented
|
||||
by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser General
|
||||
Public License, and the "GNU GPL" refers to version 3 of the GNU General Public
|
||||
License.
|
||||
|
||||
|
||||
|
||||
"The Library" refers to a covered work governed by this License, other than
|
||||
an Application or a Combined Work as defined below.
|
||||
|
||||
|
||||
|
||||
An "Application" is any work that makes use of an interface provided by the
|
||||
Library, but which is not otherwise based on the Library. Defining a subclass
|
||||
of a class defined by the Library is deemed a mode of using an interface provided
|
||||
by the Library.
|
||||
|
||||
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an Application
|
||||
with the Library. The particular version of the Library with which the Combined
|
||||
Work was made is also called the "Linked Version".
|
||||
|
||||
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the Corresponding
|
||||
Source for the Combined Work, excluding any source code for portions of the
|
||||
Combined Work that, considered in isolation, are based on the Application,
|
||||
and not on the Linked Version.
|
||||
|
||||
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the object
|
||||
code and/or source code for the Application, including any data and utility
|
||||
programs needed for reproducing the Combined Work from the Application, but
|
||||
excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License without
|
||||
being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a facility
|
||||
refers to a function or data to be supplied by an Application that uses the
|
||||
facility (other than as an argument passed when the facility is invoked),
|
||||
then you may convey a copy of the modified version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to ensure
|
||||
that, in the event an Application does not supply the function or data, the
|
||||
facility still operates, and performs whatever part of its purpose remains
|
||||
meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of this License
|
||||
applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from a header
|
||||
file that is part of the Library. You may convey such object code under terms
|
||||
of your choice, provided that, if the incorporated material is not limited
|
||||
to numerical parameters, data structure layouts and accessors, or small macros,
|
||||
inline functions and templates (ten or fewer lines in length), you do both
|
||||
of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that, taken together,
|
||||
effectively do not restrict modification of the portions of the Library contained
|
||||
in the Combined Work and reverse engineering for debugging such modifications,
|
||||
if you also do each of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during execution, include
|
||||
the copyright notice for the Library among these notices, as well as a reference
|
||||
directing the user to the copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this License,
|
||||
and the Corresponding Application Code in a form suitable for, and under terms
|
||||
that permit, the user to recombine or relink the Application with a modified
|
||||
version of the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (a) uses at run time a copy of the Library
|
||||
already present on the user's computer system, and (b) will operate properly
|
||||
with a modified version of the Library that is interface-compatible with the
|
||||
Linked Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise be required
|
||||
to provide such information under section 6 of the GNU GPL, and only to the
|
||||
extent that such information is necessary to install and execute a modified
|
||||
version of the Combined Work produced by recombining or relinking the Application
|
||||
with a modified version of the Linked Version. (If you use option 4d0, the
|
||||
Installation Information must accompany the Minimal Corresponding Source and
|
||||
Corresponding Application Code. If you use option 4d1, you must provide the
|
||||
Installation Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
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 that are
|
||||
not Applications and are not covered by this License, and convey such a combined
|
||||
library under terms of your choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities, conveyed under the
|
||||
terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it is a work
|
||||
based on the Library, and explaining where to find the accompanying uncombined
|
||||
form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the
|
||||
GNU 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 as you
|
||||
received it specifies that a certain numbered version of the GNU Lesser General
|
||||
Public License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that published version or of
|
||||
any later version published by the Free Software Foundation. If the Library
|
||||
as you received it does not specify a version number of the GNU Lesser General
|
||||
Public License, you may choose any version of the GNU Lesser General Public
|
||||
License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide whether
|
||||
future versions of the GNU Lesser General Public License shall apply, that
|
||||
proxy's public statement of acceptance of any version is permanent authorization
|
||||
for you to choose that version for the Library.
|
|
@ -1,12 +0,0 @@
|
|||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 3 of
|
||||
the license or (at your option) at any later version that is
|
||||
accepted by the membership of KDE e.V. (or its successor
|
||||
approved by the membership of KDE e.V.), which shall act as a
|
||||
proxy as defined in Section 14 of version 3 of the license.
|
||||
|
||||
This program 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 General Public License for more details.
|
|
@ -1,12 +0,0 @@
|
|||
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 3 of the license or (at your option) any later version
|
||||
that is accepted by the membership of KDE e.V. (or its successor
|
||||
approved by the membership of KDE e.V.), which shall act as a
|
||||
proxy as defined in Section 6 of version 3 of the license.
|
||||
|
||||
This program 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 General Public License for more details.
|
|
@ -1,19 +0,0 @@
|
|||
MIT License Copyright (c) <year> <copyright holders>
|
||||
|
||||
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.
|
|
@ -1,3 +1,3 @@
|
|||
#! /usr/bin/env bash
|
||||
$EXTRACTRC *.kcfg *.ui >> rc.cpp
|
||||
$XGETTEXT *.h *.cpp colorcorrection/*.cpp helpers/killer/*.cpp plugins/scenes/opengl/*.cpp tabbox/*.cpp scripting/*.cpp -o $podir/kwin.pot
|
||||
$XGETTEXT *.h *.cpp helpers/killer/*.cpp plugins/scenes/opengl/*.cpp tabbox/*.cpp scripting/*.cpp -o $podir/kwin.pot
|
||||
|
|
|
@ -0,0 +1,209 @@
|
|||
- A collection of various documents and links related to KWin is at http://techbase.kde.org/Projects/KWin .
|
||||
|
||||
|
||||
- The mailing list for KWin is kwin@kde.org (https://mail.kde.org/mailman/listinfo/kwin).
|
||||
|
||||
- If you want to develop KWin, see file HACKING.
|
||||
|
||||
- If you want to check KWin's compliance with specifications, see file COMPLIANCE.
|
||||
|
||||
- File CONFIGURATION includes some details on configuring KWin.
|
||||
|
||||
- Below is some info for application developers about application interaction
|
||||
with the window manager, but it'd need some cleanup.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
This README is meant as an explanation of various window manager related
|
||||
mechanisms that application developers need to be aware of. As some of these
|
||||
concepts may be difficult to understand for people not having the required
|
||||
background knowledge (since sometimes it's difficult even for people who
|
||||
do have the knowledge), the mechanisms are first briefly explained, and
|
||||
then an example of fixing the various problems is given.
|
||||
|
||||
For comments, questions, suggestions and whatever use the kwin@kde.org
|
||||
mailing list.
|
||||
|
||||
|
||||
Table of contents:
|
||||
==================
|
||||
|
||||
- Window relations
|
||||
- how to make the window manager know which windows belong together
|
||||
- Focus stealing prevention
|
||||
- how to solve cases where focus stealing prevention doesn't work
|
||||
properly automatically
|
||||
|
||||
|
||||
|
||||
Window relations:
|
||||
=================
|
||||
|
||||
(For now, this explanation of window relations is mainly meant for
|
||||
focus stealing prevention. To be extended later.)
|
||||
|
||||
All windows created by an application should be organized in a tree
|
||||
with the root being the application's main window. Note that this is about
|
||||
toplevel windows, not widgets inside the windows. For example, if you
|
||||
have KWrite running, with a torn-off toolbar (i.e. a standalone toolbar),
|
||||
a file save dialog open, and the file save dialog showing a dialog
|
||||
for creating a directory, the window hiearchy should look like this:
|
||||
|
||||
|
||||
KWrite mainwindow
|
||||
/ \
|
||||
/ \
|
||||
file save dialog torn-off toolbar
|
||||
\
|
||||
\
|
||||
create directory dialog
|
||||
|
||||
Each subwindow (i.e. all except for the KWrite mainwindow) points to its
|
||||
main window (which in turn may have another main window, as in the case
|
||||
of the file save dialog). When the window manager knows these relations,
|
||||
it can better arrange the windows (keeping subwindows above their
|
||||
main windows, preventing activation of a main window of a modal dialog,
|
||||
and similar). Failing to provide this information to the window manager
|
||||
may have various results, for example having dialogs positioned below
|
||||
the main window,
|
||||
|
||||
The window property used by subwindows to point to their mainwindows is
|
||||
called WM_TRANSIENT_FOR. It can be seen by running
|
||||
'xprop | grep WM_TRANSIENT_FOR' and clicking on a window. If the property
|
||||
is not present, the window does not (claim to) have any mainwindow.
|
||||
If the property is present, it's value is the window id of its main window;
|
||||
window id of any window can be found out by running 'xwininfo'. A window
|
||||
having WM_TRANSIENT_FOR poiting to another window is said to be transient
|
||||
for that window.
|
||||
|
||||
In some cases, the WM_TRANSIENT_FOR property may not point to any other
|
||||
existing window, having value of 0, or pointing to the screen number
|
||||
('xwininfo -root'). These special values mean that the window is transient
|
||||
for all other windows in its window group. This should be used only
|
||||
in rare cases, everytime a specific main window is known, WM_TRANSIENT_FOR
|
||||
should be pointing to it instead of using one of these special values.
|
||||
(The explanation why is beyond the scope of this document - just accept it
|
||||
as a fact.)
|
||||
|
||||
With Qt, the WM_TRANSIENT_FOR property is set by Qt automatically, based
|
||||
on the toplevel widget's parent. If the toplevel widget is of a normal
|
||||
type (i.e. not a dialog, toolbar, etc.), Qt doesn't set WM_TRANSIENT_FOR
|
||||
on it. For special widgets, such as dialogs, WM_TRANSIENT_FOR is set
|
||||
to point to the widget's parent, if it has a specific parent, otherwise
|
||||
WM_TRANSIENT_FOR points to the root window.
|
||||
|
||||
As already said above, WM_TRANSIENT_FOR poiting to the root window should
|
||||
be usually avoided, so everytime the widget's main widget is known, the widget
|
||||
should get it passed as a parent in its constructor.
|
||||
(TODO KDialog etc. classes should not have a default argument for the parent
|
||||
argument, and comments like 'just pass 0 as the parent' should go.)
|
||||
|
||||
|
||||
|
||||
Focus stealing prevention:
|
||||
==========================
|
||||
|
||||
Since KDE3.2 KWin has a feature called focus stealing prevention. As the name
|
||||
suggests, it prevents unexpected changes of focus. With older versions of KWin,
|
||||
if any application opened a new dialog, it became active, and
|
||||
if the application's main window was on another virtual desktop, also
|
||||
the virtual desktop was changed. This was annoying, and also sometimes led
|
||||
to dialogs mistakenly being closed because they received keyboard input that
|
||||
was meant for the previously active window.
|
||||
|
||||
The basic principle of focus stealing prevention is that the window with most
|
||||
recent user activity wins. Any window of an application will become active
|
||||
when being shown only if this application was the most recently used one.
|
||||
KWin itself, and some of the related kdecore classes should take care
|
||||
of the common cases, so usually there's no need for any special handling
|
||||
in applications. Qt/KDE applications, that is. Applications using other
|
||||
toolkits should in most cases work fine too. If they don't support
|
||||
the window property _NET_WM_USER_TIME, the window manager may fail to detect
|
||||
the user timestamp properly, resulting either in other windows becoming active
|
||||
while the user works with this application, or this application may sometimes
|
||||
steal focus (this second case should be very rare though).
|
||||
|
||||
There are also cases where KDE applications needs special handling. The two
|
||||
most common cases are when windows relations are not setup properly to make
|
||||
KWin realize that they belong to the same application, and when the user
|
||||
activity is not represented by manipulating with the application windows
|
||||
themselves.
|
||||
|
||||
Also note that focus stealing prevention implemented in the window manager
|
||||
can only help with focus stealing between different applications.
|
||||
If an application itself suddenly pops up a dialog, KWin cannot do anything about
|
||||
it, and its the application's job to handle this case.
|
||||
|
||||
|
||||
Window relations:
|
||||
-----------------
|
||||
|
||||
The common case here is when a dialog is shown for an application, but this
|
||||
dialog is not provided by the application itself, but by some other process.
|
||||
For example, dialogs with warnings about accepted cookies are provided
|
||||
by KCookieJar, instead of being shown by Konqueror. In the normal case,
|
||||
from KWin's point of view the cookie dialog would be an attempt of another
|
||||
application to show a dialog, and KWin wouldn't allow activation of this
|
||||
window.
|
||||
|
||||
The solution is to tell the window manager about the relation between
|
||||
the Konqueror main window and the cookie dialog, by making the dialog
|
||||
point to the mainwindow. Note that this is not special to focus stealing
|
||||
prevention, subwindows such as dialogs, toolbars and similar should always
|
||||
point to their mainwindow. See the section on window relations for full
|
||||
description.
|
||||
|
||||
The WM_TRANSIENT_FOR property that's set on dialogs to point to their
|
||||
mainwindow should in the cookie dialog case point to the Konqueror window
|
||||
for which it has been shown. This is solved in kcookiejar by including
|
||||
the window id in the DCOP call. When the cookie dialog is shown, its
|
||||
WM_TRANSIENT_FOR property is manually set using the XSetTransientForHint()
|
||||
call (see kdelibs/kioslave/http/kcookiejar/kcookiewin.cpp). The arguments
|
||||
to XSetTransientForHint() call are the X display (i.e. QX11Info::display()),
|
||||
the window id on which the WM_TRANSIENT_FOR property is to be set
|
||||
(i.e. use QWidget::winId()), and the window id of the mainwindow.
|
||||
|
||||
|
||||
Simple short HOWTO:
|
||||
|
||||
To put it simply: Let's say you have a daemon application that has
|
||||
DCOP call "showDialog( QString text )", and when this is called, it shows
|
||||
a dialog with the given text. This won't work properly with focus stealing
|
||||
prevention. The DCOP call should be changed to
|
||||
"showDialog( QString text, long id )". The caller should pass something like
|
||||
myMainWindow->winId() as the second argument. In the daemon, before
|
||||
the dialog is shown, a call to XSetTransientHint() should be added:
|
||||
|
||||
XSetTransientForHint( QX11Info::display(), dialog->winId(), id_of_mainwindow );
|
||||
|
||||
That's it.
|
||||
|
||||
Non-standard user activity:
|
||||
---------------------------
|
||||
|
||||
The most common case in KDE will be DCOP calls. For example, KDesktop's DCOP
|
||||
call "KDesktopIface popupExecuteCommand". Executing this DCOP call e.g.
|
||||
from Konsole as 'dcop kdesktop KDesktopIface popupExecuteCommand" will lead
|
||||
to showing the minicli, but the last user activity timestamp gained from events
|
||||
sent by X server will be older than user activity timestamp of Konsole, and
|
||||
would normally result in minicli not being active. Therefore, before showing
|
||||
the minicli, kdesktop needs to call KApplication::updateUserTimestamp().
|
||||
|
||||
However, this shouldn't be done with all DCOP calls. If a DCOP call is not
|
||||
a result of direct user action, calling KApplication::updateUserTimestamp()
|
||||
would lead to focus stealing. For example, let's assume for a moment
|
||||
that KMail would use this DCOP call in case it detects the modem is not
|
||||
connected, allowing to you to start KPPP or whatever tool you use. If KMail
|
||||
would be configured to check mail every 10 minutes, this would lead to minicli
|
||||
possibly suddenly showing up at every check. Basically, doing the above change
|
||||
to kdesktop's minicli means that the popupExecuteCommand() DCOP call is only
|
||||
for user scripting. (TODO write about focus transferring?)
|
||||
|
||||
Simply said, KApplication::updateUserTimestamp() should be called only
|
||||
as a result of user action. Unfortunately, I'm not aware of any universal
|
||||
way how to handle this, so every case will have to be considered separately.
|
48
README.md
48
README.md
|
@ -1,48 +0,0 @@
|
|||
# KWin
|
||||
|
||||
KWin is an easy to use, but flexible, composited Window Manager for Xorg windowing systems (Wayland, X11) on Linux. Its primary usage is in conjunction with a Desktop Shell (e.g. KDE Plasma Desktop). KWin is designed to go out of the way; users should not notice that they use a window manager at all. Nevertheless KWin provides a steep learning curve for advanced features, which are available, if they do not conflict with the primary mission. KWin does not have a dedicated targeted user group, but follows the targeted user group of the Desktop Shell using KWin as it's window manager.
|
||||
|
||||
## KWin is not...
|
||||
|
||||
* a standalone window manager (c.f. openbox, i3) and does not provide any functionality belonging to a Desktop Shell.
|
||||
* a replacement for window managers designed for use with a specific Desktop Shell (e.g. GNOME Shell)
|
||||
* a minimalistic window manager
|
||||
* designed for use without compositing or for X11 network transparency, though both are possible.
|
||||
|
||||
# Contacting KWin development team
|
||||
|
||||
* mailing list: [kwin@kde.org](https://mail.kde.org/mailman/listinfo/kwin)
|
||||
* IRC: #kwin on freenode
|
||||
|
||||
# Support
|
||||
## Application Developer
|
||||
If you are an application developer having questions regarding windowing systems (either X11 or Wayland) please do not hesitate to contact us. Preferable through our mailing list. Ideally subscribe to the mailing list, so that your mail doesn't get stuck in the moderation queue.
|
||||
|
||||
## End user
|
||||
Please contact the support channels of your Linux distribution for user support. The KWin development team does not provide end user support.
|
||||
|
||||
# Reporting bugs
|
||||
|
||||
Please use [KDE's bugtracker](https://bugs.kde.org) and report for [product KWin](https://bugs.kde.org/enter_bug.cgi?product=kwin).
|
||||
|
||||
# Developing on KWin
|
||||
Please refer to [hacking documentation](HACKING.md) for how to build and start KWin. Further information about KWin's test suite can be found in [TESTING.md](TESTING.md).
|
||||
|
||||
## Guidelines for new features
|
||||
|
||||
A new Feature can only be added to KWin if:
|
||||
|
||||
* it does not violate the primary missions as stated at the start of this document
|
||||
* it does not introduce instabilities
|
||||
* it is maintained, that is bugs are fixed in a timely manner (second next minor release) if it is not a corner case.
|
||||
* it works together with all existing features
|
||||
* it supports both single and multi screen (xrandr)
|
||||
* it adds a significant advantage
|
||||
* it is feature complete, that is supports at least all useful features from competitive implementations
|
||||
* it is not a special case for a small user group
|
||||
* it does not increase code complexity significantly
|
||||
* it does not affect KWin's license (GPLv2+)
|
||||
|
||||
All new added features are under probation, that is if any of the non-functional requirements as listed above do not hold true in the next two feature releases, the added feature will be removed again.
|
||||
|
||||
The same non functional requirements hold true for any kind of plugins (effects, scripts, etc.). It is suggested to use scripted plugins and distribute them separately.
|
33
TESTING.md
33
TESTING.md
|
@ -1,33 +0,0 @@
|
|||
# Testing in KWin
|
||||
KWin provides a unit and integration test suit for X11 and Wayland. The source code for the tests can be found in the subdirectory autotests. The test suite should be run prior to any merge to KWin.
|
||||
|
||||
# Dependencies
|
||||
The following additional software needs to be installed for running the test suite:
|
||||
|
||||
* Xvfb
|
||||
* Xephyr
|
||||
* glxgears
|
||||
* DMZ-white cursor theme
|
||||
* breeze window decoration
|
||||
|
||||
# Preparing OpenGL
|
||||
Some of the tests require OpenGL. The test suite is implemented against Mesa and uses the Mesa specific EGL extension
|
||||
EGL_MESA_platform_surfaceless. This extension supports rendering without any real GPU using llvmpipe as software
|
||||
emulation. This gives the tests a stable base removing variance introduced by different hardware and drivers.
|
||||
|
||||
Users of non-Mesa drivers (e.g. proprietary NVIDIA driver) need to ensure that Mesa is also installed. If your system
|
||||
uses libglvnd this should work out of the box, if not you might need to tune LD_LIBRARY_PATH.
|
||||
|
||||
# Running the test suite
|
||||
The test suite can be run from the build directory. Best is to do:
|
||||
|
||||
cd path/to/build/directory
|
||||
xvfb-run ctest
|
||||
|
||||
# Running individual tests
|
||||
All tests executables are created in the directory "bin" in the build directory. Each test can be executed by just starting it from within the test directory. To prevent side effects with the running session it is recommended to start a dedicated dbus session:
|
||||
|
||||
cd path/to/build/directory/bin
|
||||
dbus-run-session ./testFoo
|
||||
|
||||
For tests relying on X11 one should also either start a dedicated Xvfb and export DISPLAY or use xvfb-run as described above.
|
2082
abstract_client.cpp
2082
abstract_client.cpp
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,22 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "abstract_opengl_context_attribute_builder.h"
|
||||
|
||||
namespace KWin
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#pragma once
|
||||
#include <QDebug>
|
||||
#include <kwin_export.h>
|
||||
|
|
|
@ -1,58 +1,38 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com>
|
||||
Copyright 2018 Roman Gilg <subdiff@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "abstract_output.h"
|
||||
#include "wayland_server.h"
|
||||
|
||||
// KWayland
|
||||
#include <KWayland/Server/output_interface.h>
|
||||
#include <KWayland/Server/outputchangeset.h>
|
||||
#include <KWayland/Server/outputdevice_interface.h>
|
||||
#include <KWayland/Server/xdgoutput_interface.h>
|
||||
// KF5
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
GammaRamp::GammaRamp(uint32_t size)
|
||||
: m_table(3 * size)
|
||||
, m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t GammaRamp::size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
uint16_t *GammaRamp::red()
|
||||
{
|
||||
return m_table.data();
|
||||
}
|
||||
|
||||
const uint16_t *GammaRamp::red() const
|
||||
{
|
||||
return m_table.data();
|
||||
}
|
||||
|
||||
uint16_t *GammaRamp::green()
|
||||
{
|
||||
return m_table.data() + m_size;
|
||||
}
|
||||
|
||||
const uint16_t *GammaRamp::green() const
|
||||
{
|
||||
return m_table.data() + m_size;
|
||||
}
|
||||
|
||||
uint16_t *GammaRamp::blue()
|
||||
{
|
||||
return m_table.data() + 2 * m_size;
|
||||
}
|
||||
|
||||
const uint16_t *GammaRamp::blue() const
|
||||
{
|
||||
return m_table.data() + 2 * m_size;
|
||||
}
|
||||
|
||||
AbstractOutput::AbstractOutput(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
@ -60,47 +40,91 @@ AbstractOutput::AbstractOutput(QObject *parent)
|
|||
|
||||
AbstractOutput::~AbstractOutput()
|
||||
{
|
||||
delete m_waylandOutputDevice.data();
|
||||
delete m_xdgOutput.data();
|
||||
delete m_waylandOutput.data();
|
||||
}
|
||||
|
||||
QByteArray AbstractOutput::uuid() const
|
||||
QString AbstractOutput::name() const
|
||||
{
|
||||
return QByteArray();
|
||||
if (!m_waylandOutput) {
|
||||
return i18n("unknown");
|
||||
}
|
||||
return QStringLiteral("%1 %2").arg(m_waylandOutput->manufacturer()).arg(m_waylandOutput->model());
|
||||
}
|
||||
|
||||
void AbstractOutput::setEnabled(bool enable)
|
||||
QRect AbstractOutput::geometry() const
|
||||
{
|
||||
Q_UNUSED(enable)
|
||||
}
|
||||
|
||||
void AbstractOutput::applyChanges(const KWaylandServer::OutputChangeSet *changeSet)
|
||||
{
|
||||
Q_UNUSED(changeSet)
|
||||
}
|
||||
|
||||
bool AbstractOutput::isInternal() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
qreal AbstractOutput::scale() const
|
||||
{
|
||||
return 1;
|
||||
return QRect(m_globalPos, pixelSize() / scale());
|
||||
}
|
||||
|
||||
QSize AbstractOutput::physicalSize() const
|
||||
{
|
||||
return QSize();
|
||||
if (m_orientation == Qt::PortraitOrientation || m_orientation == Qt::InvertedPortraitOrientation) {
|
||||
return m_physicalSize.transposed();
|
||||
}
|
||||
return m_physicalSize;
|
||||
}
|
||||
|
||||
int AbstractOutput::gammaRampSize() const
|
||||
void AbstractOutput::setGlobalPos(const QPoint &pos)
|
||||
{
|
||||
return 0;
|
||||
m_globalPos = pos;
|
||||
if (m_waylandOutput) {
|
||||
m_waylandOutput->setGlobalPosition(pos);
|
||||
}
|
||||
if (m_waylandOutputDevice) {
|
||||
m_waylandOutputDevice->setGlobalPosition(pos);
|
||||
}
|
||||
if (m_xdgOutput) {
|
||||
m_xdgOutput->setLogicalPosition(pos);
|
||||
m_xdgOutput->done();
|
||||
}
|
||||
}
|
||||
|
||||
bool AbstractOutput::setGammaRamp(const GammaRamp &gamma)
|
||||
void AbstractOutput::setScale(qreal scale)
|
||||
{
|
||||
Q_UNUSED(gamma);
|
||||
return false;
|
||||
m_scale = scale;
|
||||
if (m_waylandOutput) {
|
||||
// this is the scale that clients will ideally use for their buffers
|
||||
// this has to be an int which is fine
|
||||
|
||||
// I don't know whether we want to round or ceil
|
||||
// or maybe even set this to 3 when we're scaling to 1.5
|
||||
// don't treat this like it's chosen deliberately
|
||||
m_waylandOutput->setScale(std::ceil(scale));
|
||||
}
|
||||
if (m_waylandOutputDevice) {
|
||||
m_waylandOutputDevice->setScaleF(scale);
|
||||
}
|
||||
if (m_xdgOutput) {
|
||||
m_xdgOutput->setLogicalSize(pixelSize() / m_scale);
|
||||
m_xdgOutput->done();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
void AbstractOutput::setChanges(KWayland::Server::OutputChangeSet *changes)
|
||||
{
|
||||
m_changeset = changes;
|
||||
qCDebug(KWIN_CORE) << "set changes in AbstractOutput";
|
||||
commitChanges();
|
||||
}
|
||||
|
||||
void AbstractOutput::setWaylandOutput(KWayland::Server::OutputInterface *set)
|
||||
{
|
||||
m_waylandOutput = set;
|
||||
}
|
||||
|
||||
void AbstractOutput::createXdgOutput()
|
||||
{
|
||||
if (!m_waylandOutput || m_xdgOutput) {
|
||||
return;
|
||||
}
|
||||
m_xdgOutput = waylandServer()->xdgOutputManager()->createXdgOutput(m_waylandOutput, m_waylandOutput);
|
||||
}
|
||||
|
||||
void AbstractOutput::setWaylandOutputDevice(KWayland::Server::OutputDeviceInterface *set)
|
||||
{
|
||||
m_waylandOutputDevice = set;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,179 +1,158 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
|
||||
Copyright 2018 Roman Gilg <subdiff@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#ifndef KWIN_ABSTRACT_OUTPUT_H
|
||||
#define KWIN_ABSTRACT_OUTPUT_H
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#ifndef KWIN_OUTPUT_H
|
||||
#define KWIN_OUTPUT_H
|
||||
|
||||
#include <utils.h>
|
||||
#include <kwin_export.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
#include <QPointer>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QVector>
|
||||
|
||||
namespace KWaylandServer
|
||||
namespace KWayland
|
||||
{
|
||||
namespace Server
|
||||
{
|
||||
class OutputInterface;
|
||||
class OutputDeviceInterface;
|
||||
class OutputChangeSet;
|
||||
class OutputManagementInterface;
|
||||
class XdgOutputInterface;
|
||||
}
|
||||
}
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class KWIN_EXPORT GammaRamp
|
||||
{
|
||||
public:
|
||||
GammaRamp(uint32_t size);
|
||||
|
||||
/**
|
||||
* Returns the size of the gamma ramp.
|
||||
*/
|
||||
uint32_t size() const;
|
||||
|
||||
/**
|
||||
* Returns pointer to the first red component in the gamma ramp.
|
||||
*
|
||||
* The returned pointer can be used for altering the red component
|
||||
* in the gamma ramp.
|
||||
*/
|
||||
uint16_t *red();
|
||||
|
||||
/**
|
||||
* Returns pointer to the first red component in the gamma ramp.
|
||||
*/
|
||||
const uint16_t *red() const;
|
||||
|
||||
/**
|
||||
* Returns pointer to the first green component in the gamma ramp.
|
||||
*
|
||||
* The returned pointer can be used for altering the green component
|
||||
* in the gamma ramp.
|
||||
*/
|
||||
uint16_t *green();
|
||||
|
||||
/**
|
||||
* Returns pointer to the first green component in the gamma ramp.
|
||||
*/
|
||||
const uint16_t *green() const;
|
||||
|
||||
/**
|
||||
* Returns pointer to the first blue component in the gamma ramp.
|
||||
*
|
||||
* The returned pointer can be used for altering the blue component
|
||||
* in the gamma ramp.
|
||||
*/
|
||||
uint16_t *blue();
|
||||
|
||||
/**
|
||||
* Returns pointer to the first blue component in the gamma ramp.
|
||||
*/
|
||||
const uint16_t *blue() const;
|
||||
|
||||
private:
|
||||
QVector<uint16_t> m_table;
|
||||
uint32_t m_size;
|
||||
};
|
||||
namespace ColorCorrect {
|
||||
struct GammaRamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic output representation.
|
||||
*/
|
||||
* Generic output representation in a Wayland session
|
||||
**/
|
||||
class KWIN_EXPORT AbstractOutput : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AbstractOutput(QObject *parent = nullptr);
|
||||
~AbstractOutput() override;
|
||||
virtual ~AbstractOutput();
|
||||
|
||||
/**
|
||||
* Returns a short identifiable name of this output.
|
||||
*/
|
||||
virtual QString name() const = 0;
|
||||
QString name() const;
|
||||
bool isEnabled() const {
|
||||
return !m_waylandOutput.isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identifying uuid of this output.
|
||||
*
|
||||
* Default implementation returns an empty byte array.
|
||||
*/
|
||||
virtual QByteArray uuid() const;
|
||||
|
||||
/**
|
||||
* Enable or disable the output.
|
||||
*
|
||||
* Default implementation does nothing
|
||||
*/
|
||||
virtual void setEnabled(bool enable);
|
||||
|
||||
/**
|
||||
* This sets the changes and tests them against the specific output.
|
||||
*
|
||||
* Default implementation does nothing
|
||||
*/
|
||||
virtual void applyChanges(const KWaylandServer::OutputChangeSet *changeSet);
|
||||
|
||||
/**
|
||||
* Returns geometry of this output in device independent pixels.
|
||||
*/
|
||||
virtual QRect geometry() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the approximate vertical refresh rate of this output, in mHz.
|
||||
*/
|
||||
virtual int refreshRate() const = 0;
|
||||
|
||||
/**
|
||||
* Returns whether this output is connected through an internal connector,
|
||||
* e.g. LVDS, or eDP.
|
||||
*
|
||||
* Default implementation returns @c false.
|
||||
*/
|
||||
virtual bool isInternal() const;
|
||||
|
||||
/**
|
||||
* Returns the ratio between physical pixels and logical pixels.
|
||||
*
|
||||
* Default implementation returns 1.
|
||||
*/
|
||||
virtual qreal scale() const;
|
||||
|
||||
/**
|
||||
* Returns the physical size of this output, in millimeters.
|
||||
*
|
||||
* Default implementation returns an invalid QSize.
|
||||
*/
|
||||
virtual QSize physicalSize() const;
|
||||
|
||||
/**
|
||||
* Returns the size of the gamma lookup table.
|
||||
*
|
||||
* Default implementation returns 0.
|
||||
*/
|
||||
virtual int gammaRampSize() const;
|
||||
|
||||
/**
|
||||
* Sets the gamma ramp of this output.
|
||||
*
|
||||
* Returns @c true if the gamma ramp was successfully set.
|
||||
*/
|
||||
virtual bool setGammaRamp(const GammaRamp &gamma);
|
||||
|
||||
/** Returns the resolution of the output. */
|
||||
virtual QSize pixelSize() const = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted when the geometry of this output has changed.
|
||||
qreal scale() const {
|
||||
return m_scale;
|
||||
}
|
||||
/*
|
||||
* The geometry of this output in global compositor co-ordinates (i.e scaled)
|
||||
*/
|
||||
void geometryChanged();
|
||||
QRect geometry() const;
|
||||
QSize physicalSize() const;
|
||||
Qt::ScreenOrientation orientation() const {
|
||||
return m_orientation;
|
||||
}
|
||||
|
||||
bool isInternal() const {
|
||||
return m_internal;
|
||||
}
|
||||
|
||||
void setGlobalPos(const QPoint &pos);
|
||||
void setScale(qreal scale);
|
||||
|
||||
/**
|
||||
* This sets the changes and tests them against the specific output
|
||||
*/
|
||||
void setChanges(KWayland::Server::OutputChangeSet *changeset);
|
||||
virtual bool commitChanges() { return false; }
|
||||
|
||||
QPointer<KWayland::Server::OutputInterface> waylandOutput() const {
|
||||
return m_waylandOutput;
|
||||
}
|
||||
|
||||
virtual int getGammaRampSize() const {
|
||||
return 0;
|
||||
}
|
||||
virtual bool setGammaRamp(const ColorCorrect::GammaRamp &gamma) {
|
||||
Q_UNUSED(gamma);
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
QPointer<KWayland::Server::OutputChangeSet> changes() const {
|
||||
return m_changeset;
|
||||
}
|
||||
|
||||
void setWaylandOutput(KWayland::Server::OutputInterface *set);
|
||||
|
||||
QPointer<KWayland::Server::XdgOutputInterface> xdgOutput() const {
|
||||
return m_xdgOutput;
|
||||
}
|
||||
void createXdgOutput();
|
||||
|
||||
QPointer<KWayland::Server::OutputDeviceInterface> waylandOutputDevice() const {
|
||||
return m_waylandOutputDevice;
|
||||
}
|
||||
void setWaylandOutputDevice(KWayland::Server::OutputDeviceInterface *set);
|
||||
|
||||
QPoint globalPos() const {
|
||||
return m_globalPos;
|
||||
}
|
||||
|
||||
QSize rawPhysicalSize() const {
|
||||
return m_physicalSize;
|
||||
}
|
||||
void setRawPhysicalSize(const QSize &set) {
|
||||
m_physicalSize = set;
|
||||
}
|
||||
|
||||
void setOrientation(Qt::ScreenOrientation set) {
|
||||
m_orientation = set;
|
||||
}
|
||||
bool internal() const {
|
||||
return m_internal;
|
||||
}
|
||||
void setInternal(bool set) {
|
||||
m_internal = set;
|
||||
}
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(AbstractOutput)
|
||||
QPointer<KWayland::Server::OutputChangeSet> m_changeset;
|
||||
QPointer<KWayland::Server::OutputInterface> m_waylandOutput;
|
||||
QPointer<KWayland::Server::XdgOutputInterface> m_xdgOutput;
|
||||
QPointer<KWayland::Server::OutputDeviceInterface> m_waylandOutputDevice;
|
||||
|
||||
QPoint m_globalPos;
|
||||
qreal m_scale = 1;
|
||||
QSize m_physicalSize;
|
||||
Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation;
|
||||
bool m_internal = false;
|
||||
};
|
||||
|
||||
} // namespace KWin
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // KWIN_OUTPUT_H
|
||||
|
|
|
@ -1,356 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
|
||||
SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "abstract_wayland_output.h"
|
||||
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
|
||||
// KWayland
|
||||
#include <KWaylandServer/display.h>
|
||||
#include <KWaylandServer/outputchangeset.h>
|
||||
#include <KWaylandServer/xdgoutput_v1_interface.h>
|
||||
// KF5
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QMatrix4x4>
|
||||
#include <cmath>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
AbstractWaylandOutput::AbstractWaylandOutput(QObject *parent)
|
||||
: AbstractOutput(parent)
|
||||
{
|
||||
m_waylandOutput = waylandServer()->display()->createOutput(this);
|
||||
m_waylandOutputDevice = waylandServer()->display()->createOutputDevice(this);
|
||||
m_xdgOutputV1 = waylandServer()->xdgOutputManagerV1()->createXdgOutput(m_waylandOutput, this);
|
||||
|
||||
connect(m_waylandOutput, &KWaylandServer::OutputInterface::dpmsModeRequested, this,
|
||||
[this] (KWaylandServer::OutputInterface::DpmsMode mode) {
|
||||
updateDpms(mode);
|
||||
});
|
||||
|
||||
connect(m_waylandOutput, &KWaylandServer::OutputInterface::globalPositionChanged, this, &AbstractWaylandOutput::geometryChanged);
|
||||
connect(m_waylandOutput, &KWaylandServer::OutputInterface::pixelSizeChanged, this, &AbstractWaylandOutput::geometryChanged);
|
||||
connect(m_waylandOutput, &KWaylandServer::OutputInterface::scaleChanged, this, &AbstractWaylandOutput::geometryChanged);
|
||||
}
|
||||
|
||||
AbstractWaylandOutput::~AbstractWaylandOutput()
|
||||
{
|
||||
}
|
||||
|
||||
QString AbstractWaylandOutput::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QByteArray AbstractWaylandOutput::uuid() const
|
||||
{
|
||||
return m_waylandOutputDevice->uuid();
|
||||
}
|
||||
|
||||
QRect AbstractWaylandOutput::geometry() const
|
||||
{
|
||||
return QRect(globalPos(), pixelSize() / scale());
|
||||
}
|
||||
|
||||
QSize AbstractWaylandOutput::physicalSize() const
|
||||
{
|
||||
return orientateSize(m_waylandOutputDevice->physicalSize());
|
||||
}
|
||||
|
||||
int AbstractWaylandOutput::refreshRate() const
|
||||
{
|
||||
return m_waylandOutputDevice->refreshRate();
|
||||
}
|
||||
|
||||
QPoint AbstractWaylandOutput::globalPos() const
|
||||
{
|
||||
return m_waylandOutputDevice->globalPosition();
|
||||
}
|
||||
|
||||
void AbstractWaylandOutput::setGlobalPos(const QPoint &pos)
|
||||
{
|
||||
m_waylandOutputDevice->setGlobalPosition(pos);
|
||||
|
||||
m_waylandOutput->setGlobalPosition(pos);
|
||||
m_xdgOutputV1->setLogicalPosition(pos);
|
||||
m_xdgOutputV1->done();
|
||||
}
|
||||
|
||||
QSize AbstractWaylandOutput::modeSize() const
|
||||
{
|
||||
return m_waylandOutputDevice->pixelSize();
|
||||
}
|
||||
|
||||
QSize AbstractWaylandOutput::pixelSize() const
|
||||
{
|
||||
return orientateSize(m_waylandOutputDevice->pixelSize());
|
||||
}
|
||||
|
||||
qreal AbstractWaylandOutput::scale() const
|
||||
{
|
||||
return m_waylandOutputDevice->scaleF();
|
||||
}
|
||||
|
||||
void AbstractWaylandOutput::setScale(qreal scale)
|
||||
{
|
||||
m_waylandOutputDevice->setScaleF(scale);
|
||||
|
||||
// this is the scale that clients will ideally use for their buffers
|
||||
// this has to be an int which is fine
|
||||
|
||||
// I don't know whether we want to round or ceil
|
||||
// or maybe even set this to 3 when we're scaling to 1.5
|
||||
// don't treat this like it's chosen deliberately
|
||||
m_waylandOutput->setScale(std::ceil(scale));
|
||||
m_xdgOutputV1->setLogicalSize(pixelSize() / scale);
|
||||
m_xdgOutputV1->done();
|
||||
}
|
||||
|
||||
using DeviceInterface = KWaylandServer::OutputDeviceInterface;
|
||||
|
||||
KWaylandServer::OutputInterface::Transform toOutputTransform(DeviceInterface::Transform transform)
|
||||
{
|
||||
using Transform = DeviceInterface::Transform;
|
||||
using OutputTransform = KWaylandServer::OutputInterface::Transform;
|
||||
|
||||
switch (transform) {
|
||||
case Transform::Rotated90:
|
||||
return OutputTransform::Rotated90;
|
||||
case Transform::Rotated180:
|
||||
return OutputTransform::Rotated180;
|
||||
case Transform::Rotated270:
|
||||
return OutputTransform::Rotated270;
|
||||
case Transform::Flipped:
|
||||
return OutputTransform::Flipped;
|
||||
case Transform::Flipped90:
|
||||
return OutputTransform::Flipped90;
|
||||
case Transform::Flipped180:
|
||||
return OutputTransform::Flipped180;
|
||||
case Transform::Flipped270:
|
||||
return OutputTransform::Flipped270;
|
||||
default:
|
||||
return OutputTransform::Normal;
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractWaylandOutput::setTransform(DeviceInterface::Transform transform)
|
||||
{
|
||||
m_waylandOutputDevice->setTransform(transform);
|
||||
|
||||
m_waylandOutput->setTransform(toOutputTransform(transform));
|
||||
m_xdgOutputV1->setLogicalSize(pixelSize() / scale());
|
||||
m_xdgOutputV1->done();
|
||||
}
|
||||
|
||||
inline
|
||||
AbstractWaylandOutput::Transform toTransform(DeviceInterface::Transform deviceTransform)
|
||||
{
|
||||
return static_cast<AbstractWaylandOutput::Transform>(deviceTransform);
|
||||
}
|
||||
|
||||
inline
|
||||
DeviceInterface::Transform toDeviceTransform(AbstractWaylandOutput::Transform transform)
|
||||
{
|
||||
return static_cast<DeviceInterface::Transform>(transform);
|
||||
}
|
||||
|
||||
void AbstractWaylandOutput::applyChanges(const KWaylandServer::OutputChangeSet *changeSet)
|
||||
{
|
||||
qCDebug(KWIN_CORE) << "Apply changes to the Wayland output.";
|
||||
bool emitModeChanged = false;
|
||||
bool overallSizeCheckNeeded = false;
|
||||
|
||||
// Enablement changes are handled by platform.
|
||||
if (changeSet->modeChanged()) {
|
||||
qCDebug(KWIN_CORE) << "Setting new mode:" << changeSet->mode();
|
||||
m_waylandOutputDevice->setCurrentMode(changeSet->mode());
|
||||
updateMode(changeSet->mode());
|
||||
emitModeChanged = true;
|
||||
}
|
||||
if (changeSet->transformChanged()) {
|
||||
qCDebug(KWIN_CORE) << "Server setting transform: " << (int)(changeSet->transform());
|
||||
setTransform(changeSet->transform());
|
||||
updateTransform(toTransform(changeSet->transform()));
|
||||
emitModeChanged = true;
|
||||
}
|
||||
if (changeSet->positionChanged()) {
|
||||
qCDebug(KWIN_CORE) << "Server setting position: " << changeSet->position();
|
||||
setGlobalPos(changeSet->position());
|
||||
// may just work already!
|
||||
overallSizeCheckNeeded = true;
|
||||
}
|
||||
if (changeSet->scaleChanged()) {
|
||||
qCDebug(KWIN_CORE) << "Setting scale:" << changeSet->scaleF();
|
||||
setScale(changeSet->scaleF());
|
||||
emitModeChanged = true;
|
||||
}
|
||||
|
||||
overallSizeCheckNeeded |= emitModeChanged;
|
||||
if (overallSizeCheckNeeded) {
|
||||
emit screens()->changed();
|
||||
}
|
||||
|
||||
if (emitModeChanged) {
|
||||
emit modeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool AbstractWaylandOutput::isEnabled() const
|
||||
{
|
||||
return m_waylandOutputDevice->enabled() == DeviceInterface::Enablement::Enabled;
|
||||
}
|
||||
|
||||
void AbstractWaylandOutput::setEnabled(bool enable)
|
||||
{
|
||||
if (enable == isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (enable) {
|
||||
m_waylandOutputDevice->setEnabled(DeviceInterface::Enablement::Enabled);
|
||||
m_waylandOutput->create();
|
||||
updateEnablement(true);
|
||||
} else {
|
||||
m_waylandOutputDevice->setEnabled(DeviceInterface::Enablement::Disabled);
|
||||
m_waylandOutput->destroy();
|
||||
// xdg-output is destroyed in KWayland on wl_output going away.
|
||||
updateEnablement(false);
|
||||
}
|
||||
}
|
||||
|
||||
QString AbstractWaylandOutput::description() const
|
||||
{
|
||||
return QStringLiteral("%1 %2").arg(m_waylandOutputDevice->manufacturer()).arg(
|
||||
m_waylandOutputDevice->model());
|
||||
}
|
||||
|
||||
void AbstractWaylandOutput::setWaylandMode(const QSize &size, int refreshRate)
|
||||
{
|
||||
m_waylandOutput->setCurrentMode(size, refreshRate);
|
||||
m_xdgOutputV1->setLogicalSize(pixelSize() / scale());
|
||||
m_xdgOutputV1->done();
|
||||
}
|
||||
|
||||
void AbstractWaylandOutput::initInterfaces(const QString &model, const QString &manufacturer,
|
||||
const QByteArray &uuid, const QSize &physicalSize,
|
||||
const QVector<DeviceInterface::Mode> &modes)
|
||||
{
|
||||
m_waylandOutputDevice->setUuid(uuid);
|
||||
|
||||
if (!manufacturer.isEmpty()) {
|
||||
m_waylandOutputDevice->setManufacturer(manufacturer);
|
||||
} else {
|
||||
m_waylandOutputDevice->setManufacturer(i18n("unknown"));
|
||||
}
|
||||
|
||||
m_waylandOutputDevice->setModel(model);
|
||||
m_waylandOutputDevice->setPhysicalSize(physicalSize);
|
||||
|
||||
m_waylandOutput->setManufacturer(m_waylandOutputDevice->manufacturer());
|
||||
m_waylandOutput->setModel(m_waylandOutputDevice->model());
|
||||
m_waylandOutput->setPhysicalSize(m_waylandOutputDevice->physicalSize());
|
||||
|
||||
int i = 0;
|
||||
for (auto mode : modes) {
|
||||
qCDebug(KWIN_CORE).nospace() << "Adding mode " << ++i << ": " << mode.size << " [" << mode.refreshRate << "]";
|
||||
m_waylandOutputDevice->addMode(mode);
|
||||
|
||||
KWaylandServer::OutputInterface::ModeFlags flags;
|
||||
if (mode.flags & DeviceInterface::ModeFlag::Current) {
|
||||
flags |= KWaylandServer::OutputInterface::ModeFlag::Current;
|
||||
}
|
||||
if (mode.flags & DeviceInterface::ModeFlag::Preferred) {
|
||||
flags |= KWaylandServer::OutputInterface::ModeFlag::Preferred;
|
||||
}
|
||||
m_waylandOutput->addMode(mode.size, flags, mode.refreshRate);
|
||||
}
|
||||
|
||||
m_waylandOutputDevice->create();
|
||||
|
||||
// start off enabled
|
||||
|
||||
m_waylandOutput->create();
|
||||
m_xdgOutputV1->setName(name());
|
||||
m_xdgOutputV1->setDescription(description());
|
||||
m_xdgOutputV1->setLogicalSize(pixelSize() / scale());
|
||||
m_xdgOutputV1->done();
|
||||
}
|
||||
|
||||
QSize AbstractWaylandOutput::orientateSize(const QSize &size) const
|
||||
{
|
||||
using Transform = DeviceInterface::Transform;
|
||||
const Transform transform = m_waylandOutputDevice->transform();
|
||||
if (transform == Transform::Rotated90 || transform == Transform::Rotated270 ||
|
||||
transform == Transform::Flipped90 || transform == Transform::Flipped270) {
|
||||
return size.transposed();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
void AbstractWaylandOutput::setTransform(Transform transform)
|
||||
{
|
||||
const auto deviceTransform = toDeviceTransform(transform);
|
||||
if (deviceTransform == m_waylandOutputDevice->transform()) {
|
||||
return;
|
||||
}
|
||||
setTransform(deviceTransform);
|
||||
emit modeChanged();
|
||||
}
|
||||
|
||||
AbstractWaylandOutput::Transform AbstractWaylandOutput::transform() const
|
||||
{
|
||||
return static_cast<Transform>(m_waylandOutputDevice->transform());
|
||||
}
|
||||
|
||||
// TODO: Do we need to handle the flipped cases differently?
|
||||
int transformToRotation(AbstractWaylandOutput::Transform transform)
|
||||
{
|
||||
switch (transform) {
|
||||
case AbstractWaylandOutput::Transform::Normal:
|
||||
case AbstractWaylandOutput::Transform::Flipped:
|
||||
return 0;
|
||||
case AbstractWaylandOutput::Transform::Rotated90:
|
||||
case AbstractWaylandOutput::Transform::Flipped90:
|
||||
return 90;
|
||||
case AbstractWaylandOutput::Transform::Rotated180:
|
||||
case AbstractWaylandOutput::Transform::Flipped180:
|
||||
return 180;
|
||||
case AbstractWaylandOutput::Transform::Rotated270:
|
||||
case AbstractWaylandOutput::Transform::Flipped270:
|
||||
return 270;
|
||||
}
|
||||
Q_UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AbstractWaylandOutput::rotation() const
|
||||
{
|
||||
return transformToRotation(transform());
|
||||
}
|
||||
|
||||
QMatrix4x4 AbstractWaylandOutput::transformation() const
|
||||
{
|
||||
const QSize outputSize = modeSize();
|
||||
const QSize logicalSize = pixelSize();
|
||||
|
||||
QMatrix4x4 matrix;
|
||||
matrix.translate(outputSize.width()/2, outputSize.height()/2);
|
||||
matrix.rotate(rotation(), 0, 0, 1);
|
||||
matrix.translate(-logicalSize.width()/2, -logicalSize.height()/2);
|
||||
matrix.scale(scale());
|
||||
|
||||
const QPoint topLeft = -globalPos();
|
||||
matrix.translate(-topLeft.x(), -topLeft.y());
|
||||
return matrix;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,183 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#ifndef KWIN_ABSTRACT_WAYLAND_OUTPUT_H
|
||||
#define KWIN_ABSTRACT_WAYLAND_OUTPUT_H
|
||||
|
||||
#include "abstract_output.h"
|
||||
#include "utils.h"
|
||||
#include <kwin_export.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
#include <QPointer>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QVector>
|
||||
|
||||
#include <KWaylandServer/output_interface.h>
|
||||
#include <KWaylandServer/outputdevice_interface.h>
|
||||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
class OutputInterface;
|
||||
class OutputDeviceInterface;
|
||||
class OutputChangeSet;
|
||||
class OutputManagementInterface;
|
||||
class XdgOutputV1Interface;
|
||||
}
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
/**
|
||||
* Generic output representation in a Wayland session
|
||||
*/
|
||||
class KWIN_EXPORT AbstractWaylandOutput : public AbstractOutput
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum class Transform {
|
||||
Normal,
|
||||
Rotated90,
|
||||
Rotated180,
|
||||
Rotated270,
|
||||
Flipped,
|
||||
Flipped90,
|
||||
Flipped180,
|
||||
Flipped270
|
||||
};
|
||||
|
||||
explicit AbstractWaylandOutput(QObject *parent = nullptr);
|
||||
~AbstractWaylandOutput() override;
|
||||
|
||||
QString name() const override;
|
||||
QByteArray uuid() const override;
|
||||
|
||||
QSize modeSize() const;
|
||||
|
||||
// TODO: The name is ambiguous. Rename this function.
|
||||
QSize pixelSize() const override;
|
||||
|
||||
qreal scale() const override;
|
||||
|
||||
/**
|
||||
* The geometry of this output in global compositor co-ordinates (i.e scaled)
|
||||
*/
|
||||
QRect geometry() const override;
|
||||
QSize physicalSize() const override;
|
||||
|
||||
/**
|
||||
* Returns the orientation of this output.
|
||||
*
|
||||
* - Flipped along the vertical axis is landscape + inv. portrait.
|
||||
* - Rotated 90° and flipped along the horizontal axis is portrait + inv. landscape
|
||||
* - Rotated 180° and flipped along the vertical axis is inv. landscape + inv. portrait
|
||||
* - Rotated 270° and flipped along the horizontal axis is inv. portrait + inv. landscape +
|
||||
* portrait
|
||||
*/
|
||||
Transform transform() const;
|
||||
|
||||
/**
|
||||
* Current refresh rate in 1/ms.
|
||||
*/
|
||||
int refreshRate() const override;
|
||||
|
||||
bool isInternal() const override {
|
||||
return m_internal;
|
||||
}
|
||||
|
||||
void setGlobalPos(const QPoint &pos);
|
||||
void setScale(qreal scale);
|
||||
|
||||
void applyChanges(const KWaylandServer::OutputChangeSet *changeSet) override;
|
||||
|
||||
QPointer<KWaylandServer::OutputInterface> waylandOutput() const {
|
||||
return m_waylandOutput;
|
||||
}
|
||||
|
||||
bool isEnabled() const;
|
||||
/**
|
||||
* Enable or disable the output.
|
||||
*
|
||||
* This differs from updateDpms as it also removes the wl_output.
|
||||
* The default is on.
|
||||
*/
|
||||
void setEnabled(bool enable) override;
|
||||
|
||||
QString description() const;
|
||||
|
||||
/**
|
||||
* The current rotation of the output
|
||||
*
|
||||
* @return rotation in degrees
|
||||
*/
|
||||
int rotation() const;
|
||||
|
||||
/**
|
||||
* Returns a matrix that can translate into the display's coordinates system
|
||||
*/
|
||||
QMatrix4x4 transformation() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void modeChanged();
|
||||
void outputChange(const QRegion &damagedRegion);
|
||||
|
||||
protected:
|
||||
void initInterfaces(const QString &model, const QString &manufacturer,
|
||||
const QByteArray &uuid, const QSize &physicalSize,
|
||||
const QVector<KWaylandServer::OutputDeviceInterface::Mode> &modes);
|
||||
|
||||
QPoint globalPos() const;
|
||||
|
||||
bool internal() const {
|
||||
return m_internal;
|
||||
}
|
||||
void setName(const QString &name) {
|
||||
m_name = name;
|
||||
}
|
||||
void setInternal(bool set) {
|
||||
m_internal = set;
|
||||
}
|
||||
void setDpmsSupported(bool set) {
|
||||
m_waylandOutput->setDpmsSupported(set);
|
||||
}
|
||||
|
||||
virtual void updateEnablement(bool enable) {
|
||||
Q_UNUSED(enable);
|
||||
}
|
||||
virtual void updateDpms(KWaylandServer::OutputInterface::DpmsMode mode) {
|
||||
Q_UNUSED(mode);
|
||||
}
|
||||
virtual void updateMode(int modeIndex) {
|
||||
Q_UNUSED(modeIndex);
|
||||
}
|
||||
virtual void updateTransform(Transform transform) {
|
||||
Q_UNUSED(transform);
|
||||
}
|
||||
|
||||
void setWaylandMode(const QSize &size, int refreshRate);
|
||||
void setTransform(Transform transform);
|
||||
|
||||
QSize orientateSize(const QSize &size) const;
|
||||
|
||||
private:
|
||||
void setTransform(KWaylandServer::OutputDeviceInterface::Transform transform);
|
||||
|
||||
KWaylandServer::OutputInterface *m_waylandOutput;
|
||||
KWaylandServer::XdgOutputV1Interface *m_xdgOutputV1;
|
||||
KWaylandServer::OutputDeviceInterface *m_waylandOutputDevice;
|
||||
KWaylandServer::OutputInterface::DpmsMode m_dpms = KWaylandServer::OutputInterface::DpmsMode::On;
|
||||
|
||||
QString m_name;
|
||||
bool m_internal = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // KWIN_OUTPUT_H
|
236
activation.cpp
236
activation.cpp
|
@ -1,12 +1,23 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
||||
SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
|
||||
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
||||
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
|
@ -15,7 +26,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "x11client.h"
|
||||
#include "client.h"
|
||||
#include "cursor.h"
|
||||
#include "focuschain.h"
|
||||
#include "netinfo.h"
|
||||
|
@ -24,6 +35,7 @@
|
|||
#include "activities.h"
|
||||
#endif
|
||||
|
||||
#include <fixx11h.h>
|
||||
#include <kstartupinfo.h>
|
||||
#include <kstringhandler.h>
|
||||
#include <KLocalizedString>
|
||||
|
@ -81,7 +93,7 @@ namespace KWin
|
|||
futher user actions took place after the action leading to this new
|
||||
mapped window. This check is done by Workspace::allowClientActivation().
|
||||
There are several ways how to get the timestamp of action that caused
|
||||
the new mapped window (done in X11Client::readUserTimeMapTimestamp()) :
|
||||
the new mapped window (done in Client::readUserTimeMapTimestamp()) :
|
||||
- the window may have the _NET_WM_USER_TIME property. This way
|
||||
the application may either explicitly request that the window is not
|
||||
activated (by using 0 timestamp), or the property contains the time
|
||||
|
@ -120,7 +132,7 @@ namespace KWin
|
|||
than any user action done after launching this application.
|
||||
- if no timestamp is found at all, the window is activated.
|
||||
The check whether two windows belong to the same application (same
|
||||
process) is done in X11Client::belongToSameApplication(). Not 100% reliable,
|
||||
process) is done in Client::belongToSameApplication(). Not 100% reliable,
|
||||
but hopefully 99,99% reliable.
|
||||
|
||||
As a somewhat special case, window activation is always enabled when
|
||||
|
@ -159,7 +171,7 @@ namespace KWin
|
|||
- without ASN - user timestamp needs to be reset, otherwise it would
|
||||
be used, and it's old; moreover this new window mustn't be detected
|
||||
as window belonging to already running application, or it wouldn't
|
||||
be activated - see X11Client::sameAppWindowRoleMatch() for the (rather ugly)
|
||||
be activated - see Client::sameAppWindowRoleMatch() for the (rather ugly)
|
||||
hack
|
||||
- konqueror preloading, i.e. window is created in advance, and kfmclient
|
||||
tells this Konqueror instance to show it later
|
||||
|
@ -207,13 +219,13 @@ namespace KWin
|
|||
//****************************************
|
||||
|
||||
|
||||
/**
|
||||
* Informs the workspace about the active client, i.e. the client that
|
||||
* has the focus (or None if no client has the focus). This functions
|
||||
* is called by the client itself that gets focus. It has no other
|
||||
* effect than fixing the focus chain and the return value of
|
||||
* activeClient(). And of course, to propagate the active client to the
|
||||
* world.
|
||||
/*!
|
||||
Informs the workspace about the active client, i.e. the client that
|
||||
has the focus (or None if no client has the focus). This functions
|
||||
is called by the client itself that gets focus. It has no other
|
||||
effect than fixing the focus chain and the return value of
|
||||
activeClient(). And of course, to propagate the active client to the
|
||||
world.
|
||||
*/
|
||||
void Workspace::setActiveClient(AbstractClient* c)
|
||||
{
|
||||
|
@ -227,13 +239,13 @@ void Workspace::setActiveClient(AbstractClient* c)
|
|||
}
|
||||
StackingUpdatesBlocker blocker(this);
|
||||
++set_active_client_recursion;
|
||||
updateFocusMousePosition(Cursors::self()->mouse()->pos());
|
||||
if (active_client != nullptr) {
|
||||
updateFocusMousePosition(Cursor::pos());
|
||||
if (active_client != NULL) {
|
||||
// note that this may call setActiveClient( NULL ), therefore the recursion counter
|
||||
active_client->setActive(false);
|
||||
}
|
||||
active_client = c;
|
||||
Q_ASSERT(c == nullptr || c->isActive());
|
||||
Q_ASSERT(c == NULL || c->isActive());
|
||||
|
||||
if (active_client) {
|
||||
last_active_client = active_client;
|
||||
|
@ -266,23 +278,22 @@ void Workspace::setActiveClient(AbstractClient* c)
|
|||
--set_active_client_recursion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to activate the client \a c. This function performs what you
|
||||
* expect when clicking the respective entry in a taskbar: showing and
|
||||
* raising the client (this may imply switching to the another virtual
|
||||
* desktop) and putting the focus onto it. Once X really gave focus to
|
||||
* the client window as requested, the client itself will call
|
||||
* setActiveClient() and the operation is complete. This may not happen
|
||||
* with certain focus policies, though.
|
||||
*
|
||||
* @see setActiveClient
|
||||
* @see requestFocus
|
||||
/*!
|
||||
Tries to activate the client \a c. This function performs what you
|
||||
expect when clicking the respective entry in a taskbar: showing and
|
||||
raising the client (this may imply switching to the another virtual
|
||||
desktop) and putting the focus onto it. Once X really gave focus to
|
||||
the client window as requested, the client itself will call
|
||||
setActiveClient() and the operation is complete. This may not happen
|
||||
with certain focus policies, though.
|
||||
|
||||
\sa stActiveClient(), requestFocus()
|
||||
*/
|
||||
void Workspace::activateClient(AbstractClient* c, bool force)
|
||||
{
|
||||
if (c == nullptr) {
|
||||
if (c == NULL) {
|
||||
focusToNull();
|
||||
setActiveClient(nullptr);
|
||||
setActiveClient(NULL);
|
||||
return;
|
||||
}
|
||||
raiseClient(c);
|
||||
|
@ -315,26 +326,26 @@ void Workspace::activateClient(AbstractClient* c, bool force)
|
|||
// of the currently active window old, and reject further activation for it.
|
||||
// E.g. typing URL in minicli which will show kio_uiserver dialog (with workaround),
|
||||
// and then kdesktop shows dialog about SSL certificate.
|
||||
// This needs also avoiding user creation time in X11Client::readUserTimeMapTimestamp().
|
||||
if (X11Client *client = dynamic_cast<X11Client *>(c)) {
|
||||
// This needs also avoiding user creation time in Client::readUserTimeMapTimestamp().
|
||||
if (Client *client = dynamic_cast<Client*>(c)) {
|
||||
// updateUserTime is X11 specific
|
||||
client->updateUserTime();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to activate the client by asking X for the input focus. This
|
||||
* function does not perform any show, raise or desktop switching. See
|
||||
* Workspace::activateClient() instead.
|
||||
*
|
||||
* @see activateClient
|
||||
/*!
|
||||
Tries to activate the client by asking X for the input focus. This
|
||||
function does not perform any show, raise or desktop switching. See
|
||||
Workspace::activateClient() instead.
|
||||
|
||||
\sa Workspace::activateClient()
|
||||
*/
|
||||
bool Workspace::requestFocus(AbstractClient* c, bool force)
|
||||
void Workspace::requestFocus(AbstractClient* c, bool force)
|
||||
{
|
||||
return takeActivity(c, force ? ActivityFocusForce : ActivityFocus);
|
||||
takeActivity(c, force ? ActivityFocusForce : ActivityFocus);
|
||||
}
|
||||
|
||||
bool Workspace::takeActivity(AbstractClient* c, ActivityFlags flags)
|
||||
void Workspace::takeActivity(AbstractClient* c, ActivityFlags flags)
|
||||
{
|
||||
// the 'if ( c == active_client ) return;' optimization mustn't be done here
|
||||
if (!focusChangeEnabled() && (c != active_client))
|
||||
|
@ -342,12 +353,12 @@ bool Workspace::takeActivity(AbstractClient* c, ActivityFlags flags)
|
|||
|
||||
if (!c) {
|
||||
focusToNull();
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags & ActivityFocus) {
|
||||
AbstractClient* modal = c->findModal();
|
||||
if (modal != nullptr && modal != c) {
|
||||
if (modal != NULL && modal != c) {
|
||||
if (!modal->isOnDesktop(c->desktop()))
|
||||
modal->setDesktop(c->desktop());
|
||||
if (!modal->isShown(true) && !modal->isMinimized()) // forced desktop or utility window
|
||||
|
@ -377,40 +388,38 @@ bool Workspace::takeActivity(AbstractClient* c, ActivityFlags flags)
|
|||
}
|
||||
flags &= ~ActivityFocus;
|
||||
}
|
||||
if (c->tabGroup() && c->tabGroup()->current() != c)
|
||||
c->tabGroup()->setCurrent(c);
|
||||
if (!c->isShown(true)) { // shouldn't happen, call activateClient() if needed
|
||||
qCWarning(KWIN_CORE) << "takeActivity: not shown" ;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
bool ret = true;
|
||||
|
||||
if (flags & ActivityFocus)
|
||||
ret &= c->takeFocus();
|
||||
c->takeFocus();
|
||||
if (flags & ActivityRaise)
|
||||
workspace()->raiseClient(c);
|
||||
|
||||
if (!c->isOnActiveScreen())
|
||||
screens()->setCurrent(c->screen());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Informs the workspace that the client \a c has been hidden. If it
|
||||
* was the active client (or to-become the active client),
|
||||
* the workspace activates another one.
|
||||
*
|
||||
* @note @p c may already be destroyed.
|
||||
/*!
|
||||
Informs the workspace that the client \a c has been hidden. If it
|
||||
was the active client (or to-become the active client),
|
||||
the workspace activates another one.
|
||||
|
||||
\a c may already be destroyed
|
||||
*/
|
||||
void Workspace::clientHidden(AbstractClient* c)
|
||||
{
|
||||
Q_ASSERT(!c->isShown(true) || !c->isOnCurrentDesktop() || !c->isOnCurrentActivity());
|
||||
assert(!c->isShown(true) || !c->isOnCurrentDesktop() || !c->isOnCurrentActivity());
|
||||
activateNextClient(c);
|
||||
}
|
||||
|
||||
AbstractClient *Workspace::clientUnderMouse(int screen) const
|
||||
{
|
||||
auto it = stackingOrder().constEnd();
|
||||
ToplevelList::const_iterator it = stackingOrder().constEnd();
|
||||
while (it != stackingOrder().constBegin()) {
|
||||
AbstractClient *client = qobject_cast<AbstractClient*>(*(--it));
|
||||
if (!client) {
|
||||
|
@ -423,11 +432,11 @@ AbstractClient *Workspace::clientUnderMouse(int screen) const
|
|||
client->isOnCurrentActivity() && client->isOnScreen(screen)))
|
||||
continue;
|
||||
|
||||
if (client->frameGeometry().contains(Cursors::self()->mouse()->pos())) {
|
||||
if (client->geometry().contains(Cursor::pos())) {
|
||||
return client;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// deactivates 'c' and activates next client
|
||||
|
@ -439,9 +448,9 @@ bool Workspace::activateNextClient(AbstractClient* c)
|
|||
|
||||
closeActivePopup();
|
||||
|
||||
if (c != nullptr) {
|
||||
if (c != NULL) {
|
||||
if (c == active_client)
|
||||
setActiveClient(nullptr);
|
||||
setActiveClient(NULL);
|
||||
should_get_focus.removeAll(c);
|
||||
}
|
||||
|
||||
|
@ -455,7 +464,16 @@ bool Workspace::activateNextClient(AbstractClient* c)
|
|||
if (!options->focusPolicyIsReasonable())
|
||||
return false;
|
||||
|
||||
AbstractClient* get_focus = nullptr;
|
||||
AbstractClient* get_focus = NULL;
|
||||
|
||||
// precedence on keeping the current tabgroup active. to the user that's the same window
|
||||
if (c && c->tabGroup() && c->isShown(false)) {
|
||||
if (c == c->tabGroup()->current())
|
||||
c->tabGroup()->activateNext();
|
||||
get_focus = c->tabGroup()->current();
|
||||
if (get_focus == c) // single tab case - should not happen
|
||||
get_focus = NULL;
|
||||
}
|
||||
|
||||
const int desktop = VirtualDesktopManager::self()->current();
|
||||
|
||||
|
@ -466,7 +484,7 @@ bool Workspace::activateNextClient(AbstractClient* c)
|
|||
get_focus = clientUnderMouse(c ? c->screen() : screens()->current());
|
||||
if (get_focus && (get_focus == c || get_focus->isDesktop())) {
|
||||
// should rather not happen, but it cannot get the focus. rest of usability is tested above
|
||||
get_focus = nullptr;
|
||||
get_focus = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,10 +503,10 @@ bool Workspace::activateNextClient(AbstractClient* c)
|
|||
}
|
||||
}
|
||||
|
||||
if (get_focus == nullptr) // last chance: focus the desktop
|
||||
if (get_focus == NULL) // last chance: focus the desktop
|
||||
get_focus = findDesktop(true, desktop);
|
||||
|
||||
if (get_focus != nullptr)
|
||||
if (get_focus != NULL)
|
||||
requestFocus(get_focus);
|
||||
else
|
||||
focusToNull();
|
||||
|
@ -506,9 +524,9 @@ void Workspace::setCurrentScreen(int new_screen)
|
|||
closeActivePopup();
|
||||
const int desktop = VirtualDesktopManager::self()->current();
|
||||
AbstractClient *get_focus = FocusChain::self()->getForActivation(desktop, new_screen);
|
||||
if (get_focus == nullptr)
|
||||
if (get_focus == NULL)
|
||||
get_focus = findDesktop(true, desktop);
|
||||
if (get_focus != nullptr && get_focus != mostRecentlyActivatedClient())
|
||||
if (get_focus != NULL && get_focus != mostRecentlyActivatedClient())
|
||||
requestFocus(get_focus);
|
||||
screens()->setCurrent(new_screen);
|
||||
}
|
||||
|
@ -551,7 +569,7 @@ bool Workspace::allowClientActivation(const KWin::AbstractClient *c, xcb_timesta
|
|||
if (time == -1U)
|
||||
time = c->userTime();
|
||||
int level = c->rules()->checkFSP(options->focusStealingPreventionLevel());
|
||||
if (sessionManager()->state() == SessionState::Saving && level <= FSP::Medium) { // <= normal
|
||||
if (session_saving && level <= FSP::Medium) { // <= normal
|
||||
return true;
|
||||
}
|
||||
AbstractClient* ac = mostRecentlyActivatedClient();
|
||||
|
@ -582,7 +600,7 @@ bool Workspace::allowClientActivation(const KWin::AbstractClient *c, xcb_timesta
|
|||
|
||||
// No active client, it's ok to pass focus
|
||||
// NOTICE that extreme protection needs to be handled before to allow protection on unmanged windows
|
||||
if (ac == nullptr || ac->isDesktop()) {
|
||||
if (ac == NULL || ac->isDesktop()) {
|
||||
qCDebug(KWIN_CORE) << "Activation: No client active, allowing";
|
||||
return true; // no active client -> always allow
|
||||
}
|
||||
|
@ -615,7 +633,7 @@ bool Workspace::allowClientActivation(const KWin::AbstractClient *c, xcb_timesta
|
|||
}
|
||||
|
||||
// Low or medium FSP, usertime comparism is possible
|
||||
const xcb_timestamp_t user_time = ac->userTime();
|
||||
Time user_time = ac->userTime();
|
||||
qCDebug(KWIN_CORE) << "Activation, compared:" << c << ":" << time << ":" << user_time
|
||||
<< ":" << (NET::timestampCompare(time, user_time) >= 0);
|
||||
return NET::timestampCompare(time, user_time) >= 0; // time >= user_time
|
||||
|
@ -628,7 +646,7 @@ bool Workspace::allowClientActivation(const KWin::AbstractClient *c, xcb_timesta
|
|||
bool Workspace::allowFullClientRaising(const KWin::AbstractClient *c, xcb_timestamp_t time)
|
||||
{
|
||||
int level = c->rules()->checkFSP(options->focusStealingPreventionLevel());
|
||||
if (sessionManager()->state() == SessionState::Saving && level <= 2) { // <= normal
|
||||
if (session_saving && level <= 2) { // <= normal
|
||||
return true;
|
||||
}
|
||||
AbstractClient* ac = mostRecentlyActivatedClient();
|
||||
|
@ -636,7 +654,7 @@ bool Workspace::allowFullClientRaising(const KWin::AbstractClient *c, xcb_timest
|
|||
return true;
|
||||
if (level == 4) // extreme
|
||||
return false;
|
||||
if (ac == nullptr || ac->isDesktop()) {
|
||||
if (ac == NULL || ac->isDesktop()) {
|
||||
qCDebug(KWIN_CORE) << "Raising: No client active, allowing";
|
||||
return true; // no active client -> always allow
|
||||
}
|
||||
|
@ -653,13 +671,9 @@ bool Workspace::allowFullClientRaising(const KWin::AbstractClient *c, xcb_timest
|
|||
return NET::timestampCompare(time, user_time) >= 0; // time >= user_time
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from X11Client after FocusIn that wasn't initiated by KWin and the client wasn't
|
||||
* allowed to activate.
|
||||
*
|
||||
* Returns @c true if the focus has been restored successfully; otherwise returns @c false.
|
||||
*/
|
||||
bool Workspace::restoreFocus()
|
||||
// called from Client after FocusIn that wasn't initiated by KWin and the client
|
||||
// wasn't allowed to activate
|
||||
void Workspace::restoreFocus()
|
||||
{
|
||||
// this updateXTime() is necessary - as FocusIn events don't have
|
||||
// a timestamp *sigh*, kwin's timestamp would be older than the timestamp
|
||||
|
@ -667,10 +681,9 @@ bool Workspace::restoreFocus()
|
|||
// the attempt to restore the focus would fail due to old timestamp
|
||||
updateXTime();
|
||||
if (should_get_focus.count() > 0)
|
||||
return requestFocus(should_get_focus.last());
|
||||
requestFocus(should_get_focus.last());
|
||||
else if (last_active_client)
|
||||
return requestFocus(last_active_client);
|
||||
return true;
|
||||
requestFocus(last_active_client);
|
||||
}
|
||||
|
||||
void Workspace::clientAttentionChanged(AbstractClient* c, bool set)
|
||||
|
@ -687,13 +700,13 @@ void Workspace::clientAttentionChanged(AbstractClient* c, bool set)
|
|||
// Client
|
||||
//********************************************
|
||||
|
||||
/**
|
||||
* Updates the user time (time of last action in the active window).
|
||||
* This is called inside kwin for every action with the window
|
||||
* that qualifies for user interaction (clicking on it, activate it
|
||||
* externally, etc.).
|
||||
/*!
|
||||
Updates the user time (time of last action in the active window).
|
||||
This is called inside kwin for every action with the window
|
||||
that qualifies for user interaction (clicking on it, activate it
|
||||
externally, etc.).
|
||||
*/
|
||||
void X11Client::updateUserTime(xcb_timestamp_t time)
|
||||
void Client::updateUserTime(xcb_timestamp_t time)
|
||||
{
|
||||
// copied in Group::updateUserTime
|
||||
if (time == XCB_TIME_CURRENT_TIME) {
|
||||
|
@ -704,18 +717,18 @@ void X11Client::updateUserTime(xcb_timestamp_t time)
|
|||
&& (m_userTime == XCB_TIME_CURRENT_TIME
|
||||
|| NET::timestampCompare(time, m_userTime) > 0)) { // time > user_time
|
||||
m_userTime = time;
|
||||
shade_below = nullptr; // do not hover re-shade a window after it got interaction
|
||||
shade_below = NULL; // do not hover re-shade a window after it got interaction
|
||||
}
|
||||
group()->updateUserTime(m_userTime);
|
||||
}
|
||||
|
||||
xcb_timestamp_t X11Client::readUserCreationTime() const
|
||||
xcb_timestamp_t Client::readUserCreationTime() const
|
||||
{
|
||||
Xcb::Property prop(false, window(), atoms->kde_net_wm_user_creation_time, XCB_ATOM_CARDINAL, 0, 1);
|
||||
return prop.value<xcb_timestamp_t>(-1);
|
||||
}
|
||||
|
||||
xcb_timestamp_t X11Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, const KStartupInfoData *asn_data,
|
||||
xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, const KStartupInfoData *asn_data,
|
||||
bool session) const
|
||||
{
|
||||
xcb_timestamp_t time = info->userTime();
|
||||
|
@ -724,7 +737,7 @@ xcb_timestamp_t X11Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id
|
|||
|
||||
// newer ASN timestamp always replaces user timestamp, unless user timestamp is 0
|
||||
// helps e.g. with konqy reusing
|
||||
if (asn_data != nullptr && time != 0) {
|
||||
if (asn_data != NULL && time != 0) {
|
||||
if (asn_id->timestamp() != 0
|
||||
&& (time == -1U || NET::timestampCompare(asn_id->timestamp(), time) > 0)) {
|
||||
time = asn_id->timestamp();
|
||||
|
@ -739,21 +752,21 @@ xcb_timestamp_t X11Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id
|
|||
// Otherwise, refuse activation of a window
|
||||
// from already running application if this application
|
||||
// is not the active one (unless focus stealing prevention is turned off).
|
||||
X11Client *act = dynamic_cast<X11Client *>(workspace()->mostRecentlyActivatedClient());
|
||||
if (act != nullptr && !belongToSameApplication(act, this, SameApplicationCheck::RelaxedForActive)) {
|
||||
Client* act = dynamic_cast<Client*>(workspace()->mostRecentlyActivatedClient());
|
||||
if (act != NULL && !belongToSameApplication(act, this, SameApplicationCheck::RelaxedForActive)) {
|
||||
bool first_window = true;
|
||||
auto sameApplicationActiveHackPredicate = [this](const X11Client *cl) {
|
||||
auto sameApplicationActiveHackPredicate = [this](const Client *cl) {
|
||||
// ignore already existing splashes, toolbars, utilities and menus,
|
||||
// as the app may show those before the main window
|
||||
return !cl->isSplash() && !cl->isToolbar() && !cl->isUtility() && !cl->isMenu()
|
||||
&& cl != this && X11Client::belongToSameApplication(cl, this, SameApplicationCheck::RelaxedForActive);
|
||||
&& cl != this && Client::belongToSameApplication(cl, this, SameApplicationCheck::RelaxedForActive);
|
||||
};
|
||||
if (isTransient()) {
|
||||
auto clientMainClients = [this]() {
|
||||
QList<X11Client *> ret;
|
||||
auto clientMainClients = [this] () -> ClientList {
|
||||
ClientList ret;
|
||||
const auto mcs = mainClients();
|
||||
for (auto mc: mcs) {
|
||||
if (X11Client *c = dynamic_cast<X11Client *>(mc)) {
|
||||
if (Client *c = dynamic_cast<Client*>(mc)) {
|
||||
ret << c;
|
||||
}
|
||||
}
|
||||
|
@ -763,7 +776,7 @@ xcb_timestamp_t X11Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id
|
|||
; // is transient for currently active window, even though it's not
|
||||
// the same app (e.g. kcookiejar dialog) -> allow activation
|
||||
else if (groupTransient() &&
|
||||
findInList<X11Client, X11Client>(clientMainClients(), sameApplicationActiveHackPredicate) == nullptr)
|
||||
findInList<Client, Client>(clientMainClients(), sameApplicationActiveHackPredicate) == NULL)
|
||||
; // standalone transient
|
||||
else
|
||||
first_window = false;
|
||||
|
@ -794,12 +807,12 @@ xcb_timestamp_t X11Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id
|
|||
return time;
|
||||
}
|
||||
|
||||
xcb_timestamp_t X11Client::userTime() const
|
||||
xcb_timestamp_t Client::userTime() const
|
||||
{
|
||||
xcb_timestamp_t time = m_userTime;
|
||||
if (time == 0) // doesn't want focus after showing
|
||||
return 0;
|
||||
Q_ASSERT(group() != nullptr);
|
||||
assert(group() != NULL);
|
||||
if (time == -1U
|
||||
|| (group()->userTime() != -1U
|
||||
&& NET::timestampCompare(group()->userTime(), time) > 0))
|
||||
|
@ -807,13 +820,12 @@ xcb_timestamp_t X11Client::userTime() const
|
|||
return time;
|
||||
}
|
||||
|
||||
void X11Client::doSetActive()
|
||||
void Client::doSetActive()
|
||||
{
|
||||
updateUrgency(); // demand attention again if it's still urgent
|
||||
info->setState(isActive() ? NET::Focused : NET::States(), NET::Focused);
|
||||
}
|
||||
|
||||
void X11Client::startupIdChanged()
|
||||
void Client::startupIdChanged()
|
||||
{
|
||||
KStartupInfoId asn_id;
|
||||
KStartupInfoData asn_data;
|
||||
|
@ -830,7 +842,7 @@ void X11Client::startupIdChanged()
|
|||
workspace()->sendClientToDesktop(this, desktop, true);
|
||||
if (asn_data.xinerama() != -1)
|
||||
workspace()->sendClientToScreen(this, asn_data.xinerama());
|
||||
const xcb_timestamp_t timestamp = asn_id.timestamp();
|
||||
Time timestamp = asn_id.timestamp();
|
||||
if (timestamp != 0) {
|
||||
bool activate = workspace()->allowClientActivation(this, timestamp);
|
||||
if (asn_data.desktop() != 0 && !isOnCurrentDesktop())
|
||||
|
@ -842,7 +854,7 @@ void X11Client::startupIdChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void X11Client::updateUrgency()
|
||||
void Client::updateUrgency()
|
||||
{
|
||||
if (info->urgency())
|
||||
demandAttention();
|
||||
|
@ -867,7 +879,7 @@ void Group::startupIdChanged()
|
|||
|
||||
void Group::updateUserTime(xcb_timestamp_t time)
|
||||
{
|
||||
// copy of X11Client::updateUserTime
|
||||
// copy of Client::updateUserTime
|
||||
if (time == XCB_CURRENT_TIME) {
|
||||
updateXTime();
|
||||
time = xTime();
|
||||
|
|
|
@ -1,14 +1,25 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "activities.h"
|
||||
// KWin
|
||||
#include "x11client.h"
|
||||
#include "client.h"
|
||||
#include "workspace.h"
|
||||
// KDE
|
||||
#include <KConfigGroup>
|
||||
|
@ -36,7 +47,7 @@ Activities::Activities(QObject *parent)
|
|||
|
||||
Activities::~Activities()
|
||||
{
|
||||
s_self = nullptr;
|
||||
s_self = NULL;
|
||||
}
|
||||
|
||||
KActivities::Consumer::ServiceStatus Activities::serviceStatus() const
|
||||
|
@ -61,9 +72,7 @@ void Activities::slotCurrentChanged(const QString &newActivity)
|
|||
|
||||
void Activities::slotRemoved(const QString &activity)
|
||||
{
|
||||
foreach (X11Client *client, Workspace::self()->clientList()) {
|
||||
if (client->isDesktop())
|
||||
continue;
|
||||
foreach (Client * client, Workspace::self()->clientList()) {
|
||||
client->setOnActivity(activity, false);
|
||||
}
|
||||
//toss out any session data for it
|
||||
|
@ -71,7 +80,7 @@ void Activities::slotRemoved(const QString &activity)
|
|||
cg.deleteGroup();
|
||||
}
|
||||
|
||||
void Activities::toggleClientOnActivity(X11Client *c, const QString &activity, bool dont_activate)
|
||||
void Activities::toggleClientOnActivity(Client* c, const QString &activity, bool dont_activate)
|
||||
{
|
||||
//int old_desktop = c->desktop();
|
||||
bool was_on_activity = c->isOnActivity(activity);
|
||||
|
@ -100,7 +109,7 @@ void Activities::toggleClientOnActivity(X11Client *c, const QString &activity, b
|
|||
for (auto it = transients_stacking_order.constBegin();
|
||||
it != transients_stacking_order.constEnd();
|
||||
++it) {
|
||||
X11Client *c = dynamic_cast<X11Client *>(*it);
|
||||
Client *c = dynamic_cast<Client *>(*it);
|
||||
if (!c) {
|
||||
continue;
|
||||
}
|
||||
|
@ -112,7 +121,7 @@ void Activities::toggleClientOnActivity(X11Client *c, const QString &activity, b
|
|||
bool Activities::start(const QString &id)
|
||||
{
|
||||
Workspace *ws = Workspace::self();
|
||||
if (ws->sessionManager()->state() == SessionState::Saving) {
|
||||
if (ws->sessionSaving()) {
|
||||
return false; //ksmserver doesn't queue requests (yet)
|
||||
}
|
||||
|
||||
|
@ -134,7 +143,7 @@ bool Activities::start(const QString &id)
|
|||
|
||||
bool Activities::stop(const QString &id)
|
||||
{
|
||||
if (Workspace::self()->sessionManager()->state() == SessionState::Saving) {
|
||||
if (Workspace::self()->sessionSaving()) {
|
||||
return false; //ksmserver doesn't queue requests (yet)
|
||||
//FIXME what about session *loading*?
|
||||
}
|
||||
|
@ -148,18 +157,16 @@ bool Activities::stop(const QString &id)
|
|||
void Activities::reallyStop(const QString &id)
|
||||
{
|
||||
Workspace *ws = Workspace::self();
|
||||
if (ws->sessionManager()->state() == SessionState::Saving)
|
||||
if (ws->sessionSaving())
|
||||
return; //ksmserver doesn't queue requests (yet)
|
||||
|
||||
qCDebug(KWIN_CORE) << id;
|
||||
|
||||
QSet<QByteArray> saveSessionIds;
|
||||
QSet<QByteArray> dontCloseSessionIds;
|
||||
const QList<X11Client *> &clients = ws->clientList();
|
||||
for (auto it = clients.constBegin(); it != clients.constEnd(); ++it) {
|
||||
const X11Client *c = (*it);
|
||||
if (c->isDesktop())
|
||||
continue;
|
||||
const ClientList &clients = ws->clientList();
|
||||
for (ClientList::const_iterator it = clients.constBegin(); it != clients.constEnd(); ++it) {
|
||||
const Client* c = (*it);
|
||||
const QByteArray sessionId = c->sessionId();
|
||||
if (sessionId.isEmpty()) {
|
||||
continue; //TODO support old wm_command apps too?
|
||||
|
|
37
activities.h
37
activities.h
|
@ -1,11 +1,22 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#ifndef KWIN_ACTIVITIES_H
|
||||
#define KWIN_ACTIVITIES_H
|
||||
|
||||
|
@ -22,24 +33,24 @@ class Controller;
|
|||
|
||||
namespace KWin
|
||||
{
|
||||
class X11Client;
|
||||
class Client;
|
||||
|
||||
class KWIN_EXPORT Activities : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
~Activities() override;
|
||||
~Activities();
|
||||
|
||||
bool stop(const QString &id);
|
||||
bool start(const QString &id);
|
||||
void setCurrent(const QString &activity);
|
||||
/**
|
||||
* Adds/removes client \a c to/from \a activity.
|
||||
*
|
||||
* Takes care of transients as well.
|
||||
*/
|
||||
void toggleClientOnActivity(X11Client *c, const QString &activity, bool dont_activate);
|
||||
* Adds/removes client \a c to/from \a activity.
|
||||
*
|
||||
* Takes care of transients as well.
|
||||
*/
|
||||
void toggleClientOnActivity(Client* c, const QString &activity, bool dont_activate);
|
||||
|
||||
QStringList running() const;
|
||||
QStringList all() const;
|
||||
|
|
34
appmenu.cpp
34
appmenu.cpp
|
@ -1,15 +1,26 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2011 Lionel Chauvin <megabigbug@yahoo.fr>
|
||||
SPDX-FileCopyrightText: 2011, 2012 Cédric Bellegarde <gnumdk@gmail.com>
|
||||
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
|
||||
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
|
||||
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "appmenu.h"
|
||||
#include "x11client.h"
|
||||
#include "client.h"
|
||||
#include "workspace.h"
|
||||
#include <appmenu_interface.h>
|
||||
|
||||
|
@ -19,8 +30,7 @@
|
|||
#include "decorations/decorationbridge.h"
|
||||
#include <KDecoration2/DecorationSettings>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
using namespace KWin;
|
||||
|
||||
KWIN_SINGLETON_FACTORY(ApplicationMenu)
|
||||
|
||||
|
@ -119,5 +129,3 @@ AbstractClient *ApplicationMenu::findAbstractClientWithApplicationMenu(const QSt
|
|||
&& c->applicationMenuObjectPath() == menuObjectPath.path();
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
|
|
27
appmenu.h
27
appmenu.h
|
@ -1,13 +1,24 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2011 Lionel Chauvin <megabigbug@yahoo.fr>
|
||||
SPDX-FileCopyrightText: 2011, 2012 Cédric Bellegarde <gnumdk@gmail.com>
|
||||
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
|
||||
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
|
||||
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#ifndef KWIN_APPMENU_H
|
||||
#define KWIN_APPMENU_H
|
||||
// KWin
|
||||
|
|
49
atoms.cpp
49
atoms.cpp
|
@ -1,13 +1,24 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
||||
SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
|
||||
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
||||
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
||||
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#include "atoms.h"
|
||||
|
||||
|
@ -32,42 +43,24 @@ Atoms::Atoms()
|
|||
, kde_net_wm_user_creation_time(QByteArrayLiteral("_KDE_NET_WM_USER_CREATION_TIME"))
|
||||
, net_wm_take_activity(QByteArrayLiteral("_NET_WM_TAKE_ACTIVITY"))
|
||||
, net_wm_window_opacity(QByteArrayLiteral("_NET_WM_WINDOW_OPACITY"))
|
||||
, xdnd_selection(QByteArrayLiteral("XdndSelection"))
|
||||
, xdnd_aware(QByteArrayLiteral("XdndAware"))
|
||||
, xdnd_enter(QByteArrayLiteral("XdndEnter"))
|
||||
, xdnd_type_list(QByteArrayLiteral("XdndTypeList"))
|
||||
, xdnd_position(QByteArrayLiteral("XdndPosition"))
|
||||
, xdnd_status(QByteArrayLiteral("XdndStatus"))
|
||||
, xdnd_action_copy(QByteArrayLiteral("XdndActionCopy"))
|
||||
, xdnd_action_move(QByteArrayLiteral("XdndActionMove"))
|
||||
, xdnd_action_ask(QByteArrayLiteral("XdndActionAsk"))
|
||||
, xdnd_drop(QByteArrayLiteral("XdndDrop"))
|
||||
, xdnd_leave(QByteArrayLiteral("XdndLeave"))
|
||||
, xdnd_finished(QByteArrayLiteral("XdndFinished"))
|
||||
, net_frame_extents(QByteArrayLiteral("_NET_FRAME_EXTENTS"))
|
||||
, kde_net_wm_frame_strut(QByteArrayLiteral("_KDE_NET_WM_FRAME_STRUT"))
|
||||
, net_wm_sync_request_counter(QByteArrayLiteral("_NET_WM_SYNC_REQUEST_COUNTER"))
|
||||
, net_wm_sync_request(QByteArrayLiteral("_NET_WM_SYNC_REQUEST"))
|
||||
, kde_net_wm_shadow(QByteArrayLiteral("_KDE_NET_WM_SHADOW"))
|
||||
, kde_net_wm_tab_group(QByteArrayLiteral("_KDE_NET_WM_TAB_GROUP"))
|
||||
, kde_first_in_window_list(QByteArrayLiteral("_KDE_FIRST_IN_WINDOWLIST"))
|
||||
, kde_color_sheme(QByteArrayLiteral("_KDE_NET_WM_COLOR_SCHEME"))
|
||||
, kde_skip_close_animation(QByteArrayLiteral("_KDE_NET_WM_SKIP_CLOSE_ANIMATION"))
|
||||
, kde_screen_edge_show(QByteArrayLiteral("_KDE_NET_WM_SCREEN_EDGE_SHOW"))
|
||||
, gtk_frame_extents(QByteArrayLiteral("_GTK_FRAME_EXTENTS"))
|
||||
, kwin_dbus_service(QByteArrayLiteral("_ORG_KDE_KWIN_DBUS_SERVICE"))
|
||||
, utf8_string(QByteArrayLiteral("UTF8_STRING"))
|
||||
, text(QByteArrayLiteral("TEXT"))
|
||||
, uri_list(QByteArrayLiteral("text/uri-list"))
|
||||
, netscape_url(QByteArrayLiteral("_NETSCAPE_URL"))
|
||||
, moz_url(QByteArrayLiteral("text/x-moz-url"))
|
||||
, wl_surface_id(QByteArrayLiteral("WL_SURFACE_ID"))
|
||||
, kde_net_wm_appmenu_service_name(QByteArrayLiteral("_KDE_NET_WM_APPMENU_SERVICE_NAME"))
|
||||
, kde_net_wm_appmenu_object_path(QByteArrayLiteral("_KDE_NET_WM_APPMENU_OBJECT_PATH"))
|
||||
, clipboard(QByteArrayLiteral("CLIPBOARD"))
|
||||
, timestamp(QByteArrayLiteral("TIMESTAMP"))
|
||||
, targets(QByteArrayLiteral("TARGETS"))
|
||||
, delete_atom(QByteArrayLiteral("DELETE"))
|
||||
, incr(QByteArrayLiteral("INCR"))
|
||||
, wl_selection(QByteArrayLiteral("WL_SELECTION"))
|
||||
, m_dtSmWindowInfo(QByteArrayLiteral("_DT_SM_WINDOW_INFO"))
|
||||
, m_motifSupport(QByteArrayLiteral("_MOTIF_WM_INFO"))
|
||||
, m_helpersRetrieved(false)
|
||||
|
|
51
atoms.h
51
atoms.h
|
@ -1,13 +1,24 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
||||
SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
|
||||
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
||||
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
||||
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef KWIN_ATOMS_H
|
||||
#define KWIN_ATOMS_H
|
||||
|
@ -41,46 +52,28 @@ public:
|
|||
Xcb::Atom kde_net_wm_user_creation_time;
|
||||
Xcb::Atom net_wm_take_activity;
|
||||
Xcb::Atom net_wm_window_opacity;
|
||||
Xcb::Atom xdnd_selection;
|
||||
Xcb::Atom xdnd_aware;
|
||||
Xcb::Atom xdnd_enter;
|
||||
Xcb::Atom xdnd_type_list;
|
||||
Xcb::Atom xdnd_position;
|
||||
Xcb::Atom xdnd_status;
|
||||
Xcb::Atom xdnd_action_copy;
|
||||
Xcb::Atom xdnd_action_move;
|
||||
Xcb::Atom xdnd_action_ask;
|
||||
Xcb::Atom xdnd_drop;
|
||||
Xcb::Atom xdnd_leave;
|
||||
Xcb::Atom xdnd_finished;
|
||||
Xcb::Atom net_frame_extents;
|
||||
Xcb::Atom kde_net_wm_frame_strut;
|
||||
Xcb::Atom net_wm_sync_request_counter;
|
||||
Xcb::Atom net_wm_sync_request;
|
||||
Xcb::Atom kde_net_wm_shadow;
|
||||
Xcb::Atom kde_net_wm_tab_group;
|
||||
Xcb::Atom kde_first_in_window_list;
|
||||
Xcb::Atom kde_color_sheme;
|
||||
Xcb::Atom kde_skip_close_animation;
|
||||
Xcb::Atom kde_screen_edge_show;
|
||||
Xcb::Atom gtk_frame_extents;
|
||||
Xcb::Atom kwin_dbus_service;
|
||||
Xcb::Atom utf8_string;
|
||||
Xcb::Atom text;
|
||||
Xcb::Atom uri_list;
|
||||
Xcb::Atom netscape_url;
|
||||
Xcb::Atom moz_url;
|
||||
Xcb::Atom wl_surface_id;
|
||||
Xcb::Atom kde_net_wm_appmenu_service_name;
|
||||
Xcb::Atom kde_net_wm_appmenu_object_path;
|
||||
Xcb::Atom clipboard;
|
||||
Xcb::Atom timestamp;
|
||||
Xcb::Atom targets;
|
||||
Xcb::Atom delete_atom;
|
||||
Xcb::Atom incr;
|
||||
Xcb::Atom wl_selection;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
**/
|
||||
void retrieveHelpers();
|
||||
|
||||
private:
|
||||
|
|
|
@ -12,39 +12,37 @@ add_subdirectory(tabbox)
|
|||
########################################################
|
||||
# Test ScreenPaintData
|
||||
########################################################
|
||||
set(testScreenPaintData_SRCS test_screen_paint_data.cpp)
|
||||
set( testScreenPaintData_SRCS test_screen_paint_data.cpp )
|
||||
add_executable(testScreenPaintData ${testScreenPaintData_SRCS})
|
||||
target_link_libraries(testScreenPaintData kwineffects Qt5::Test Qt5::Widgets KF5::WindowSystem)
|
||||
target_link_libraries( testScreenPaintData kwineffects Qt5::Test Qt5::Widgets KF5::WindowSystem)
|
||||
add_test(NAME kwin-testScreenPaintData COMMAND testScreenPaintData)
|
||||
ecm_mark_as_test(testScreenPaintData)
|
||||
|
||||
########################################################
|
||||
# Test WindowPaintData
|
||||
########################################################
|
||||
set(testWindowPaintData_SRCS test_window_paint_data.cpp)
|
||||
set( testWindowPaintData_SRCS test_window_paint_data.cpp )
|
||||
add_executable(testWindowPaintData ${testWindowPaintData_SRCS})
|
||||
target_link_libraries(testWindowPaintData kwineffects Qt5::Widgets Qt5::Test )
|
||||
target_link_libraries( testWindowPaintData kwineffects Qt5::Widgets Qt5::Test )
|
||||
add_test(NAME kwin-testWindowPaintData COMMAND testWindowPaintData)
|
||||
ecm_mark_as_test(testWindowPaintData)
|
||||
|
||||
########################################################
|
||||
# Test VirtualDesktopManager
|
||||
########################################################
|
||||
set(testVirtualDesktops_SRCS
|
||||
../virtualdesktops.cpp
|
||||
test_virtual_desktops.cpp
|
||||
set( testVirtualDesktops_SRCS
|
||||
test_virtual_desktops.cpp
|
||||
../virtualdesktops.cpp
|
||||
)
|
||||
add_executable(testVirtualDesktops ${testVirtualDesktops_SRCS})
|
||||
|
||||
target_link_libraries(testVirtualDesktops
|
||||
Qt5::Test
|
||||
Qt5::Widgets
|
||||
|
||||
KF5::ConfigCore
|
||||
KF5::GlobalAccel
|
||||
KF5::I18n
|
||||
Plasma::KWaylandServer
|
||||
KF5::WindowSystem
|
||||
target_link_libraries( testVirtualDesktops
|
||||
Qt5::Test
|
||||
Qt5::Widgets
|
||||
KF5::I18n
|
||||
KF5::GlobalAccel
|
||||
KF5::ConfigCore
|
||||
KF5::WindowSystem
|
||||
)
|
||||
add_test(NAME kwin-testVirtualDesktops COMMAND testVirtualDesktops)
|
||||
ecm_mark_as_test(testVirtualDesktops)
|
||||
|
@ -52,26 +50,23 @@ ecm_mark_as_test(testVirtualDesktops)
|
|||
########################################################
|
||||
# Test ClientMachine
|
||||
########################################################
|
||||
set(testClientMachine_SRCS
|
||||
../client_machine.cpp
|
||||
test_client_machine.cpp
|
||||
set( testClientMachine_SRCS
|
||||
test_client_machine.cpp
|
||||
../client_machine.cpp
|
||||
)
|
||||
add_executable(testClientMachine ${testClientMachine_SRCS})
|
||||
add_executable( testClientMachine ${testClientMachine_SRCS} )
|
||||
set_target_properties(testClientMachine PROPERTIES COMPILE_DEFINITIONS "NO_NONE_WINDOW")
|
||||
|
||||
target_link_libraries(testClientMachine
|
||||
Qt5::Concurrent
|
||||
Qt5::Test
|
||||
Qt5::Widgets
|
||||
Qt5::X11Extras
|
||||
|
||||
KF5::ConfigCore
|
||||
KF5::WindowSystem
|
||||
|
||||
XCB::XCB
|
||||
XCB::XFIXES
|
||||
|
||||
${X11_X11_LIB} # to make jenkins happy
|
||||
target_link_libraries( testClientMachine
|
||||
Qt5::Concurrent
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
Qt5::Widgets
|
||||
KF5::ConfigCore
|
||||
KF5::WindowSystem
|
||||
XCB::XCB
|
||||
XCB::XFIXES
|
||||
${X11_X11_LIB} # to make jenkins happy
|
||||
)
|
||||
add_test(NAME kwin-testClientMachine COMMAND testClientMachine)
|
||||
ecm_mark_as_test(testClientMachine)
|
||||
|
@ -79,37 +74,33 @@ ecm_mark_as_test(testClientMachine)
|
|||
########################################################
|
||||
# Test XcbWrapper
|
||||
########################################################
|
||||
set(testXcbWrapper_SRCS
|
||||
test_xcb_wrapper.cpp
|
||||
set( testXcbWrapper_SRCS
|
||||
test_xcb_wrapper.cpp
|
||||
)
|
||||
add_executable(testXcbWrapper ${testXcbWrapper_SRCS})
|
||||
add_executable( testXcbWrapper ${testXcbWrapper_SRCS} )
|
||||
|
||||
target_link_libraries(testXcbWrapper
|
||||
Qt5::Test
|
||||
Qt5::Widgets
|
||||
Qt5::X11Extras
|
||||
|
||||
KF5::ConfigCore
|
||||
KF5::WindowSystem
|
||||
|
||||
XCB::XCB
|
||||
target_link_libraries( testXcbWrapper
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
Qt5::Widgets
|
||||
KF5::ConfigCore
|
||||
KF5::WindowSystem
|
||||
XCB::XCB
|
||||
)
|
||||
add_test(NAME kwin-testXcbWrapper COMMAND testXcbWrapper)
|
||||
ecm_mark_as_test(testXcbWrapper)
|
||||
|
||||
if (XCB_ICCCM_FOUND)
|
||||
add_executable(testXcbSizeHints test_xcb_size_hints.cpp)
|
||||
add_executable( testXcbSizeHints test_xcb_size_hints.cpp )
|
||||
set_target_properties(testXcbSizeHints PROPERTIES COMPILE_DEFINITIONS "NO_NONE_WINDOW")
|
||||
target_link_libraries(testXcbSizeHints
|
||||
Qt5::Test
|
||||
Qt5::Widgets
|
||||
Qt5::X11Extras
|
||||
|
||||
KF5::ConfigCore
|
||||
KF5::WindowSystem
|
||||
|
||||
XCB::ICCCM
|
||||
XCB::XCB
|
||||
target_link_libraries( testXcbSizeHints
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
Qt5::Widgets
|
||||
KF5::ConfigCore
|
||||
KF5::WindowSystem
|
||||
XCB::XCB
|
||||
XCB::ICCCM
|
||||
)
|
||||
add_test(NAME kwin-testXcbSizeHints COMMAND testXcbSizeHints)
|
||||
ecm_mark_as_test(testXcbSizeHints)
|
||||
|
@ -118,20 +109,18 @@ endif()
|
|||
########################################################
|
||||
# Test XcbWindow
|
||||
########################################################
|
||||
set(testXcbWindow_SRCS
|
||||
test_xcb_window.cpp
|
||||
set( testXcbWindow_SRCS
|
||||
test_xcb_window.cpp
|
||||
)
|
||||
add_executable(testXcbWindow ${testXcbWindow_SRCS})
|
||||
add_executable( testXcbWindow ${testXcbWindow_SRCS} )
|
||||
|
||||
target_link_libraries(testXcbWindow
|
||||
Qt5::Test
|
||||
Qt5::Widgets
|
||||
Qt5::X11Extras
|
||||
|
||||
KF5::ConfigCore
|
||||
KF5::WindowSystem
|
||||
|
||||
XCB::XCB
|
||||
target_link_libraries( testXcbWindow
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
Qt5::Widgets
|
||||
KF5::ConfigCore
|
||||
KF5::WindowSystem
|
||||
XCB::XCB
|
||||
)
|
||||
add_test(NAME kwin-testXcbWindow COMMAND testXcbWindow)
|
||||
ecm_mark_as_test(testXcbWindow)
|
||||
|
@ -139,21 +128,19 @@ ecm_mark_as_test(testXcbWindow)
|
|||
########################################################
|
||||
# Test BuiltInEffectLoader
|
||||
########################################################
|
||||
set(testBuiltInEffectLoader_SRCS
|
||||
../effectloader.cpp
|
||||
mock_effectshandler.cpp
|
||||
set( testBuiltInEffectLoader_SRCS
|
||||
test_builtin_effectloader.cpp
|
||||
mock_effectshandler.cpp
|
||||
../effectloader.cpp
|
||||
)
|
||||
add_executable(testBuiltInEffectLoader ${testBuiltInEffectLoader_SRCS})
|
||||
add_executable( testBuiltInEffectLoader ${testBuiltInEffectLoader_SRCS})
|
||||
set_target_properties(testBuiltInEffectLoader PROPERTIES COMPILE_DEFINITIONS "NO_NONE_WINDOW")
|
||||
|
||||
target_link_libraries(testBuiltInEffectLoader
|
||||
Qt5::Concurrent
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
|
||||
KF5::Package
|
||||
|
||||
kwineffects
|
||||
kwin4_effect_builtins
|
||||
)
|
||||
|
@ -164,22 +151,23 @@ ecm_mark_as_test(testBuiltInEffectLoader)
|
|||
########################################################
|
||||
# Test ScriptedEffectLoader
|
||||
########################################################
|
||||
include_directories(${KWin_SOURCE_DIR})
|
||||
set(testScriptedEffectLoader_SRCS
|
||||
../effectloader.cpp
|
||||
../cursor.cpp
|
||||
../screens.cpp
|
||||
../scripting/scriptedeffect.cpp
|
||||
../scripting/scripting_logging.cpp
|
||||
../scripting/scriptingutils.cpp
|
||||
include_directories(${KWIN_SOURCE_DIR})
|
||||
set( testScriptedEffectLoader_SRCS
|
||||
test_scripted_effectloader.cpp
|
||||
mock_abstract_client.cpp
|
||||
mock_effectshandler.cpp
|
||||
mock_screens.cpp
|
||||
mock_workspace.cpp
|
||||
test_scripted_effectloader.cpp
|
||||
../effectloader.cpp
|
||||
../scripting/scriptedeffect.cpp
|
||||
../scripting/scriptingutils.cpp
|
||||
../scripting/scripting_logging.cpp
|
||||
../screens.cpp
|
||||
../orientation_sensor.cpp
|
||||
)
|
||||
kconfig_add_kcfg_files(testScriptedEffectLoader_SRCS ../settings.kcfgc)
|
||||
add_executable(testScriptedEffectLoader ${testScriptedEffectLoader_SRCS})
|
||||
qt5_add_dbus_adaptor( testScriptedEffectLoader_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../org.kde.kwin.OrientationSensor.xml ${CMAKE_CURRENT_SOURCE_DIR}/../orientation_sensor.h KWin::OrientationSensor)
|
||||
add_executable( testScriptedEffectLoader ${testScriptedEffectLoader_SRCS})
|
||||
|
||||
target_link_libraries(testScriptedEffectLoader
|
||||
Qt5::Concurrent
|
||||
|
@ -188,13 +176,11 @@ target_link_libraries(testScriptedEffectLoader
|
|||
Qt5::Sensors
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
|
||||
KF5::ConfigGui
|
||||
KF5::GlobalAccel
|
||||
KF5::I18n
|
||||
KF5::Notifications
|
||||
KF5::Package
|
||||
|
||||
kwineffects
|
||||
kwin4_effect_builtins
|
||||
)
|
||||
|
@ -205,20 +191,18 @@ ecm_mark_as_test(testScriptedEffectLoader)
|
|||
########################################################
|
||||
# Test PluginEffectLoader
|
||||
########################################################
|
||||
set(testPluginEffectLoader_SRCS
|
||||
../effectloader.cpp
|
||||
mock_effectshandler.cpp
|
||||
set( testPluginEffectLoader_SRCS
|
||||
test_plugin_effectloader.cpp
|
||||
mock_effectshandler.cpp
|
||||
../effectloader.cpp
|
||||
)
|
||||
add_executable(testPluginEffectLoader ${testPluginEffectLoader_SRCS})
|
||||
add_executable( testPluginEffectLoader ${testPluginEffectLoader_SRCS})
|
||||
|
||||
target_link_libraries(testPluginEffectLoader
|
||||
Qt5::Concurrent
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
|
||||
KF5::Package
|
||||
|
||||
kwineffects
|
||||
kwin4_effect_builtins
|
||||
)
|
||||
|
@ -243,61 +227,102 @@ target_link_libraries(effectversionplugin kwineffects)
|
|||
########################################################
|
||||
# Test Screens
|
||||
########################################################
|
||||
set(testScreens_SRCS
|
||||
../screens.cpp
|
||||
../cursor.cpp
|
||||
../x11eventfilter.cpp
|
||||
set( testScreens_SRCS
|
||||
test_screens.cpp
|
||||
mock_abstract_client.cpp
|
||||
mock_client.cpp
|
||||
mock_screens.cpp
|
||||
mock_workspace.cpp
|
||||
mock_x11client.cpp
|
||||
test_screens.cpp
|
||||
../screens.cpp
|
||||
../x11eventfilter.cpp
|
||||
../orientation_sensor.cpp
|
||||
)
|
||||
kconfig_add_kcfg_files(testScreens_SRCS ../settings.kcfgc)
|
||||
qt5_add_dbus_adaptor( testScreens_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../org.kde.kwin.OrientationSensor.xml ${CMAKE_CURRENT_SOURCE_DIR}/../orientation_sensor.h KWin::OrientationSensor)
|
||||
|
||||
add_executable(testScreens ${testScreens_SRCS})
|
||||
add_executable( testScreens ${testScreens_SRCS})
|
||||
target_include_directories(testScreens BEFORE PRIVATE ./)
|
||||
target_link_libraries(testScreens
|
||||
Qt5::DBus
|
||||
Qt5::Sensors
|
||||
Qt5::Test
|
||||
Qt5::Widgets
|
||||
Qt5::X11Extras
|
||||
|
||||
Qt5::Widgets
|
||||
KF5::ConfigCore
|
||||
KF5::ConfigGui
|
||||
KF5::I18n
|
||||
KF5::Notifications
|
||||
KF5::WindowSystem
|
||||
|
||||
XCB::XCB #for xcbutils.h
|
||||
)
|
||||
|
||||
add_test(NAME kwin_testScreens COMMAND testScreens)
|
||||
ecm_mark_as_test(testScreens)
|
||||
|
||||
########################################################
|
||||
# Test XrandRScreens
|
||||
########################################################
|
||||
set( testXRandRScreens_SRCS
|
||||
test_xrandr_screens.cpp
|
||||
mock_abstract_client.cpp
|
||||
mock_client.cpp
|
||||
mock_screens.cpp
|
||||
mock_workspace.cpp
|
||||
../screens.cpp
|
||||
../plugins/platforms/x11/standalone/screens_xrandr.cpp
|
||||
../xcbutils.cpp # init of extensions
|
||||
../x11eventfilter.cpp
|
||||
../orientation_sensor.cpp
|
||||
)
|
||||
kconfig_add_kcfg_files(testXRandRScreens_SRCS ../settings.kcfgc)
|
||||
qt5_add_dbus_adaptor( testXRandRScreens_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../org.kde.kwin.OrientationSensor.xml ${CMAKE_CURRENT_SOURCE_DIR}/../orientation_sensor.h KWin::OrientationSensor)
|
||||
add_executable( testXRandRScreens ${testXRandRScreens_SRCS} )
|
||||
target_link_libraries( testXRandRScreens
|
||||
Qt5::Test
|
||||
Qt5::DBus
|
||||
Qt5::Gui
|
||||
Qt5::Sensors
|
||||
Qt5::Widgets
|
||||
KF5::ConfigCore
|
||||
KF5::ConfigGui
|
||||
KF5::I18n
|
||||
KF5::Notifications
|
||||
KF5::WindowSystem
|
||||
XCB::XCB
|
||||
XCB::RANDR
|
||||
XCB::XFIXES
|
||||
XCB::SYNC
|
||||
XCB::COMPOSITE
|
||||
XCB::DAMAGE
|
||||
XCB::GLX
|
||||
XCB::SHM
|
||||
)
|
||||
|
||||
add_test(NAME kwin-testXRandRScreens COMMAND testXRandRScreens)
|
||||
ecm_mark_as_test(testXRandRScreens)
|
||||
|
||||
########################################################
|
||||
# Test ScreenEdges
|
||||
########################################################
|
||||
set(testScreenEdges_SRCS
|
||||
../atoms.cpp
|
||||
../gestures.cpp
|
||||
../plugins/platforms/x11/standalone/edge.cpp
|
||||
../screenedge.cpp
|
||||
../screens.cpp
|
||||
../virtualdesktops.cpp
|
||||
../cursor.cpp
|
||||
../xcbutils.cpp # init of extensions
|
||||
set( testScreenEdges_SRCS
|
||||
test_screen_edges.cpp
|
||||
mock_abstract_client.cpp
|
||||
mock_client.cpp
|
||||
mock_screens.cpp
|
||||
mock_workspace.cpp
|
||||
mock_x11client.cpp
|
||||
test_screen_edges.cpp
|
||||
../atoms.cpp
|
||||
../gestures.cpp
|
||||
../screens.cpp
|
||||
../screenedge.cpp
|
||||
../virtualdesktops.cpp
|
||||
../xcbutils.cpp # init of extensions
|
||||
../plugins/platforms/x11/standalone/edge.cpp
|
||||
../orientation_sensor.cpp
|
||||
)
|
||||
kconfig_add_kcfg_files(testScreenEdges_SRCS ../settings.kcfgc)
|
||||
qt5_add_dbus_interface(testScreenEdges_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf5_org.freedesktop.ScreenSaver.xml screenlocker_interface )
|
||||
qt5_add_dbus_interface( testScreenEdges_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../org.freedesktop.ScreenSaver.xml screenlocker_interface)
|
||||
qt5_add_dbus_adaptor( testScreenEdges_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../org.kde.kwin.OrientationSensor.xml ${CMAKE_CURRENT_SOURCE_DIR}/../orientation_sensor.h KWin::OrientationSensor)
|
||||
|
||||
add_executable(testScreenEdges ${testScreenEdges_SRCS})
|
||||
add_executable( testScreenEdges ${testScreenEdges_SRCS})
|
||||
set_target_properties(testScreenEdges PROPERTIES COMPILE_DEFINITIONS "NO_NONE_WINDOW")
|
||||
target_include_directories(testScreenEdges BEFORE PRIVATE ./)
|
||||
target_link_libraries(testScreenEdges
|
||||
|
@ -305,23 +330,20 @@ target_link_libraries(testScreenEdges
|
|||
Qt5::Sensors
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
|
||||
KF5::ConfigCore
|
||||
KF5::ConfigGui
|
||||
KF5::GlobalAccel
|
||||
KF5::I18n
|
||||
KF5::GlobalAccel
|
||||
KF5::Notifications
|
||||
Plasma::KWaylandServer
|
||||
KF5::WindowSystem
|
||||
|
||||
XCB::XCB
|
||||
XCB::RANDR
|
||||
XCB::XFIXES
|
||||
XCB::SYNC
|
||||
XCB::COMPOSITE
|
||||
XCB::DAMAGE
|
||||
XCB::GLX
|
||||
XCB::RANDR
|
||||
XCB::SHM
|
||||
XCB::SYNC
|
||||
XCB::XCB
|
||||
XCB::XFIXES
|
||||
)
|
||||
|
||||
add_test(NAME kwin_testScreenEdges COMMAND testScreenEdges)
|
||||
|
@ -330,19 +352,17 @@ ecm_mark_as_test(testScreenEdges)
|
|||
########################################################
|
||||
# Test OnScreenNotification
|
||||
########################################################
|
||||
set(testOnScreenNotification_SRCS
|
||||
../input_event_spy.cpp
|
||||
../onscreennotification.cpp
|
||||
set( testOnScreenNotification_SRCS
|
||||
onscreennotificationtest.cpp
|
||||
../onscreennotification.cpp
|
||||
../input_event_spy.cpp
|
||||
)
|
||||
add_executable(testOnScreenNotification ${testOnScreenNotification_SRCS})
|
||||
add_executable( testOnScreenNotification ${testOnScreenNotification_SRCS})
|
||||
|
||||
target_link_libraries(testOnScreenNotification
|
||||
Qt5::DBus
|
||||
Qt5::Quick
|
||||
Qt5::Test
|
||||
Qt5::Widgets # QAction include
|
||||
|
||||
Qt5::Quick
|
||||
KF5::ConfigCore
|
||||
)
|
||||
|
||||
|
@ -352,11 +372,11 @@ ecm_mark_as_test(testOnScreenNotification)
|
|||
########################################################
|
||||
# Test Gestures
|
||||
########################################################
|
||||
set(testGestures_SRCS
|
||||
../gestures.cpp
|
||||
set( testGestures_SRCS
|
||||
test_gestures.cpp
|
||||
../gestures.cpp
|
||||
)
|
||||
add_executable(testGestures ${testGestures_SRCS})
|
||||
add_executable( testGestures ${testGestures_SRCS})
|
||||
|
||||
target_link_libraries(testGestures
|
||||
Qt5::Test
|
||||
|
@ -370,20 +390,20 @@ ecm_mark_as_test(testGestures)
|
|||
########################################################
|
||||
add_executable(testX11TimestampUpdate test_x11_timestamp_update.cpp)
|
||||
target_link_libraries(testX11TimestampUpdate
|
||||
KF5::CoreAddons
|
||||
Qt5::Test
|
||||
KF5::CoreAddons
|
||||
kwin
|
||||
)
|
||||
add_test(NAME kwin-testX11TimestampUpdate COMMAND testX11TimestampUpdate)
|
||||
ecm_mark_as_test(testX11TimestampUpdate)
|
||||
|
||||
set(testOpenGLContextAttributeBuilder_SRCS
|
||||
opengl_context_attribute_builder_test.cpp
|
||||
../abstract_opengl_context_attribute_builder.cpp
|
||||
../egl_context_attribute_builder.cpp
|
||||
opengl_context_attribute_builder_test.cpp
|
||||
)
|
||||
|
||||
if (HAVE_EPOXY_GLX)
|
||||
if(HAVE_EPOXY_GLX)
|
||||
set(testOpenGLContextAttributeBuilder_SRCS ${testOpenGLContextAttributeBuilder_SRCS} ../plugins/platforms/x11/standalone/glx_context_attribute_builder.cpp)
|
||||
endif()
|
||||
add_executable(testOpenGLContextAttributeBuilder ${testOpenGLContextAttributeBuilder_SRCS})
|
||||
|
@ -392,25 +412,23 @@ add_test(NAME kwin-testOpenGLContextAttributeBuilder COMMAND testOpenGLContextAt
|
|||
ecm_mark_as_test(testOpenGLContextAttributeBuilder)
|
||||
|
||||
set(testXkb_SRCS
|
||||
../xkb.cpp
|
||||
test_xkb.cpp
|
||||
../xkb.cpp
|
||||
)
|
||||
add_executable(testXkb ${testXkb_SRCS})
|
||||
target_link_libraries(testXkb
|
||||
Qt5::Gui
|
||||
Qt5::Test
|
||||
Qt5::Gui
|
||||
Qt5::Widgets
|
||||
|
||||
KF5::ConfigCore
|
||||
Plasma::KWaylandServer
|
||||
KF5::WindowSystem
|
||||
|
||||
KF5::WaylandServer
|
||||
XKB::XKB
|
||||
)
|
||||
add_test(NAME kwin-testXkb COMMAND testXkb)
|
||||
ecm_mark_as_test(testXkb)
|
||||
|
||||
if (HAVE_GBM)
|
||||
if(HAVE_GBM)
|
||||
add_executable(testGbmSurface test_gbm_surface.cpp ../plugins/platforms/drm/gbm_surface.cpp)
|
||||
target_link_libraries(testGbmSurface Qt5::Test)
|
||||
add_test(NAME kwin-testGbmSurface COMMAND testGbmSurface)
|
||||
|
@ -419,8 +437,9 @@ endif()
|
|||
|
||||
add_executable(testVirtualKeyboardDBus test_virtualkeyboard_dbus.cpp ../virtualkeyboard_dbus.cpp)
|
||||
target_link_libraries(testVirtualKeyboardDBus
|
||||
Qt5::DBus
|
||||
Qt5::Test
|
||||
Qt5::DBus
|
||||
)
|
||||
add_test(NAME kwin-testVirtualKeyboardDBus COMMAND testVirtualKeyboardDBus)
|
||||
ecm_mark_as_test(testVirtualKeyboardDBus)
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "mock_client.h"
|
|
@ -1,11 +1,22 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "mock_drm.h"
|
||||
|
||||
#include <QMap>
|
||||
|
|
|
@ -1,14 +1,25 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <xf86drmMode.h>
|
||||
|
||||
#include <QVector>
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "mock_drm.h"
|
||||
#include "../../plugins/platforms/drm/drm_object.h"
|
||||
#include <QtTest>
|
||||
|
@ -114,8 +125,7 @@ void ObjectTest::testFd()
|
|||
|
||||
namespace KWin
|
||||
{
|
||||
class DrmOutput {
|
||||
public:
|
||||
struct DrmOutput {
|
||||
int foo;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include <kwineffects.h>
|
||||
|
||||
namespace KWin
|
||||
|
@ -16,7 +27,7 @@ class FakeEffect : public Effect
|
|||
Q_OBJECT
|
||||
public:
|
||||
FakeEffect() {}
|
||||
~FakeEffect() override {}
|
||||
virtual ~FakeEffect() {}
|
||||
|
||||
static bool supported() {
|
||||
return effects->isOpenGLCompositing();
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include <kwineffects.h>
|
||||
|
||||
namespace KWin
|
||||
|
@ -16,7 +27,7 @@ class FakeVersionEffect : public Effect
|
|||
Q_OBJECT
|
||||
public:
|
||||
FakeVersionEffect() {}
|
||||
~FakeVersionEffect() override {}
|
||||
virtual ~FakeVersionEffect() {}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -28,7 +39,7 @@ class FakeEffectPluginFactory : public KWin::EffectPluginFactory
|
|||
Q_INTERFACES(KPluginFactory)
|
||||
public:
|
||||
FakeEffectPluginFactory() {}
|
||||
~FakeEffectPluginFactory() override {}
|
||||
~FakeEffectPluginFactory() {}
|
||||
KWin::Effect *createEffect() const override {
|
||||
return new KWin::FakeVersionEffect();
|
||||
}
|
||||
|
|
|
@ -1,32 +1,7 @@
|
|||
add_subdirectory(helper)
|
||||
|
||||
set(KWinIntegrationTestFramework_SOURCES
|
||||
../../cursor.cpp
|
||||
|
||||
generic_scene_opengl_test.cpp
|
||||
kwin_wayland_test.cpp
|
||||
test_helpers.cpp
|
||||
|
||||
${kwin_XWAYLAND_SRCS}
|
||||
)
|
||||
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
|
||||
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml
|
||||
BASENAME input-method-unstable-v1
|
||||
)
|
||||
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
|
||||
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v3.xml
|
||||
BASENAME text-input-unstable-v3
|
||||
)
|
||||
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
|
||||
PROTOCOL protocols/wlr-layer-shell-unstable-v1.xml
|
||||
BASENAME wlr-layer-shell-unstable-v1
|
||||
)
|
||||
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
|
||||
PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
|
||||
BASENAME xdg-shell
|
||||
)
|
||||
add_library(KWinIntegrationTestFramework STATIC ${KWinIntegrationTestFramework_SOURCES})
|
||||
target_link_libraries(KWinIntegrationTestFramework kwin Qt5::Test Wayland::Client)
|
||||
add_library(KWinIntegrationTestFramework STATIC kwin_wayland_test.cpp test_helpers.cpp)
|
||||
target_link_libraries(KWinIntegrationTestFramework kwin Qt5::Test)
|
||||
|
||||
function(integrationTest)
|
||||
set(optionArgs WAYLAND_ONLY)
|
||||
|
@ -37,13 +12,15 @@ function(integrationTest)
|
|||
target_link_libraries(${ARGS_NAME} KWinIntegrationTestFramework kwin Qt5::Test ${ARGS_LIBS})
|
||||
add_test(NAME kwin-${ARGS_NAME} COMMAND dbus-run-session ${CMAKE_BINARY_DIR}/bin/${ARGS_NAME})
|
||||
if (${ARGS_WAYLAND_ONLY})
|
||||
add_executable(${ARGS_NAME}_waylandonly ${ARGS_SRCS} )
|
||||
add_executable(${ARGS_NAME}_waylandonly ${ARGS_SRCS})
|
||||
set_target_properties(${ARGS_NAME}_waylandonly PROPERTIES COMPILE_DEFINITIONS "NO_XWAYLAND")
|
||||
target_link_libraries(${ARGS_NAME}_waylandonly KWinIntegrationTestFramework kwin Qt5::Test ${ARGS_LIBS})
|
||||
add_test(NAME kwin-${ARGS_NAME}-waylandonly COMMAND dbus-run-session ${CMAKE_BINARY_DIR}/bin/${ARGS_NAME}_waylandonly)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
integrationTest(WAYLAND_ONLY NAME testStart SRCS start_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testTransientNoInput SRCS transient_no_input_test.cpp)
|
||||
integrationTest(NAME testDontCrashGlxgears SRCS dont_crash_glxgears.cpp)
|
||||
integrationTest(NAME testLockScreen SRCS lockscreen.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testDecorationInput SRCS decoration_input_test.cpp)
|
||||
|
@ -53,17 +30,17 @@ integrationTest(WAYLAND_ONLY NAME testInputStackingOrder SRCS input_stacking_ord
|
|||
integrationTest(NAME testPointerInput SRCS pointer_input.cpp)
|
||||
integrationTest(NAME testPlatformCursor SRCS platformcursor.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testDontCrashCancelAnimation SRCS dont_crash_cancel_animation.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testTransientPlacement SRCS transient_placement.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testTransientPlacmenet SRCS transient_placement.cpp)
|
||||
integrationTest(NAME testDebugConsole SRCS debug_console_test.cpp)
|
||||
integrationTest(NAME testDontCrashEmptyDeco SRCS dont_crash_empty_deco.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testPlasmaSurface SRCS plasma_surface_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testMaximized SRCS maximize_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testXdgShellClient SRCS xdgshellclient_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testShellClient SRCS shell_client_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testDontCrashNoBorder SRCS dont_crash_no_border.cpp)
|
||||
integrationTest(NAME testXwaylandSelections SRCS xwayland_selections_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testSceneOpenGL SRCS scene_opengl_test.cpp )
|
||||
integrationTest(NAME testXClipboardSync SRCS xclipboardsync_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testSceneOpenGL SRCS scene_opengl_test.cpp generic_scene_opengl_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testSceneOpenGLShadow SRCS scene_opengl_shadow_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testSceneOpenGLES SRCS scene_opengl_es_test.cpp )
|
||||
integrationTest(WAYLAND_ONLY NAME testSceneOpenGLES SRCS scene_opengl_es_test.cpp generic_scene_opengl_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testNoXdgRuntimeDir SRCS no_xdg_runtime_dir_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testScreenChanges SRCS screen_changes_test.cpp)
|
||||
integrationTest(NAME testModiferOnlyShortcut SRCS modifier_only_shortcut_test.cpp)
|
||||
|
@ -75,18 +52,11 @@ integrationTest(WAYLAND_ONLY NAME testKeymapCreationFailure SRCS keymap_creation
|
|||
integrationTest(WAYLAND_ONLY NAME testShowingDesktop SRCS showing_desktop_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testDontCrashUseractionsMenu SRCS dont_crash_useractions_menu.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testKWinBindings SRCS kwinbindings_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testLayerShellV1Client SRCS layershellv1client_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testVirtualDesktop SRCS virtual_desktop_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testXdgShellClientRules SRCS xdgshellclient_rules_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testShellClientRules SRCS shell_client_rules_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testIdleInhibition SRCS idle_inhibition_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testColorCorrectNightColor SRCS colorcorrect_nightcolor_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testDontCrashCursorPhysicalSizeEmpty SRCS dont_crash_cursor_physical_size_empty.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testDontCrashReinitializeCompositor SRCS dont_crash_reinitialize_compositor.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testNoGlobalShortcuts SRCS no_global_shortcuts_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testBufferSizeChange SRCS buffer_size_change_test.cpp )
|
||||
integrationTest(WAYLAND_ONLY NAME testPlacement SRCS placement_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testActivation SRCS activation_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testInputMethod SRCS inputmethod_test.cpp)
|
||||
|
||||
if (XCB_ICCCM_FOUND)
|
||||
integrationTest(NAME testMoveResize SRCS move_resize_window_test.cpp LIBS XCB::ICCCM)
|
||||
|
@ -103,10 +73,6 @@ if (XCB_ICCCM_FOUND)
|
|||
integrationTest(NAME testGlobalShortcuts SRCS globalshortcuts_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testSceneQPainter SRCS scene_qpainter_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testSceneQPainterShadow SRCS scene_qpainter_shadow_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testStackingOrder SRCS stacking_order_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testDbusInterface SRCS dbus_interface_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testXwaylandServerCrash SRCS xwaylandserver_crash_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testXwaylandServerRestart SRCS xwaylandserver_restart_test.cpp LIBS XCB::ICCCM)
|
||||
|
||||
if (KWIN_BUILD_ACTIVITIES)
|
||||
integrationTest(NAME testActivities SRCS activities_test.cpp LIBS XCB::ICCCM)
|
||||
|
|
|
@ -1,573 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "abstract_client.h"
|
||||
#include "cursor.h"
|
||||
#include "platform.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_activation-0");
|
||||
|
||||
class ActivationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testSwitchToWindowToLeft();
|
||||
void testSwitchToWindowToRight();
|
||||
void testSwitchToWindowAbove();
|
||||
void testSwitchToWindowBelow();
|
||||
void testSwitchToWindowMaximized();
|
||||
void testSwitchToWindowFullScreen();
|
||||
|
||||
private:
|
||||
void stackScreensHorizontally();
|
||||
void stackScreensVertically();
|
||||
};
|
||||
|
||||
void ActivationTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<AbstractClient *>();
|
||||
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
waylandServer()->initWorkspace();
|
||||
}
|
||||
|
||||
void ActivationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void ActivationTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
|
||||
stackScreensHorizontally();
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowToLeft()
|
||||
{
|
||||
// This test verifies that "Switch to Window to the Left" shortcut works.
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensHorizontally();
|
||||
|
||||
// Create several clients on the left screen.
|
||||
QScopedPointer<Surface> surface1(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
|
||||
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client1);
|
||||
QVERIFY(client1->isActive());
|
||||
|
||||
QScopedPointer<Surface> surface2(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
|
||||
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client2);
|
||||
QVERIFY(client2->isActive());
|
||||
|
||||
client1->move(QPoint(300, 200));
|
||||
client2->move(QPoint(500, 200));
|
||||
|
||||
// Create several clients on the right screen.
|
||||
QScopedPointer<Surface> surface3(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
|
||||
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client3);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
QScopedPointer<Surface> surface4(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
|
||||
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client4);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
client3->move(QPoint(1380, 200));
|
||||
client4->move(QPoint(1580, 200));
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(client2->isActive());
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(client1->isActive());
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
// Destroy all clients.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client4));
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowToRight()
|
||||
{
|
||||
// This test verifies that "Switch to Window to the Right" shortcut works.
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensHorizontally();
|
||||
|
||||
// Create several clients on the left screen.
|
||||
QScopedPointer<Surface> surface1(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
|
||||
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client1);
|
||||
QVERIFY(client1->isActive());
|
||||
|
||||
QScopedPointer<Surface> surface2(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
|
||||
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client2);
|
||||
QVERIFY(client2->isActive());
|
||||
|
||||
client1->move(QPoint(300, 200));
|
||||
client2->move(QPoint(500, 200));
|
||||
|
||||
// Create several clients on the right screen.
|
||||
QScopedPointer<Surface> surface3(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
|
||||
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client3);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
QScopedPointer<Surface> surface4(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
|
||||
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client4);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
client3->move(QPoint(1380, 200));
|
||||
client4->move(QPoint(1580, 200));
|
||||
|
||||
// Switch to window to the right.
|
||||
workspace()->switchWindow(Workspace::DirectionEast);
|
||||
QVERIFY(client1->isActive());
|
||||
|
||||
// Switch to window to the right.
|
||||
workspace()->switchWindow(Workspace::DirectionEast);
|
||||
QVERIFY(client2->isActive());
|
||||
|
||||
// Switch to window to the right.
|
||||
workspace()->switchWindow(Workspace::DirectionEast);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
// Switch to window to the right.
|
||||
workspace()->switchWindow(Workspace::DirectionEast);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
// Destroy all clients.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client4));
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowAbove()
|
||||
{
|
||||
// This test verifies that "Switch to Window Above" shortcut works.
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensVertically();
|
||||
|
||||
// Create several clients on the top screen.
|
||||
QScopedPointer<Surface> surface1(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
|
||||
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client1);
|
||||
QVERIFY(client1->isActive());
|
||||
|
||||
QScopedPointer<Surface> surface2(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
|
||||
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client2);
|
||||
QVERIFY(client2->isActive());
|
||||
|
||||
client1->move(QPoint(200, 300));
|
||||
client2->move(QPoint(200, 500));
|
||||
|
||||
// Create several clients on the bottom screen.
|
||||
QScopedPointer<Surface> surface3(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
|
||||
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client3);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
QScopedPointer<Surface> surface4(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
|
||||
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client4);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
client3->move(QPoint(200, 1224));
|
||||
client4->move(QPoint(200, 1424));
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(client2->isActive());
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(client1->isActive());
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
// Destroy all clients.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client4));
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowBelow()
|
||||
{
|
||||
// This test verifies that "Switch to Window Bottom" shortcut works.
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensVertically();
|
||||
|
||||
// Create several clients on the top screen.
|
||||
QScopedPointer<Surface> surface1(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
|
||||
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client1);
|
||||
QVERIFY(client1->isActive());
|
||||
|
||||
QScopedPointer<Surface> surface2(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
|
||||
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client2);
|
||||
QVERIFY(client2->isActive());
|
||||
|
||||
client1->move(QPoint(200, 300));
|
||||
client2->move(QPoint(200, 500));
|
||||
|
||||
// Create several clients on the bottom screen.
|
||||
QScopedPointer<Surface> surface3(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
|
||||
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client3);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
QScopedPointer<Surface> surface4(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
|
||||
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client4);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
client3->move(QPoint(200, 1224));
|
||||
client4->move(QPoint(200, 1424));
|
||||
|
||||
// Switch to window below.
|
||||
workspace()->switchWindow(Workspace::DirectionSouth);
|
||||
QVERIFY(client1->isActive());
|
||||
|
||||
// Switch to window below.
|
||||
workspace()->switchWindow(Workspace::DirectionSouth);
|
||||
QVERIFY(client2->isActive());
|
||||
|
||||
// Switch to window below.
|
||||
workspace()->switchWindow(Workspace::DirectionSouth);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
// Switch to window below.
|
||||
workspace()->switchWindow(Workspace::DirectionSouth);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
// Destroy all clients.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client4));
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowMaximized()
|
||||
{
|
||||
// This test verifies that we switch to the top-most maximized client, i.e.
|
||||
// the one that user sees at the moment. See bug 411356.
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensHorizontally();
|
||||
|
||||
// Create several maximized clients on the left screen.
|
||||
QScopedPointer<Surface> surface1(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
|
||||
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client1);
|
||||
QVERIFY(client1->isActive());
|
||||
QSignalSpy configureRequestedSpy1(shellSurface1.data(), &XdgShellSurface::configureRequested);
|
||||
QVERIFY(configureRequestedSpy1.wait());
|
||||
workspace()->slotWindowMaximize();
|
||||
QVERIFY(configureRequestedSpy1.wait());
|
||||
QSignalSpy frameGeometryChangedSpy1(client1, &AbstractClient::frameGeometryChanged);
|
||||
QVERIFY(frameGeometryChangedSpy1.isValid());
|
||||
shellSurface1->ackConfigure(configureRequestedSpy1.last().at(2).value<quint32>());
|
||||
Test::render(surface1.data(), configureRequestedSpy1.last().at(0).toSize(), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy1.wait());
|
||||
|
||||
QScopedPointer<Surface> surface2(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
|
||||
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client2);
|
||||
QVERIFY(client2->isActive());
|
||||
QSignalSpy configureRequestedSpy2(shellSurface2.data(), &XdgShellSurface::configureRequested);
|
||||
QVERIFY(configureRequestedSpy2.wait());
|
||||
workspace()->slotWindowMaximize();
|
||||
QVERIFY(configureRequestedSpy2.wait());
|
||||
QSignalSpy frameGeometryChangedSpy2(client2, &AbstractClient::frameGeometryChanged);
|
||||
QVERIFY(frameGeometryChangedSpy2.isValid());
|
||||
shellSurface2->ackConfigure(configureRequestedSpy2.last().at(2).value<quint32>());
|
||||
Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy2.wait());
|
||||
|
||||
const QList<Toplevel *> stackingOrder = workspace()->stackingOrder();
|
||||
QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2));
|
||||
QCOMPARE(client1->maximizeMode(), MaximizeFull);
|
||||
QCOMPARE(client2->maximizeMode(), MaximizeFull);
|
||||
|
||||
// Create several clients on the right screen.
|
||||
QScopedPointer<Surface> surface3(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
|
||||
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client3);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
QScopedPointer<Surface> surface4(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
|
||||
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client4);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
client3->move(QPoint(1380, 200));
|
||||
client4->move(QPoint(1580, 200));
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(client2->isActive());
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
// Destroy all clients.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client4));
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowFullScreen()
|
||||
{
|
||||
// This test verifies that we switch to the top-most fullscreen client, i.e.
|
||||
// the one that user sees at the moment. See bug 411356.
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensVertically();
|
||||
|
||||
// Create several maximized clients on the top screen.
|
||||
QScopedPointer<Surface> surface1(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
|
||||
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client1);
|
||||
QVERIFY(client1->isActive());
|
||||
QSignalSpy configureRequestedSpy1(shellSurface1.data(), &XdgShellSurface::configureRequested);
|
||||
QVERIFY(configureRequestedSpy1.wait());
|
||||
workspace()->slotWindowFullScreen();
|
||||
QVERIFY(configureRequestedSpy1.wait());
|
||||
QSignalSpy frameGeometryChangedSpy1(client1, &AbstractClient::frameGeometryChanged);
|
||||
QVERIFY(frameGeometryChangedSpy1.isValid());
|
||||
shellSurface1->ackConfigure(configureRequestedSpy1.last().at(2).value<quint32>());
|
||||
Test::render(surface1.data(), configureRequestedSpy1.last().at(0).toSize(), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy1.wait());
|
||||
|
||||
QScopedPointer<Surface> surface2(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
|
||||
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client2);
|
||||
QVERIFY(client2->isActive());
|
||||
QSignalSpy configureRequestedSpy2(shellSurface2.data(), &XdgShellSurface::configureRequested);
|
||||
QVERIFY(configureRequestedSpy2.wait());
|
||||
workspace()->slotWindowFullScreen();
|
||||
QVERIFY(configureRequestedSpy2.wait());
|
||||
QSignalSpy frameGeometryChangedSpy2(client2, &AbstractClient::frameGeometryChanged);
|
||||
QVERIFY(frameGeometryChangedSpy2.isValid());
|
||||
shellSurface2->ackConfigure(configureRequestedSpy2.last().at(2).value<quint32>());
|
||||
Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy2.wait());
|
||||
|
||||
const QList<Toplevel *> stackingOrder = workspace()->stackingOrder();
|
||||
QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2));
|
||||
QVERIFY(client1->isFullScreen());
|
||||
QVERIFY(client2->isFullScreen());
|
||||
|
||||
// Create several clients on the bottom screen.
|
||||
QScopedPointer<Surface> surface3(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
|
||||
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client3);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
QScopedPointer<Surface> surface4(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
|
||||
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client4);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
client3->move(QPoint(200, 1224));
|
||||
client4->move(QPoint(200, 1424));
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(client3->isActive());
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(client2->isActive());
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(client4->isActive());
|
||||
|
||||
// Destroy all clients.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client4));
|
||||
}
|
||||
|
||||
void ActivationTest::stackScreensHorizontally()
|
||||
{
|
||||
// Process pending wl_output bind requests before destroying all outputs.
|
||||
QTest::qWait(1);
|
||||
|
||||
const QVector<QRect> screenGeometries {
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
};
|
||||
|
||||
const QVector<int> screenScales {
|
||||
1,
|
||||
1,
|
||||
};
|
||||
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(),
|
||||
"setVirtualOutputs",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int, screenGeometries.count()),
|
||||
Q_ARG(QVector<QRect>, screenGeometries),
|
||||
Q_ARG(QVector<int>, screenScales)
|
||||
);
|
||||
}
|
||||
|
||||
void ActivationTest::stackScreensVertically()
|
||||
{
|
||||
// Process pending wl_output bind requests before destroying all outputs.
|
||||
QTest::qWait(1);
|
||||
|
||||
const QVector<QRect> screenGeometries {
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(0, 1024, 1280, 1024),
|
||||
};
|
||||
|
||||
const QVector<int> screenScales {
|
||||
1,
|
||||
1,
|
||||
};
|
||||
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(),
|
||||
"setVirtualOutputs",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int, screenGeometries.count()),
|
||||
Q_ARG(QVector<QRect>, screenGeometries),
|
||||
Q_ARG(QVector<int>, screenScales)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::ActivationTest)
|
||||
#include "activation_test.moc"
|
|
@ -1,28 +1,36 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "platform.h"
|
||||
#include "activities.h"
|
||||
#include "x11client.h"
|
||||
#include "client.h"
|
||||
#include "cursor.h"
|
||||
#include "deleted.h"
|
||||
#include "screenedge.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "shell_client.h"
|
||||
#include "xcbutils.h"
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusPendingCall>
|
||||
|
||||
#include <netwm.h>
|
||||
#include <xcb/xcb_icccm.h>
|
||||
|
||||
|
@ -46,17 +54,18 @@ private:
|
|||
|
||||
void ActivitiesTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
qRegisterMetaType<KWin::Deleted*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->setUseKActivities(true);
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
|
@ -66,18 +75,13 @@ void ActivitiesTest::initTestCase()
|
|||
|
||||
void ActivitiesTest::cleanupTestCase()
|
||||
{
|
||||
// terminate any still running kactivitymanagerd
|
||||
QDBusConnection::sessionBus().asyncCall(QDBusMessage::createMethodCall(
|
||||
QStringLiteral("org.kde.ActivityManager"),
|
||||
QStringLiteral("/ActivityManager"),
|
||||
QStringLiteral("org.qtproject.Qt.QCoreApplication"),
|
||||
QStringLiteral("quit")));
|
||||
QProcess::execute(QStringLiteral("kactivitymanagerd"), QStringList{QStringLiteral("stop")});
|
||||
}
|
||||
|
||||
void ActivitiesTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void ActivitiesTest::cleanup()
|
||||
|
@ -94,7 +98,8 @@ struct XcbConnectionDeleter
|
|||
|
||||
void ActivitiesTest::testSetOnActivitiesValidates()
|
||||
{
|
||||
// this test verifies that windows can't be placed on activities that don't exist
|
||||
// this test creates a Client and sets it on activities which don't exist
|
||||
// that should result in the window being on all activities
|
||||
// create an xcb window
|
||||
QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
QVERIFY(!xcb_connection_has_error(c.data()));
|
||||
|
@ -121,7 +126,7 @@ void ActivitiesTest::testSetOnActivitiesValidates()
|
|||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded);
|
||||
QVERIFY(windowCreatedSpy.isValid());
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Client *client = windowCreatedSpy.first().first().value<X11Client *>();
|
||||
Client *client = windowCreatedSpy.first().first().value<Client*>();
|
||||
QVERIFY(client);
|
||||
QCOMPARE(client->window(), w);
|
||||
QVERIFY(client->isDecorated());
|
||||
|
@ -130,7 +135,13 @@ void ActivitiesTest::testSetOnActivitiesValidates()
|
|||
QVERIFY(!Activities::self()->all().contains(QStringLiteral("foo")));
|
||||
QVERIFY(!Activities::self()->all().contains(QStringLiteral("bar")));
|
||||
|
||||
//setting the client to an invalid activities should result in the client being on all activities
|
||||
client->setOnActivity(QStringLiteral("foo"), true);
|
||||
QVERIFY(client->isOnAllActivities());
|
||||
QVERIFY(!client->activities().contains(QLatin1String("foo")));
|
||||
|
||||
client->setOnActivities(QStringList{QStringLiteral("foo"), QStringLiteral("bar")});
|
||||
QVERIFY(client->isOnAllActivities());
|
||||
QVERIFY(!client->activities().contains(QLatin1String("foo")));
|
||||
QVERIFY(!client->activities().contains(QLatin1String("bar")));
|
||||
|
||||
|
@ -140,7 +151,7 @@ void ActivitiesTest::testSetOnActivitiesValidates()
|
|||
xcb_flush(c.data());
|
||||
c.reset();
|
||||
|
||||
QSignalSpy windowClosedSpy(client, &X11Client::windowClosed);
|
||||
QSignalSpy windowClosedSpy(client, &Client::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
}
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "generic_scene_opengl_test.h"
|
||||
|
||||
#include "abstract_client.h"
|
||||
#include "composite.h"
|
||||
#include "wayland_server.h"
|
||||
|
||||
#include <KWayland/Client/xdgshell.h>
|
||||
#include <KWayland/Client/subsurface.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_buffer_size_change-0");
|
||||
|
||||
class BufferSizeChangeTest : public GenericSceneOpenGLTest
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BufferSizeChangeTest() : GenericSceneOpenGLTest(QByteArrayLiteral("O2")) {}
|
||||
private Q_SLOTS:
|
||||
void init();
|
||||
void testShmBufferSizeChange();
|
||||
void testShmBufferSizeChangeOnSubSurface();
|
||||
};
|
||||
|
||||
void BufferSizeChangeTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void BufferSizeChangeTest::testShmBufferSizeChange()
|
||||
{
|
||||
// This test verifies that an SHM buffer size change is handled correctly
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
|
||||
// set buffer size
|
||||
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client);
|
||||
|
||||
// add a first repaint
|
||||
QSignalSpy swapSpy(Compositor::self(), &Compositor::bufferSwapCompleted);
|
||||
QVERIFY(swapSpy.isValid());
|
||||
Compositor::self()->addRepaintFull();
|
||||
QVERIFY(swapSpy.wait());
|
||||
|
||||
// now change buffer size
|
||||
Test::render(surface.data(), QSize(30, 10), Qt::red);
|
||||
|
||||
QSignalSpy damagedSpy(client, &AbstractClient::damaged);
|
||||
QVERIFY(damagedSpy.isValid());
|
||||
QVERIFY(damagedSpy.wait());
|
||||
KWin::Compositor::self()->addRepaintFull();
|
||||
QVERIFY(swapSpy.wait());
|
||||
}
|
||||
|
||||
void BufferSizeChangeTest::testShmBufferSizeChangeOnSubSurface()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
|
||||
// setup parent surface
|
||||
QScopedPointer<Surface> parentSurface(Test::createSurface());
|
||||
QVERIFY(!parentSurface.isNull());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(parentSurface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
|
||||
// setup sub surface
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<SubSurface> subSurface(Test::createSubSurface(surface.data(), parentSurface.data()));
|
||||
QVERIFY(!subSurface.isNull());
|
||||
|
||||
// set buffer sizes
|
||||
Test::render(surface.data(), QSize(30, 10), Qt::red);
|
||||
AbstractClient *parent = Test::renderAndWaitForShown(parentSurface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(parent);
|
||||
|
||||
// add a first repaint
|
||||
QSignalSpy swapSpy(Compositor::self(), &Compositor::bufferSwapCompleted);
|
||||
QVERIFY(swapSpy.isValid());
|
||||
Compositor::self()->addRepaintFull();
|
||||
QVERIFY(swapSpy.wait());
|
||||
|
||||
// change buffer size of sub surface
|
||||
QSignalSpy damagedParentSpy(parent, &AbstractClient::damaged);
|
||||
QVERIFY(damagedParentSpy.isValid());
|
||||
Test::render(surface.data(), QSize(20, 10), Qt::red);
|
||||
parentSurface->commit(Surface::CommitFlag::None);
|
||||
|
||||
QVERIFY(damagedParentSpy.wait());
|
||||
|
||||
// add a second repaint
|
||||
KWin::Compositor::self()->addRepaintFull();
|
||||
QVERIFY(swapSpy.wait());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::BufferSizeChangeTest)
|
||||
#include "buffer_size_change_test.moc"
|
|
@ -1,11 +1,22 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com>
|
||||
Copyright 2017 Roman Gilg <subdiff@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "platform.h"
|
||||
|
@ -36,27 +47,24 @@ private Q_SLOTS:
|
|||
|
||||
void ColorCorrectNightColorTest::initTestCase()
|
||||
{
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
waylandServer()->initWorkspace();
|
||||
}
|
||||
|
||||
void ColorCorrectNightColorTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void ColorCorrectNightColorTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void ColorCorrectNightColorTest::testConfigRead_data()
|
||||
|
@ -73,10 +81,9 @@ void ColorCorrectNightColorTest::testConfigRead_data()
|
|||
|
||||
QTest::newRow("activeMode0") << "true" << 0 << 4500 << 45.5 << 35.1 << "0600" << "1800" << 30 << true;
|
||||
QTest::newRow("activeMode1") << "true" << 1 << 2500 << -10.5 << -8. << "0020" << "2000" << 60 << true;
|
||||
QTest::newRow("activeMode2") << "true" << 3 << 3500 << 45.5 << 35.1 << "0600" << "1800" << 60 << true;
|
||||
QTest::newRow("notActiveMode2") << "false" << 2 << 5000 << 90. << -180. << "0600" << "1800" << 1 << true;
|
||||
QTest::newRow("wrongData1") << "fa" << 4 << 7000 << 91. << -181. << "060" << "800" << 999999 << false;
|
||||
QTest::newRow("wrongData2") << "fa" << 4 << 7000 << 91. << -181. << "060" << "800" << -2 << false;
|
||||
QTest::newRow("wrongData1") << "fa" << 3 << 7000 << 91. << -181. << "060" << "800" << 999999 << false;
|
||||
QTest::newRow("wrongData2") << "fa" << 3 << 7000 << 91. << -181. << "060" << "800" << -2 << false;
|
||||
}
|
||||
|
||||
void ColorCorrectNightColorTest::testConfigRead()
|
||||
|
@ -174,8 +181,7 @@ void ColorCorrectNightColorTest::testChangeConfiguration_data()
|
|||
QTest::newRow("data0") << true << 0 << 4500 << 45.5 << 35.1 << QTime(6,0,0) << QTime(18,0,0) << 30 << true;
|
||||
QTest::newRow("data1") << true << 1 << 2500 << -10.5 << -8. << QTime(0,2,0) << QTime(20,0,0) << 60 << true;
|
||||
QTest::newRow("data2") << false << 2 << 5000 << 90. << -180. << QTime(6,0,0) << QTime(19,1,1) << 1 << true;
|
||||
QTest::newRow("data3") << false << 3 << 2000 << 90. << -180. << QTime(6,0,0) << QTime(18,0,0) << 1 << true;
|
||||
QTest::newRow("wrongData0") << true << 4 << 4500 << 0. << 0. << QTime(6,0,0) << QTime(18,0,0) << 30 << false;
|
||||
QTest::newRow("wrongData0") << true << 3 << 4500 << 0. << 0. << QTime(6,0,0) << QTime(18,0,0) << 30 << false;
|
||||
QTest::newRow("wrongData1") << true << 0 << 500 << 0. << 0. << QTime(6,0,0) << QTime(18,0,0) << 30 << false;
|
||||
QTest::newRow("wrongData2") << true << 0 << 7000 << 0. << 0. << QTime(6,0,0) << QTime(18,0,0) << 30 << false;
|
||||
QTest::newRow("wrongData3") << true << 0 << 4500 << 91. << -181. << QTime(6,0,0) << QTime(18,0,0) << 30 << false;
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
effects.windowAdded.connect(function(w) {
|
||||
w.fadeAnimation = effect.animate(w, Effect.Opacity, 100, 1.0, 0.0);
|
||||
});
|
||||
|
|
|
@ -1,378 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2018 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "abstract_client.h"
|
||||
#include "atoms.h"
|
||||
#include "x11client.h"
|
||||
#include "deleted.h"
|
||||
#include "platform.h"
|
||||
#include "rules.h"
|
||||
#include "screens.h"
|
||||
#include "virtualdesktops.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <QDBusArgument>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusPendingReply>
|
||||
#include <QUuid>
|
||||
|
||||
#include <netwm.h>
|
||||
#include <xcb/xcb_icccm.h>
|
||||
|
||||
using namespace KWin;
|
||||
using namespace KWayland::Client;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dbus_interface-0");
|
||||
|
||||
const QString s_destination{QStringLiteral("org.kde.KWin")};
|
||||
const QString s_path{QStringLiteral("/KWin")};
|
||||
const QString s_interface{QStringLiteral("org.kde.KWin")};
|
||||
|
||||
class TestDbusInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testGetWindowInfoInvalidUuid();
|
||||
void testGetWindowInfoXdgShellClient();
|
||||
void testGetWindowInfoX11Client();
|
||||
};
|
||||
|
||||
void TestDbusInterface::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Deleted*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
waylandServer()->initWorkspace();
|
||||
VirtualDesktopManager::self()->setCount(4);
|
||||
}
|
||||
|
||||
void TestDbusInterface::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void TestDbusInterface::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
namespace {
|
||||
QDBusPendingCall getWindowInfo(const QUuid &uuid)
|
||||
{
|
||||
auto msg = QDBusMessage::createMethodCall(s_destination, s_path, s_interface, QStringLiteral("getWindowInfo"));
|
||||
msg.setArguments({uuid.toString()});
|
||||
return QDBusConnection::sessionBus().asyncCall(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void TestDbusInterface::testGetWindowInfoInvalidUuid()
|
||||
{
|
||||
QDBusPendingReply<QVariantMap> reply{getWindowInfo(QUuid::createUuid())};
|
||||
reply.waitForFinished();
|
||||
QVERIFY(reply.isValid());
|
||||
QVERIFY(!reply.isError());
|
||||
const auto windowData = reply.value();
|
||||
QVERIFY(windowData.empty());
|
||||
}
|
||||
|
||||
void TestDbusInterface::testGetWindowInfoXdgShellClient()
|
||||
{
|
||||
QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
shellSurface->setAppId(QByteArrayLiteral("org.kde.foo"));
|
||||
shellSurface->setTitle(QStringLiteral("Test window"));
|
||||
|
||||
// now let's render
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(clientAddedSpy.isEmpty());
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
auto client = clientAddedSpy.first().first().value<AbstractClient *>();
|
||||
QVERIFY(client);
|
||||
|
||||
// let's get the window info
|
||||
QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())};
|
||||
reply.waitForFinished();
|
||||
QVERIFY(reply.isValid());
|
||||
QVERIFY(!reply.isError());
|
||||
auto windowData = reply.value();
|
||||
QVERIFY(!windowData.isEmpty());
|
||||
QCOMPARE(windowData.size(), 24);
|
||||
QCOMPARE(windowData.value(QStringLiteral("type")).toInt(), NET::Normal);
|
||||
QCOMPARE(windowData.value(QStringLiteral("x")).toInt(), client->x());
|
||||
QCOMPARE(windowData.value(QStringLiteral("y")).toInt(), client->y());
|
||||
QCOMPARE(windowData.value(QStringLiteral("width")).toInt(), client->width());
|
||||
QCOMPARE(windowData.value(QStringLiteral("height")).toInt(), client->height());
|
||||
QCOMPARE(windowData.value(QStringLiteral("x11DesktopNumber")).toInt(), 1);
|
||||
QCOMPARE(windowData.value(QStringLiteral("minimized")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("shaded")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("fullscreen")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("keepAbove")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("keepBelow")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("skipTaskbar")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("skipPager")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("skipSwitcher")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("maximizeHorizontal")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("maximizeVertical")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("noBorder")).toBool(), true);
|
||||
QCOMPARE(windowData.value(QStringLiteral("clientMachine")).toString(), QString());
|
||||
QCOMPARE(windowData.value(QStringLiteral("localhost")).toBool(), true);
|
||||
QCOMPARE(windowData.value(QStringLiteral("role")).toString(), QString());
|
||||
QCOMPARE(windowData.value(QStringLiteral("resourceName")).toString(), QStringLiteral("testDbusInterface"));
|
||||
QCOMPARE(windowData.value(QStringLiteral("resourceClass")).toString(), QStringLiteral("org.kde.foo"));
|
||||
QCOMPARE(windowData.value(QStringLiteral("desktopFile")).toString(), QStringLiteral("org.kde.foo"));
|
||||
QCOMPARE(windowData.value(QStringLiteral("caption")).toString(), QStringLiteral("Test window"));
|
||||
|
||||
auto verifyProperty = [client] (const QString &name) {
|
||||
QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())};
|
||||
reply.waitForFinished();
|
||||
return reply.value().value(name).toBool();
|
||||
};
|
||||
|
||||
QVERIFY(!client->isMinimized());
|
||||
client->setMinimized(true);
|
||||
QVERIFY(client->isMinimized());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("minimized")), true);
|
||||
|
||||
QVERIFY(!client->keepAbove());
|
||||
client->setKeepAbove(true);
|
||||
QVERIFY(client->keepAbove());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("keepAbove")), true);
|
||||
|
||||
QVERIFY(!client->keepBelow());
|
||||
client->setKeepBelow(true);
|
||||
QVERIFY(client->keepBelow());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("keepBelow")), true);
|
||||
|
||||
QVERIFY(!client->skipTaskbar());
|
||||
client->setSkipTaskbar(true);
|
||||
QVERIFY(client->skipTaskbar());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipTaskbar")), true);
|
||||
|
||||
QVERIFY(!client->skipPager());
|
||||
client->setSkipPager(true);
|
||||
QVERIFY(client->skipPager());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipPager")), true);
|
||||
|
||||
QVERIFY(!client->skipSwitcher());
|
||||
client->setSkipSwitcher(true);
|
||||
QVERIFY(client->skipSwitcher());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipSwitcher")), true);
|
||||
|
||||
// not testing shaded as that's X11
|
||||
// not testing fullscreen, maximizeHorizontal, maximizeVertical and noBorder as those require window geometry changes
|
||||
|
||||
QCOMPARE(client->desktop(), 1);
|
||||
workspace()->sendClientToDesktop(client, 2, false);
|
||||
QCOMPARE(client->desktop(), 2);
|
||||
reply = getWindowInfo(client->internalId());
|
||||
reply.waitForFinished();
|
||||
QCOMPARE(reply.value().value(QStringLiteral("x11DesktopNumber")).toInt(), 2);
|
||||
|
||||
client->move(10, 20);
|
||||
reply = getWindowInfo(client->internalId());
|
||||
reply.waitForFinished();
|
||||
QCOMPARE(reply.value().value(QStringLiteral("x")).toInt(), client->x());
|
||||
QCOMPARE(reply.value().value(QStringLiteral("y")).toInt(), client->y());
|
||||
// not testing width, height as that would require window geometry change
|
||||
|
||||
// finally close window
|
||||
const auto id = client->internalId();
|
||||
QSignalSpy windowClosedSpy(client, &AbstractClient::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
shellSurface.reset();
|
||||
surface.reset();
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
QCOMPARE(windowClosedSpy.count(), 1);
|
||||
|
||||
reply = getWindowInfo(id);
|
||||
reply.waitForFinished();
|
||||
QVERIFY(reply.value().empty());
|
||||
}
|
||||
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
static inline void cleanup(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void TestDbusInterface::testGetWindowInfoX11Client()
|
||||
{
|
||||
QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
QVERIFY(!xcb_connection_has_error(c.data()));
|
||||
const QRect windowGeometry(0, 0, 600, 400);
|
||||
xcb_window_t w = xcb_generate_id(c.data());
|
||||
xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(),
|
||||
windowGeometry.x(),
|
||||
windowGeometry.y(),
|
||||
windowGeometry.width(),
|
||||
windowGeometry.height(),
|
||||
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr);
|
||||
xcb_size_hints_t hints;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y());
|
||||
xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height());
|
||||
xcb_icccm_set_wm_normal_hints(c.data(), w, &hints);
|
||||
xcb_icccm_set_wm_class(c.data(), w, 7, "foo\0bar");
|
||||
NETWinInfo winInfo(c.data(), w, rootWindow(), NET::Properties(), NET::Properties2());
|
||||
winInfo.setName("Some caption");
|
||||
winInfo.setDesktopFileName("org.kde.foo");
|
||||
xcb_map_window(c.data(), w);
|
||||
xcb_flush(c.data());
|
||||
|
||||
// we should get a client for it
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded);
|
||||
QVERIFY(windowCreatedSpy.isValid());
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Client *client = windowCreatedSpy.first().first().value<X11Client *>();
|
||||
QVERIFY(client);
|
||||
QCOMPARE(client->window(), w);
|
||||
QCOMPARE(client->clientSize(), windowGeometry.size());
|
||||
|
||||
// let's get the window info
|
||||
QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())};
|
||||
reply.waitForFinished();
|
||||
QVERIFY(reply.isValid());
|
||||
QVERIFY(!reply.isError());
|
||||
auto windowData = reply.value();
|
||||
QVERIFY(!windowData.isEmpty());
|
||||
QCOMPARE(windowData.size(), 24);
|
||||
QCOMPARE(windowData.value(QStringLiteral("type")).toInt(), NET::Normal);
|
||||
QCOMPARE(windowData.value(QStringLiteral("x")).toInt(), client->x());
|
||||
QCOMPARE(windowData.value(QStringLiteral("y")).toInt(), client->y());
|
||||
QCOMPARE(windowData.value(QStringLiteral("width")).toInt(), client->width());
|
||||
QCOMPARE(windowData.value(QStringLiteral("height")).toInt(), client->height());
|
||||
QCOMPARE(windowData.value(QStringLiteral("x11DesktopNumber")).toInt(), 1);
|
||||
QCOMPARE(windowData.value(QStringLiteral("minimized")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("shaded")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("fullscreen")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("keepAbove")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("keepBelow")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("skipTaskbar")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("skipPager")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("skipSwitcher")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("maximizeHorizontal")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("maximizeVertical")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("noBorder")).toBool(), false);
|
||||
QCOMPARE(windowData.value(QStringLiteral("role")).toString(), QString());
|
||||
QCOMPARE(windowData.value(QStringLiteral("resourceName")).toString(), QStringLiteral("foo"));
|
||||
QCOMPARE(windowData.value(QStringLiteral("resourceClass")).toString(), QStringLiteral("bar"));
|
||||
QCOMPARE(windowData.value(QStringLiteral("desktopFile")).toString(), QStringLiteral("org.kde.foo"));
|
||||
QCOMPARE(windowData.value(QStringLiteral("caption")).toString(), QStringLiteral("Some caption"));
|
||||
// not testing clientmachine as that is system dependent
|
||||
// due to that also not testing localhost
|
||||
|
||||
auto verifyProperty = [client] (const QString &name) {
|
||||
QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())};
|
||||
reply.waitForFinished();
|
||||
return reply.value().value(name).toBool();
|
||||
};
|
||||
|
||||
QVERIFY(!client->isMinimized());
|
||||
client->setMinimized(true);
|
||||
QVERIFY(client->isMinimized());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("minimized")), true);
|
||||
|
||||
QVERIFY(!client->keepAbove());
|
||||
client->setKeepAbove(true);
|
||||
QVERIFY(client->keepAbove());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("keepAbove")), true);
|
||||
|
||||
QVERIFY(!client->keepBelow());
|
||||
client->setKeepBelow(true);
|
||||
QVERIFY(client->keepBelow());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("keepBelow")), true);
|
||||
|
||||
QVERIFY(!client->skipTaskbar());
|
||||
client->setSkipTaskbar(true);
|
||||
QVERIFY(client->skipTaskbar());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipTaskbar")), true);
|
||||
|
||||
QVERIFY(!client->skipPager());
|
||||
client->setSkipPager(true);
|
||||
QVERIFY(client->skipPager());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipPager")), true);
|
||||
|
||||
QVERIFY(!client->skipSwitcher());
|
||||
client->setSkipSwitcher(true);
|
||||
QVERIFY(client->skipSwitcher());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipSwitcher")), true);
|
||||
|
||||
QVERIFY(!client->isShade());
|
||||
client->setShade(ShadeNormal);
|
||||
QVERIFY(client->isShade());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("shaded")), true);
|
||||
client->setShade(ShadeNone);
|
||||
QVERIFY(!client->isShade());
|
||||
|
||||
QVERIFY(!client->noBorder());
|
||||
client->setNoBorder(true);
|
||||
QVERIFY(client->noBorder());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("noBorder")), true);
|
||||
client->setNoBorder(false);
|
||||
QVERIFY(!client->noBorder());
|
||||
|
||||
QVERIFY(!client->isFullScreen());
|
||||
client->setFullScreen(true);
|
||||
QVERIFY(client->isFullScreen());
|
||||
QVERIFY(client->clientSize() != windowGeometry.size());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("fullscreen")), true);
|
||||
reply = getWindowInfo(client->internalId());
|
||||
reply.waitForFinished();
|
||||
QCOMPARE(reply.value().value(QStringLiteral("width")).toInt(), client->width());
|
||||
QCOMPARE(reply.value().value(QStringLiteral("height")).toInt(), client->height());
|
||||
client->setFullScreen(false);
|
||||
QVERIFY(!client->isFullScreen());
|
||||
|
||||
// maximize
|
||||
client->setMaximize(true, false);
|
||||
QCOMPARE(verifyProperty(QStringLiteral("maximizeVertical")), true);
|
||||
QCOMPARE(verifyProperty(QStringLiteral("maximizeHorizontal")), false);
|
||||
client->setMaximize(false, true);
|
||||
QCOMPARE(verifyProperty(QStringLiteral("maximizeVertical")), false);
|
||||
QCOMPARE(verifyProperty(QStringLiteral("maximizeHorizontal")), true);
|
||||
|
||||
const auto id = client->internalId();
|
||||
// destroy the window
|
||||
xcb_unmap_window(c.data(), w);
|
||||
xcb_flush(c.data());
|
||||
|
||||
QSignalSpy windowClosedSpy(client, &X11Client::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
xcb_destroy_window(c.data(), w);
|
||||
c.reset();
|
||||
|
||||
reply = getWindowInfo(id);
|
||||
reply.waitForFinished();
|
||||
QVERIFY(reply.value().empty());
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(TestDbusInterface)
|
||||
#include "dbus_interface_test.moc"
|
|
@ -1,23 +1,33 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "abstract_client.h"
|
||||
#include "debug_console.h"
|
||||
#include "internal_client.h"
|
||||
#include "platform.h"
|
||||
#include "debug_console.h"
|
||||
#include "screens.h"
|
||||
#include "shell_client.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "xcbutils.h"
|
||||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
|
@ -39,6 +49,7 @@ private Q_SLOTS:
|
|||
void topLevelTest();
|
||||
void testX11Client();
|
||||
void testX11Unmanaged();
|
||||
void testWaylandClient_data();
|
||||
void testWaylandClient();
|
||||
void testInternalWindow();
|
||||
void testClosingDebugConsole();
|
||||
|
@ -46,16 +57,16 @@ private Q_SLOTS:
|
|||
|
||||
void DebugConsoleTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::AbstractClient *>();
|
||||
qRegisterMetaType<KWin::InternalClient *>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
|
@ -126,8 +137,7 @@ void DebugConsoleTest::testX11Client()
|
|||
QVERIFY(rowsInsertedSpy.isValid());
|
||||
|
||||
QProcess glxgears;
|
||||
glxgears.setProgram(QStringLiteral("glxgears"));
|
||||
glxgears.start();
|
||||
glxgears.start(QStringLiteral("glxgears"));
|
||||
QVERIFY(glxgears.waitForStarted());
|
||||
|
||||
QVERIFY(rowsInsertedSpy.wait());
|
||||
|
@ -284,6 +294,14 @@ void DebugConsoleTest::testX11Unmanaged()
|
|||
QVERIFY(!model2.hasChildren(model2.index(1, 0, QModelIndex())));
|
||||
}
|
||||
|
||||
void DebugConsoleTest::testWaylandClient_data()
|
||||
{
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5;
|
||||
}
|
||||
|
||||
void DebugConsoleTest::testWaylandClient()
|
||||
{
|
||||
DebugConsoleModel model;
|
||||
|
@ -310,7 +328,8 @@ void DebugConsoleTest::testWaylandClient()
|
|||
using namespace KWayland::Client;
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(surface->isValid());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
Test::render(surface.data(), QSize(10, 10), Qt::red);
|
||||
|
||||
|
@ -369,8 +388,16 @@ void DebugConsoleTest::testWaylandClient()
|
|||
|
||||
surface->attachBuffer(Buffer::Ptr());
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
shellSurface.reset();
|
||||
Test::flushWaylandConnection();
|
||||
qDebug() << rowsRemovedSpy.count();
|
||||
QEXPECT_FAIL("wlShell", "Deleting a ShellSurface does not result in the server removing the ShellClient", Continue);
|
||||
QVERIFY(rowsRemovedSpy.wait());
|
||||
surface.reset();
|
||||
|
||||
if (rowsRemovedSpy.isEmpty()) {
|
||||
QVERIFY(rowsRemovedSpy.wait());
|
||||
}
|
||||
QCOMPARE(rowsRemovedSpy.count(), 1);
|
||||
QCOMPARE(rowsRemovedSpy.first().first().value<QModelIndex>(), waylandTopLevelIndex);
|
||||
QCOMPARE(rowsRemovedSpy.first().at(1).value<int>(), 0);
|
||||
|
@ -386,7 +413,7 @@ class HelperWindow : public QRasterWindow
|
|||
Q_OBJECT
|
||||
public:
|
||||
HelperWindow() : QRasterWindow(nullptr) {}
|
||||
~HelperWindow() override = default;
|
||||
~HelperWindow() = default;
|
||||
|
||||
Q_SIGNALS:
|
||||
void entered();
|
||||
|
@ -422,7 +449,8 @@ void DebugConsoleTest::testInternalWindow()
|
|||
w->setGeometry(0, 0, 100, 100);
|
||||
w->show();
|
||||
|
||||
QTRY_COMPARE(rowsInsertedSpy.count(), 1);
|
||||
QVERIFY(rowsInsertedSpy.wait());
|
||||
QCOMPARE(rowsInsertedSpy.count(), 1);
|
||||
QCOMPARE(rowsInsertedSpy.first().first().value<QModelIndex>(), internalTopLevelIndex);
|
||||
|
||||
QModelIndex clientIndex = model.index(rowsInsertedSpy.first().last().toInt(), 0, internalTopLevelIndex);
|
||||
|
@ -470,7 +498,8 @@ void DebugConsoleTest::testInternalWindow()
|
|||
w->hide();
|
||||
w.reset();
|
||||
|
||||
QTRY_COMPARE(rowsRemovedSpy.count(), 1);
|
||||
QVERIFY(rowsRemovedSpy.wait());
|
||||
QCOMPARE(rowsRemovedSpy.count(), 1);
|
||||
QCOMPARE(rowsRemovedSpy.first().first().value<QModelIndex>(), internalTopLevelIndex);
|
||||
}
|
||||
|
||||
|
@ -483,12 +512,12 @@ void DebugConsoleTest::testClosingDebugConsole()
|
|||
QSignalSpy destroyedSpy(console, &QObject::destroyed);
|
||||
QVERIFY(destroyedSpy.isValid());
|
||||
|
||||
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
console->show();
|
||||
QCOMPARE(console->windowHandle()->isVisible(), true);
|
||||
QTRY_COMPARE(clientAddedSpy.count(), 1);
|
||||
InternalClient *c = clientAddedSpy.first().first().value<InternalClient *>();
|
||||
ShellClient *c = clientAddedSpy.first().first().value<ShellClient*>();
|
||||
QVERIFY(c->isInternal());
|
||||
QCOMPARE(c->internalWindow(), console->windowHandle());
|
||||
QVERIFY(c->isDecorated());
|
||||
|
|
|
@ -1,39 +1,47 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "platform.h"
|
||||
#include "abstract_client.h"
|
||||
#include "cursor.h"
|
||||
#include "internal_client.h"
|
||||
#include "platform.h"
|
||||
#include "pointer_input.h"
|
||||
#include "touch_input.h"
|
||||
#include "screenedge.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "shell_client.h"
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include "decorations/decoratedclient.h"
|
||||
#include "decorations/decorationbridge.h"
|
||||
#include "decorations/settings.h"
|
||||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/keyboard.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
#include <KWayland/Client/server_decoration.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <KDecoration2/Decoration>
|
||||
#include <KDecoration2/DecorationSettings>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
|
@ -57,6 +65,7 @@ private Q_SLOTS:
|
|||
void testDoubleClick();
|
||||
void testDoubleTap_data();
|
||||
void testDoubleTap();
|
||||
void testHover_data();
|
||||
void testHover();
|
||||
void testPressToMove_data();
|
||||
void testPressToMove();
|
||||
|
@ -68,11 +77,13 @@ private Q_SLOTS:
|
|||
void testModifierClickUnrestrictedMove();
|
||||
void testModifierScrollOpacity_data();
|
||||
void testModifierScrollOpacity();
|
||||
void testTouchEvents_data();
|
||||
void testTouchEvents();
|
||||
void testTooltipDoesntEatKeyEvents_data();
|
||||
void testTooltipDoesntEatKeyEvents();
|
||||
|
||||
private:
|
||||
AbstractClient *showWindow();
|
||||
AbstractClient *showWindow(Test::ShellSurfaceType type);
|
||||
};
|
||||
|
||||
#define MOTION(target) \
|
||||
|
@ -84,7 +95,7 @@ private:
|
|||
#define RELEASE \
|
||||
kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++)
|
||||
|
||||
AbstractClient *DecorationInputTest::showWindow()
|
||||
AbstractClient *DecorationInputTest::showWindow(Test::ShellSurfaceType type)
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
#define VERIFY(statement) \
|
||||
|
@ -96,7 +107,7 @@ AbstractClient *DecorationInputTest::showWindow()
|
|||
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
VERIFY(surface);
|
||||
XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
auto shellSurface = Test::createShellSurface(type, surface, surface);
|
||||
VERIFY(shellSurface);
|
||||
auto deco = Test::waylandServerSideDecoration()->create(surface, surface);
|
||||
QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged);
|
||||
|
@ -118,13 +129,13 @@ AbstractClient *DecorationInputTest::showWindow()
|
|||
|
||||
void DecorationInputTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::AbstractClient *>();
|
||||
qRegisterMetaType<KWin::InternalClient *>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// change some options
|
||||
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
|
@ -136,7 +147,7 @@ void DecorationInputTest::initTestCase()
|
|||
kwinApp()->setConfig(config);
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
|
@ -151,7 +162,7 @@ void DecorationInputTest::init()
|
|||
QVERIFY(Test::waitForWaylandPointer());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void DecorationInputTest::cleanup()
|
||||
|
@ -163,15 +174,23 @@ void DecorationInputTest::testAxis_data()
|
|||
{
|
||||
QTest::addColumn<QPoint>("decoPoint");
|
||||
QTest::addColumn<Qt::WindowFrameSection>("expectedSection");
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection;
|
||||
QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection;
|
||||
QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection;
|
||||
QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("topLeft|xdgv5") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("top|xdgv5") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("topRight|xdgv5") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("topLeft|xdgv6") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("top|xdgv6") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("topRight|xdgv6") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV6;
|
||||
}
|
||||
|
||||
void DecorationInputTest::testAxis()
|
||||
{
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
AbstractClient *c = showWindow(type);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
|
@ -180,7 +199,7 @@ void DecorationInputTest::testAxis()
|
|||
QVERIFY(!c->keepBelow());
|
||||
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(c->frameGeometry().center().x(), c->clientPos().y() / 2));
|
||||
MOTION(QPoint(c->geometry().center().x(), c->clientPos().y() / 2));
|
||||
QVERIFY(!input()->pointer()->decoration().isNull());
|
||||
QCOMPARE(input()->pointer()->decoration()->decoration()->sectionUnderMouse(), Qt::TitleBarArea);
|
||||
|
||||
|
@ -212,21 +231,29 @@ void DecorationInputTest::testDoubleClick_data()
|
|||
{
|
||||
QTest::addColumn<QPoint>("decoPoint");
|
||||
QTest::addColumn<Qt::WindowFrameSection>("expectedSection");
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection;
|
||||
QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection;
|
||||
QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection;
|
||||
QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("topLeft|xdgv5") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("top|xdgv5") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("topRight|xdgv5") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("topLeft|xdgv6") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("top|xdgv6") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("topRight|xdgv6") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV6;
|
||||
}
|
||||
|
||||
void KWin::DecorationInputTest::testDoubleClick()
|
||||
{
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
AbstractClient *c = showWindow(type);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
QVERIFY(!c->isOnAllDesktops());
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(c->frameGeometry().center().x(), c->clientPos().y() / 2));
|
||||
MOTION(QPoint(c->geometry().center().x(), c->clientPos().y() / 2));
|
||||
|
||||
// double click
|
||||
PRESS;
|
||||
|
@ -262,21 +289,30 @@ void DecorationInputTest::testDoubleTap_data()
|
|||
{
|
||||
QTest::addColumn<QPoint>("decoPoint");
|
||||
QTest::addColumn<Qt::WindowFrameSection>("expectedSection");
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("topLeft") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("top") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("topRight") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("topLeft|xdgv5") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("top|xdgv5") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("topRight|xdgv5") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("topLeft|xdgv6") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("top|xdgv6") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("topRight|xdgv6") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV6;
|
||||
|
||||
QTest::newRow("topLeft") << QPoint(10, 10) << Qt::TopLeftSection;
|
||||
QTest::newRow("top") << QPoint(260, 10) << Qt::TopSection;
|
||||
QTest::newRow("topRight") << QPoint(509, 10) << Qt::TopRightSection;
|
||||
}
|
||||
|
||||
void KWin::DecorationInputTest::testDoubleTap()
|
||||
{
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
AbstractClient *c = showWindow(type);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
QVERIFY(!c->isOnAllDesktops());
|
||||
quint32 timestamp = 1;
|
||||
const QPoint tapPoint(c->frameGeometry().center().x(), c->clientPos().y() / 2);
|
||||
const QPoint tapPoint(c->geometry().center().x(), c->clientPos().y() / 2);
|
||||
|
||||
// double tap
|
||||
kwinApp()->platform()->touchDown(0, tapPoint, timestamp++);
|
||||
|
@ -310,9 +346,19 @@ void KWin::DecorationInputTest::testDoubleTap()
|
|||
QVERIFY(c->isOnAllDesktops());
|
||||
}
|
||||
|
||||
void DecorationInputTest::testHover_data()
|
||||
{
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6;
|
||||
}
|
||||
|
||||
void DecorationInputTest::testHover()
|
||||
{
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
AbstractClient *c = showWindow(type);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
|
@ -321,38 +367,27 @@ void DecorationInputTest::testHover()
|
|||
c->move(QPoint(20, 0));
|
||||
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(c->frameGeometry().center().x(), c->clientPos().y() / 2));
|
||||
MOTION(QPoint(c->geometry().center().x(), c->clientPos().y() / 2));
|
||||
QCOMPARE(c->cursor(), CursorShape(Qt::ArrowCursor));
|
||||
|
||||
// There is a mismatch of the cursor key positions between windows
|
||||
// with and without borders (with borders one can move inside a bit and still
|
||||
// be on an edge, without not). We should make this consistent in KWin's core.
|
||||
//
|
||||
// TODO: Test input position with different border sizes.
|
||||
// TODO: We should test with the fake decoration to have a fixed test environment.
|
||||
const bool hasBorders = Decoration::DecorationBridge::self()->settings()->borderSize() != KDecoration2::BorderSize::None;
|
||||
auto deviation = [hasBorders] {
|
||||
return hasBorders ? -1 : 0;
|
||||
};
|
||||
|
||||
MOTION(QPoint(c->frameGeometry().x(), 0));
|
||||
MOTION(QPoint(c->geometry().x(), 0));
|
||||
QCOMPARE(c->cursor(), CursorShape(KWin::ExtendedCursor::SizeNorthWest));
|
||||
MOTION(QPoint(c->frameGeometry().x() + c->frameGeometry().width() / 2, 0));
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() / 2, 0));
|
||||
QCOMPARE(c->cursor(), CursorShape(KWin::ExtendedCursor::SizeNorth));
|
||||
MOTION(QPoint(c->frameGeometry().x() + c->frameGeometry().width() - 1, 0));
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() - 1, 0));
|
||||
QCOMPARE(c->cursor(), CursorShape(KWin::ExtendedCursor::SizeNorthEast));
|
||||
MOTION(QPoint(c->frameGeometry().x() + c->frameGeometry().width() + deviation(), c->height() / 2));
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() - 1, c->height() / 2));
|
||||
QCOMPARE(c->cursor(), CursorShape(KWin::ExtendedCursor::SizeEast));
|
||||
MOTION(QPoint(c->frameGeometry().x() + c->frameGeometry().width() + deviation(), c->height() - 1));
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() - 1, c->height() - 1));
|
||||
QCOMPARE(c->cursor(), CursorShape(KWin::ExtendedCursor::SizeSouthEast));
|
||||
MOTION(QPoint(c->frameGeometry().x() + c->frameGeometry().width() / 2, c->height() + deviation()));
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() / 2, c->height() - 1));
|
||||
QCOMPARE(c->cursor(), CursorShape(KWin::ExtendedCursor::SizeSouth));
|
||||
MOTION(QPoint(c->frameGeometry().x(), c->height() + deviation()));
|
||||
MOTION(QPoint(c->geometry().x(), c->height() - 1));
|
||||
QCOMPARE(c->cursor(), CursorShape(KWin::ExtendedCursor::SizeSouthWest));
|
||||
MOTION(QPoint(c->frameGeometry().x() - 1, c->height() / 2));
|
||||
MOTION(QPoint(c->geometry().x(), c->height() / 2));
|
||||
QCOMPARE(c->cursor(), CursorShape(KWin::ExtendedCursor::SizeWest));
|
||||
|
||||
MOTION(c->frameGeometry().center());
|
||||
MOTION(c->geometry().center());
|
||||
QEXPECT_FAIL("", "Cursor not set back on leave", Continue);
|
||||
QCOMPARE(c->cursor(), CursorShape(Qt::ArrowCursor));
|
||||
}
|
||||
|
@ -362,16 +397,26 @@ void DecorationInputTest::testPressToMove_data()
|
|||
QTest::addColumn<QPoint>("offset");
|
||||
QTest::addColumn<QPoint>("offset2");
|
||||
QTest::addColumn<QPoint>("offset3");
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0);
|
||||
QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0);
|
||||
QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30);
|
||||
QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30);
|
||||
QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("To right|xdgv5") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("To left|xdgv5") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("To bottom|xdgv5") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("To top|xdgv5") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("To right|xdgv6") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("To left|xdgv6") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("To bottom|xdgv6") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("To top|xdgv6") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV6;
|
||||
}
|
||||
|
||||
void DecorationInputTest::testPressToMove()
|
||||
{
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
AbstractClient *c = showWindow(type);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
|
@ -382,13 +427,13 @@ void DecorationInputTest::testPressToMove()
|
|||
QVERIFY(clientFinishUserMovedResizedSpy.isValid());
|
||||
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2));
|
||||
MOTION(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2));
|
||||
QCOMPARE(c->cursor(), CursorShape(Qt::ArrowCursor));
|
||||
|
||||
PRESS;
|
||||
QVERIFY(!c->isMove());
|
||||
QFETCH(QPoint, offset);
|
||||
MOTION(QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2) + offset);
|
||||
MOTION(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2) + offset);
|
||||
const QPoint oldPos = c->pos();
|
||||
QVERIFY(c->isMove());
|
||||
QCOMPARE(startMoveResizedSpy.count(), 1);
|
||||
|
@ -403,11 +448,11 @@ void DecorationInputTest::testPressToMove()
|
|||
PRESS;
|
||||
QVERIFY(!c->isMove());
|
||||
QFETCH(QPoint, offset2);
|
||||
MOTION(QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2) + offset2);
|
||||
MOTION(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2) + offset2);
|
||||
QVERIFY(c->isMove());
|
||||
QCOMPARE(startMoveResizedSpy.count(), 2);
|
||||
QFETCH(QPoint, offset3);
|
||||
MOTION(QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2) + offset3);
|
||||
MOTION(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2) + offset3);
|
||||
|
||||
RELEASE;
|
||||
QTRY_VERIFY(!c->isMove());
|
||||
|
@ -421,16 +466,26 @@ void DecorationInputTest::testTapToMove_data()
|
|||
QTest::addColumn<QPoint>("offset");
|
||||
QTest::addColumn<QPoint>("offset2");
|
||||
QTest::addColumn<QPoint>("offset3");
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0);
|
||||
QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0);
|
||||
QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30);
|
||||
QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30);
|
||||
QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("To right|xdgv5") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("To left|xdgv5") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("To bottom|xdgv5") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("To top|xdgv5") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("To right|xdgv6") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("To left|xdgv6") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("To bottom|xdgv6") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV6;
|
||||
QTest::newRow("To top|xdgv6") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV6;
|
||||
}
|
||||
|
||||
void DecorationInputTest::testTapToMove()
|
||||
{
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
AbstractClient *c = showWindow(type);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
|
@ -441,7 +496,7 @@ void DecorationInputTest::testTapToMove()
|
|||
QVERIFY(clientFinishUserMovedResizedSpy.isValid());
|
||||
|
||||
quint32 timestamp = 1;
|
||||
QPoint p = QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2);
|
||||
QPoint p = QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2);
|
||||
|
||||
kwinApp()->platform()->touchDown(0, p, timestamp++);
|
||||
QVERIFY(!c->isMove());
|
||||
|
@ -463,11 +518,11 @@ void DecorationInputTest::testTapToMove()
|
|||
QCOMPARE(input()->touch()->decorationPressId(), 1);
|
||||
QVERIFY(!c->isMove());
|
||||
QFETCH(QPoint, offset2);
|
||||
kwinApp()->platform()->touchMotion(1, QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2) + offset2, timestamp++);
|
||||
kwinApp()->platform()->touchMotion(1, QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2) + offset2, timestamp++);
|
||||
QVERIFY(c->isMove());
|
||||
QCOMPARE(startMoveResizedSpy.count(), 2);
|
||||
QFETCH(QPoint, offset3);
|
||||
kwinApp()->platform()->touchMotion(1, QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2) + offset3, timestamp++);
|
||||
kwinApp()->platform()->touchMotion(1, QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2) + offset3, timestamp++);
|
||||
|
||||
kwinApp()->platform()->touchUp(1, timestamp++);
|
||||
QTRY_VERIFY(!c->isMove());
|
||||
|
@ -478,12 +533,19 @@ void DecorationInputTest::testTapToMove()
|
|||
|
||||
void DecorationInputTest::testResizeOutsideWindow_data()
|
||||
{
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
QTest::addColumn<Qt::Edge>("edge");
|
||||
QTest::addColumn<Qt::CursorShape>("expectedCursor");
|
||||
|
||||
QTest::newRow("left") << Qt::LeftEdge << Qt::SizeHorCursor;
|
||||
QTest::newRow("right") << Qt::RightEdge << Qt::SizeHorCursor;
|
||||
QTest::newRow("bottom") << Qt::BottomEdge << Qt::SizeVerCursor;
|
||||
QTest::newRow("wlShell - left") << Test::ShellSurfaceType::WlShell << Qt::LeftEdge << Qt::SizeHorCursor;
|
||||
QTest::newRow("xdgShellV5 - left") << Test::ShellSurfaceType::XdgShellV5 << Qt::LeftEdge << Qt::SizeHorCursor;
|
||||
QTest::newRow("xdgShellV6 - left") << Test::ShellSurfaceType::XdgShellV6 << Qt::LeftEdge << Qt::SizeHorCursor;
|
||||
QTest::newRow("wlShell - right") << Test::ShellSurfaceType::WlShell << Qt::RightEdge << Qt::SizeHorCursor;
|
||||
QTest::newRow("xdgShellV5 - right") << Test::ShellSurfaceType::XdgShellV5 << Qt::RightEdge << Qt::SizeHorCursor;
|
||||
QTest::newRow("xdgShellV6 - right") << Test::ShellSurfaceType::XdgShellV6 << Qt::RightEdge << Qt::SizeHorCursor;
|
||||
QTest::newRow("wlShell - bottom") << Test::ShellSurfaceType::WlShell << Qt::BottomEdge << Qt::SizeVerCursor;
|
||||
QTest::newRow("xdgShellV5 - bottom") << Test::ShellSurfaceType::XdgShellV5 << Qt::BottomEdge << Qt::SizeVerCursor;
|
||||
QTest::newRow("xdgShellV6 - bottom") << Test::ShellSurfaceType::XdgShellV6 << Qt::BottomEdge << Qt::SizeVerCursor;
|
||||
}
|
||||
|
||||
void DecorationInputTest::testResizeOutsideWindow()
|
||||
|
@ -496,13 +558,14 @@ void DecorationInputTest::testResizeOutsideWindow()
|
|||
workspace()->slotReconfigure();
|
||||
|
||||
// now create window
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
AbstractClient *c = showWindow(type);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2));
|
||||
QVERIFY(c->frameGeometry() != c->inputGeometry());
|
||||
QVERIFY(c->inputGeometry().contains(c->frameGeometry()));
|
||||
QVERIFY(c->geometry() != c->inputGeometry());
|
||||
QVERIFY(c->inputGeometry().contains(c->geometry()));
|
||||
QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized);
|
||||
QVERIFY(startMoveResizedSpy.isValid());
|
||||
|
||||
|
@ -511,18 +574,18 @@ void DecorationInputTest::testResizeOutsideWindow()
|
|||
QFETCH(Qt::Edge, edge);
|
||||
switch (edge) {
|
||||
case Qt::LeftEdge:
|
||||
MOTION(QPoint(c->frameGeometry().x() -1, c->frameGeometry().center().y()));
|
||||
MOTION(QPoint(c->geometry().x() -1, c->geometry().center().y()));
|
||||
break;
|
||||
case Qt::RightEdge:
|
||||
MOTION(QPoint(c->frameGeometry().x() + c->frameGeometry().width() +1, c->frameGeometry().center().y()));
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() +1, c->geometry().center().y()));
|
||||
break;
|
||||
case Qt::BottomEdge:
|
||||
MOTION(QPoint(c->frameGeometry().center().x(), c->frameGeometry().y() + c->frameGeometry().height() + 1));
|
||||
MOTION(QPoint(c->geometry().center().x(), c->geometry().y() + c->geometry().height() + 1));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
QVERIFY(!c->frameGeometry().contains(KWin::Cursors::self()->mouse()->pos()));
|
||||
QVERIFY(!c->geometry().contains(KWin::Cursor::pos()));
|
||||
|
||||
// pressing should trigger resize
|
||||
PRESS;
|
||||
|
@ -540,38 +603,46 @@ void DecorationInputTest::testModifierClickUnrestrictedMove_data()
|
|||
QTest::addColumn<int>("mouseButton");
|
||||
QTest::addColumn<QString>("modKey");
|
||||
QTest::addColumn<bool>("capsLock");
|
||||
QTest::addColumn<Test::ShellSurfaceType>("surfaceType");
|
||||
|
||||
const QString alt = QStringLiteral("Alt");
|
||||
const QString meta = QStringLiteral("Meta");
|
||||
|
||||
QTest::newRow("Left Alt + Left Click") << KEY_LEFTALT << BTN_LEFT << alt << false;
|
||||
QTest::newRow("Left Alt + Right Click") << KEY_LEFTALT << BTN_RIGHT << alt << false;
|
||||
QTest::newRow("Left Alt + Middle Click") << KEY_LEFTALT << BTN_MIDDLE << alt << false;
|
||||
QTest::newRow("Right Alt + Left Click") << KEY_RIGHTALT << BTN_LEFT << alt << false;
|
||||
QTest::newRow("Right Alt + Right Click") << KEY_RIGHTALT << BTN_RIGHT << alt << false;
|
||||
QTest::newRow("Right Alt + Middle Click") << KEY_RIGHTALT << BTN_MIDDLE << alt << false;
|
||||
// now everything with meta
|
||||
QTest::newRow("Left Meta + Left Click") << KEY_LEFTMETA << BTN_LEFT << meta << false;
|
||||
QTest::newRow("Left Meta + Right Click") << KEY_LEFTMETA << BTN_RIGHT << meta << false;
|
||||
QTest::newRow("Left Meta + Middle Click") << KEY_LEFTMETA << BTN_MIDDLE << meta << false;
|
||||
QTest::newRow("Right Meta + Left Click") << KEY_RIGHTMETA << BTN_LEFT << meta << false;
|
||||
QTest::newRow("Right Meta + Right Click") << KEY_RIGHTMETA << BTN_RIGHT << meta << false;
|
||||
QTest::newRow("Right Meta + Middle Click") << KEY_RIGHTMETA << BTN_MIDDLE << meta << false;
|
||||
const QVector<std::pair<Test::ShellSurfaceType, QByteArray>> surfaceTypes{
|
||||
{Test::ShellSurfaceType::WlShell, QByteArrayLiteral("WlShell")},
|
||||
{Test::ShellSurfaceType::XdgShellV5, QByteArrayLiteral("XdgShellV5")},
|
||||
};
|
||||
|
||||
// and with capslock
|
||||
QTest::newRow("Left Alt + Left Click/CapsLock") << KEY_LEFTALT << BTN_LEFT << alt << true;
|
||||
QTest::newRow("Left Alt + Right Click/CapsLock") << KEY_LEFTALT << BTN_RIGHT << alt << true;
|
||||
QTest::newRow("Left Alt + Middle Click/CapsLock") << KEY_LEFTALT << BTN_MIDDLE << alt << true;
|
||||
QTest::newRow("Right Alt + Left Click/CapsLock") << KEY_RIGHTALT << BTN_LEFT << alt << true;
|
||||
QTest::newRow("Right Alt + Right Click/CapsLock") << KEY_RIGHTALT << BTN_RIGHT << alt << true;
|
||||
QTest::newRow("Right Alt + Middle Click/CapsLock") << KEY_RIGHTALT << BTN_MIDDLE << alt << true;
|
||||
// now everything with meta
|
||||
QTest::newRow("Left Meta + Left Click/CapsLock") << KEY_LEFTMETA << BTN_LEFT << meta << true;
|
||||
QTest::newRow("Left Meta + Right Click/CapsLock") << KEY_LEFTMETA << BTN_RIGHT << meta << true;
|
||||
QTest::newRow("Left Meta + Middle Click/CapsLock") << KEY_LEFTMETA << BTN_MIDDLE << meta << true;
|
||||
QTest::newRow("Right Meta + Left Click/CapsLock") << KEY_RIGHTMETA << BTN_LEFT << meta << true;
|
||||
QTest::newRow("Right Meta + Right Click/CapsLock") << KEY_RIGHTMETA << BTN_RIGHT << meta << true;
|
||||
QTest::newRow("Right Meta + Middle Click/CapsLock") << KEY_RIGHTMETA << BTN_MIDDLE << meta << true;
|
||||
for (const auto &type: surfaceTypes) {
|
||||
QTest::newRow("Left Alt + Left Click" + type.second) << KEY_LEFTALT << BTN_LEFT << alt << false << type.first;
|
||||
QTest::newRow("Left Alt + Right Click" + type.second) << KEY_LEFTALT << BTN_RIGHT << alt << false << type.first;
|
||||
QTest::newRow("Left Alt + Middle Click" + type.second) << KEY_LEFTALT << BTN_MIDDLE << alt << false << type.first;
|
||||
QTest::newRow("Right Alt + Left Click" + type.second) << KEY_RIGHTALT << BTN_LEFT << alt << false << type.first;
|
||||
QTest::newRow("Right Alt + Right Click" + type.second) << KEY_RIGHTALT << BTN_RIGHT << alt << false << type.first;
|
||||
QTest::newRow("Right Alt + Middle Click" + type.second) << KEY_RIGHTALT << BTN_MIDDLE << alt << false << type.first;
|
||||
// now everything with meta
|
||||
QTest::newRow("Left Meta + Left Click" + type.second) << KEY_LEFTMETA << BTN_LEFT << meta << false << type.first;
|
||||
QTest::newRow("Left Meta + Right Click" + type.second) << KEY_LEFTMETA << BTN_RIGHT << meta << false << type.first;
|
||||
QTest::newRow("Left Meta + Middle Click" + type.second) << KEY_LEFTMETA << BTN_MIDDLE << meta << false << type.first;
|
||||
QTest::newRow("Right Meta + Left Click" + type.second) << KEY_RIGHTMETA << BTN_LEFT << meta << false << type.first;
|
||||
QTest::newRow("Right Meta + Right Click" + type.second) << KEY_RIGHTMETA << BTN_RIGHT << meta << false << type.first;
|
||||
QTest::newRow("Right Meta + Middle Click" + type.second) << KEY_RIGHTMETA << BTN_MIDDLE << meta << false << type.first;
|
||||
|
||||
// and with capslock
|
||||
QTest::newRow("Left Alt + Left Click/CapsLock" + type.second) << KEY_LEFTALT << BTN_LEFT << alt << true << type.first;
|
||||
QTest::newRow("Left Alt + Right Click/CapsLock" + type.second) << KEY_LEFTALT << BTN_RIGHT << alt << true << type.first;
|
||||
QTest::newRow("Left Alt + Middle Click/CapsLock" + type.second) << KEY_LEFTALT << BTN_MIDDLE << alt << true << type.first;
|
||||
QTest::newRow("Right Alt + Left Click/CapsLock" + type.second) << KEY_RIGHTALT << BTN_LEFT << alt << true << type.first;
|
||||
QTest::newRow("Right Alt + Right Click/CapsLock" + type.second) << KEY_RIGHTALT << BTN_RIGHT << alt << true << type.first;
|
||||
QTest::newRow("Right Alt + Middle Click/CapsLock" + type.second) << KEY_RIGHTALT << BTN_MIDDLE << alt << true << type.first;
|
||||
// now everything with meta
|
||||
QTest::newRow("Left Meta + Left Click/CapsLock" + type.second) << KEY_LEFTMETA << BTN_LEFT << meta << true << type.first;
|
||||
QTest::newRow("Left Meta + Right Click/CapsLock" + type.second) << KEY_LEFTMETA << BTN_RIGHT << meta << true << type.first;
|
||||
QTest::newRow("Left Meta + Middle Click/CapsLock" + type.second) << KEY_LEFTMETA << BTN_MIDDLE << meta << true << type.first;
|
||||
QTest::newRow("Right Meta + Left Click/CapsLock" + type.second) << KEY_RIGHTMETA << BTN_LEFT << meta << true << type.first;
|
||||
QTest::newRow("Right Meta + Right Click/CapsLock" + type.second) << KEY_RIGHTMETA << BTN_RIGHT << meta << true << type.first;
|
||||
QTest::newRow("Right Meta + Middle Click/CapsLock" + type.second) << KEY_RIGHTMETA << BTN_MIDDLE << meta << true << type.first;
|
||||
}
|
||||
}
|
||||
|
||||
void DecorationInputTest::testModifierClickUnrestrictedMove()
|
||||
|
@ -593,13 +664,14 @@ void DecorationInputTest::testModifierClickUnrestrictedMove()
|
|||
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);
|
||||
|
||||
// create a window
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, surfaceType);
|
||||
AbstractClient *c = showWindow(surfaceType);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2));
|
||||
// move cursor on window
|
||||
Cursors::self()->mouse()->setPos(QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2));
|
||||
Cursor::setPos(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2));
|
||||
|
||||
// simulate modifier+click
|
||||
quint32 timestamp = 1;
|
||||
|
@ -629,18 +701,26 @@ void DecorationInputTest::testModifierScrollOpacity_data()
|
|||
QTest::addColumn<int>("modifierKey");
|
||||
QTest::addColumn<QString>("modKey");
|
||||
QTest::addColumn<bool>("capsLock");
|
||||
QTest::addColumn<Test::ShellSurfaceType>("surfaceType");
|
||||
|
||||
const QString alt = QStringLiteral("Alt");
|
||||
const QString meta = QStringLiteral("Meta");
|
||||
|
||||
QTest::newRow("Left Alt") << KEY_LEFTALT << alt << false;
|
||||
QTest::newRow("Right Alt") << KEY_RIGHTALT << alt << false;
|
||||
QTest::newRow("Left Meta") << KEY_LEFTMETA << meta << false;
|
||||
QTest::newRow("Right Meta") << KEY_RIGHTMETA << meta << false;
|
||||
QTest::newRow("Left Alt/CapsLock") << KEY_LEFTALT << alt << true;
|
||||
QTest::newRow("Right Alt/CapsLock") << KEY_RIGHTALT << alt << true;
|
||||
QTest::newRow("Left Meta/CapsLock") << KEY_LEFTMETA << meta << true;
|
||||
QTest::newRow("Right Meta/CapsLock") << KEY_RIGHTMETA << meta << true;
|
||||
const QVector<std::pair<Test::ShellSurfaceType, QByteArray>> surfaceTypes{
|
||||
{Test::ShellSurfaceType::WlShell, QByteArrayLiteral("WlShell")},
|
||||
{Test::ShellSurfaceType::XdgShellV5, QByteArrayLiteral("XdgShellV5")},
|
||||
};
|
||||
|
||||
for (const auto &type: surfaceTypes) {
|
||||
QTest::newRow("Left Alt" + type.second) << KEY_LEFTALT << alt << false << type.first;
|
||||
QTest::newRow("Right Alt" + type.second) << KEY_RIGHTALT << alt << false << type.first;
|
||||
QTest::newRow("Left Meta" + type.second) << KEY_LEFTMETA << meta << false << type.first;
|
||||
QTest::newRow("Right Meta" + type.second) << KEY_RIGHTMETA << meta << false << type.first;
|
||||
QTest::newRow("Left Alt/CapsLock" + type.second) << KEY_LEFTALT << alt << true << type.first;
|
||||
QTest::newRow("Right Alt/CapsLock" + type.second) << KEY_RIGHTALT << alt << true << type.first;
|
||||
QTest::newRow("Left Meta/CapsLock" + type.second) << KEY_LEFTMETA << meta << true << type.first;
|
||||
QTest::newRow("Right Meta/CapsLock" + type.second) << KEY_RIGHTMETA << meta << true << type.first;
|
||||
}
|
||||
}
|
||||
|
||||
void DecorationInputTest::testModifierScrollOpacity()
|
||||
|
@ -655,13 +735,14 @@ void DecorationInputTest::testModifierScrollOpacity()
|
|||
group.sync();
|
||||
workspace()->slotReconfigure();
|
||||
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, surfaceType);
|
||||
AbstractClient *c = showWindow(surfaceType);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2));
|
||||
// move cursor on window
|
||||
Cursors::self()->mouse()->setPos(QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2));
|
||||
Cursor::setPos(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2));
|
||||
// set the opacity to 0.5
|
||||
c->setOpacity(0.5);
|
||||
QCOMPARE(c->opacity(), 0.5);
|
||||
|
@ -684,6 +765,15 @@ void DecorationInputTest::testModifierScrollOpacity()
|
|||
}
|
||||
}
|
||||
|
||||
void DecorationInputTest::testTouchEvents_data()
|
||||
{
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6;
|
||||
}
|
||||
|
||||
class EventHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -711,7 +801,8 @@ void DecorationInputTest::testTouchEvents()
|
|||
{
|
||||
// this test verifies that the decoration gets a hover leave event on touch release
|
||||
// see BUG 386231
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
AbstractClient *c = showWindow(type);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
|
@ -724,7 +815,7 @@ void DecorationInputTest::testTouchEvents()
|
|||
QVERIFY(hoverLeaveSpy.isValid());
|
||||
|
||||
quint32 timestamp = 1;
|
||||
const QPoint tapPoint(c->frameGeometry().center().x(), c->clientPos().y() / 2);
|
||||
const QPoint tapPoint(c->geometry().center().x(), c->clientPos().y() / 2);
|
||||
|
||||
QVERIFY(!input()->touch()->decoration());
|
||||
kwinApp()->platform()->touchDown(0, tapPoint, timestamp++);
|
||||
|
@ -739,14 +830,22 @@ void DecorationInputTest::testTouchEvents()
|
|||
QCOMPARE(c->isMove(), false);
|
||||
|
||||
// let's check that a hover motion is sent if the pointer is on deco, when touch release
|
||||
Cursors::self()->mouse()->setPos(tapPoint);
|
||||
Cursor::setPos(tapPoint);
|
||||
QCOMPARE(hoverMoveSpy.count(), 2);
|
||||
kwinApp()->platform()->touchDown(0, tapPoint, timestamp++);
|
||||
QCOMPARE(hoverMoveSpy.count(), 3);
|
||||
QCOMPARE(hoverLeaveSpy.count(), 1);
|
||||
kwinApp()->platform()->touchUp(0, timestamp++);
|
||||
QCOMPARE(hoverMoveSpy.count(), 3);
|
||||
QCOMPARE(hoverLeaveSpy.count(), 2);
|
||||
QCOMPARE(hoverMoveSpy.count(), 4);
|
||||
QCOMPARE(hoverLeaveSpy.count(), 1);
|
||||
}
|
||||
|
||||
void DecorationInputTest::testTooltipDoesntEatKeyEvents_data()
|
||||
{
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6;
|
||||
}
|
||||
|
||||
void DecorationInputTest::testTooltipDoesntEatKeyEvents()
|
||||
|
@ -760,7 +859,8 @@ void DecorationInputTest::testTooltipDoesntEatKeyEvents()
|
|||
QSignalSpy enteredSpy(keyboard, &KWayland::Client::Keyboard::entered);
|
||||
QVERIFY(enteredSpy.isValid());
|
||||
|
||||
AbstractClient *c = showWindow();
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
AbstractClient *c = showWindow(type);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
|
@ -769,12 +869,12 @@ void DecorationInputTest::testTooltipDoesntEatKeyEvents()
|
|||
QSignalSpy keyEvent(keyboard, &KWayland::Client::Keyboard::keyChanged);
|
||||
QVERIFY(keyEvent.isValid());
|
||||
|
||||
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
c->decoratedClient()->requestShowToolTip(QStringLiteral("test"));
|
||||
// now we should get an internal window
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
InternalClient *internal = clientAddedSpy.first().first().value<InternalClient *>();
|
||||
ShellClient *internal = clientAddedSpy.first().first().value<ShellClient*>();
|
||||
QVERIFY(internal->isInternal());
|
||||
QVERIFY(internal->internalWindow()->flags().testFlag(Qt::ToolTip));
|
||||
|
||||
|
|
|
@ -1,21 +1,32 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "abstract_client.h"
|
||||
#include "platform.h"
|
||||
#include "x11client.h"
|
||||
#include "client.h"
|
||||
#include "cursor.h"
|
||||
#include "deleted.h"
|
||||
#include "screenedge.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "shell_client.h"
|
||||
#include "xcbutils.h"
|
||||
#include <kwineffects.h>
|
||||
|
||||
|
@ -41,16 +52,17 @@ private:
|
|||
|
||||
void X11DesktopWindowTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
qRegisterMetaType<KWin::Deleted*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
|
@ -61,7 +73,7 @@ void X11DesktopWindowTest::initTestCase()
|
|||
void X11DesktopWindowTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void X11DesktopWindowTest::cleanup()
|
||||
|
@ -113,7 +125,7 @@ void X11DesktopWindowTest::testDesktopWindow()
|
|||
auto cmCookie = xcb_create_colormap_checked(c.data(), XCB_COLORMAP_ALLOC_NONE, colormapId, rootWindow(), visualId);
|
||||
QVERIFY(!xcb_request_check(c.data(), cmCookie));
|
||||
|
||||
const uint32_t values[] = {XCB_PIXMAP_NONE, kwinApp()->x11DefaultScreen()->black_pixel, colormapId};
|
||||
const uint32_t values[] = {XCB_PIXMAP_NONE, defaultScreen()->black_pixel, colormapId};
|
||||
auto cookie = xcb_create_window_checked(c.data(), 32, w, rootWindow(),
|
||||
windowGeometry.x(),
|
||||
windowGeometry.y(),
|
||||
|
@ -139,12 +151,12 @@ void X11DesktopWindowTest::testDesktopWindow()
|
|||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded);
|
||||
QVERIFY(windowCreatedSpy.isValid());
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Client *client = windowCreatedSpy.first().first().value<X11Client *>();
|
||||
Client *client = windowCreatedSpy.first().first().value<Client*>();
|
||||
QVERIFY(client);
|
||||
QCOMPARE(client->window(), w);
|
||||
QVERIFY(!client->isDecorated());
|
||||
QCOMPARE(client->windowType(), NET::Desktop);
|
||||
QCOMPARE(client->frameGeometry(), windowGeometry);
|
||||
QCOMPARE(client->geometry(), windowGeometry);
|
||||
QVERIFY(client->isDesktop());
|
||||
QCOMPARE(client->depth(), 24);
|
||||
QVERIFY(!client->hasAlpha());
|
||||
|
@ -155,7 +167,7 @@ void X11DesktopWindowTest::testDesktopWindow()
|
|||
xcb_flush(c.data());
|
||||
c.reset();
|
||||
|
||||
QSignalSpy windowClosedSpy(client, &X11Client::windowClosed);
|
||||
QSignalSpy windowClosedSpy(client, &Client::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
}
|
||||
|
|
|
@ -1,21 +1,31 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "platform.h"
|
||||
#include "x11client.h"
|
||||
#include "composite.h"
|
||||
#include "client.h"
|
||||
#include "cursor.h"
|
||||
#include "screenedge.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "scene.h"
|
||||
#include "shell_client.h"
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include <KDecoration2/Decoration>
|
||||
|
@ -41,13 +51,16 @@ private Q_SLOTS:
|
|||
|
||||
void DontCrashAuroraeDestroyDecoTest::initTestCase()
|
||||
{
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
if (!QFile::exists(QStringLiteral("/dev/dri/card0"))) {
|
||||
QSKIP("Needs a dri device");
|
||||
}
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
config->group("org.kde.kdecoration2").writeEntry("library", "org.kde.kwin.aurorae");
|
||||
|
@ -57,22 +70,18 @@ void DontCrashAuroraeDestroyDecoTest::initTestCase()
|
|||
// this test needs to enforce OpenGL compositing to get into the crashy condition
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
setenv("QT_QPA_PLATFORM", "wayland", true);
|
||||
waylandServer()->initWorkspace();
|
||||
|
||||
auto scene = KWin::Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
QCOMPARE(scene->compositingType(), KWin::OpenGL2Compositing);
|
||||
}
|
||||
|
||||
void DontCrashAuroraeDestroyDecoTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows()
|
||||
|
@ -101,7 +110,7 @@ void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows()
|
|||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded);
|
||||
QVERIFY(windowCreatedSpy.isValid());
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Client *client = windowCreatedSpy.first().first().value<X11Client *>();
|
||||
Client *client = windowCreatedSpy.first().first().value<Client*>();
|
||||
QVERIFY(client);
|
||||
QCOMPARE(client->window(), w);
|
||||
QVERIFY(client->isDecorated());
|
||||
|
@ -122,7 +131,7 @@ void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows()
|
|||
QSignalSpy maximizedStateChangedSpy(client, static_cast<void (AbstractClient::*)(KWin::AbstractClient*, MaximizeMode)>(&AbstractClient::clientMaximizedStateChanged));
|
||||
QVERIFY(maximizedStateChangedSpy.isValid());
|
||||
quint32 timestamp = 1;
|
||||
kwinApp()->platform()->pointerMotion(client->frameGeometry().topLeft() + scenePoint.toPoint(), timestamp++);
|
||||
kwinApp()->platform()->pointerMotion(client->geometry().topLeft() + scenePoint.toPoint(), timestamp++);
|
||||
kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++);
|
||||
kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++);
|
||||
QVERIFY(maximizedStateChangedSpy.wait());
|
||||
|
@ -135,7 +144,7 @@ void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows()
|
|||
xcb_flush(c);
|
||||
xcb_disconnect(c);
|
||||
|
||||
QSignalSpy windowClosedSpy(client, &X11Client::windowClosed);
|
||||
QSignalSpy windowClosedSpy(client, &Client::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
}
|
||||
|
|
|
@ -1,20 +1,32 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "platform.h"
|
||||
#include "abstract_client.h"
|
||||
#include "x11client.h"
|
||||
#include "client.h"
|
||||
#include "composite.h"
|
||||
#include "deleted.h"
|
||||
#include "effects.h"
|
||||
#include "effectloader.h"
|
||||
#include "screens.h"
|
||||
#include "shell_client.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "scripting/scriptedeffect.h"
|
||||
|
@ -24,6 +36,7 @@
|
|||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
namespace KWin
|
||||
|
@ -44,6 +57,7 @@ private Q_SLOTS:
|
|||
void DontCrashCancelAnimationFromAnimationEndedTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Deleted*>();
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
@ -85,7 +99,7 @@ void DontCrashCancelAnimationFromAnimationEndedTest::testScript()
|
|||
// create a window
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
// let's render
|
||||
auto c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
|
|
|
@ -1,18 +1,30 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2018 Martin Flöser <mgraesslin@kde.org>
|
||||
Copyright (C) 2018 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "composite.h"
|
||||
#include "effectloader.h"
|
||||
#include "x11client.h"
|
||||
#include "client.h"
|
||||
#include "cursor.h"
|
||||
#include "effects.h"
|
||||
#include "platform.h"
|
||||
#include "shell_client.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
@ -21,9 +33,10 @@
|
|||
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <KWayland/Client/server_decoration.h>
|
||||
#include <KWayland/Client/xdgshell.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWaylandServer/display.h>
|
||||
#include <KWaylandServer/output_interface.h>
|
||||
#include <KWayland/Server/display.h>
|
||||
#include <KWayland/Server/output_interface.h>
|
||||
|
||||
using namespace KWin;
|
||||
using namespace KWayland::Client;
|
||||
|
@ -36,6 +49,7 @@ private Q_SLOTS:
|
|||
void init();
|
||||
void initTestCase();
|
||||
void cleanup();
|
||||
void testMoveCursorOverDeco_data();
|
||||
void testMoveCursorOverDeco();
|
||||
};
|
||||
|
||||
|
@ -44,7 +58,7 @@ void DontCrashCursorPhysicalSizeEmpty::init()
|
|||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
KWin::Cursor::setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void DontCrashCursorPhysicalSizeEmpty::cleanup()
|
||||
|
@ -54,9 +68,10 @@ void DontCrashCursorPhysicalSizeEmpty::cleanup()
|
|||
|
||||
void DontCrashCursorPhysicalSizeEmpty::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
|
@ -69,7 +84,16 @@ void DontCrashCursorPhysicalSizeEmpty::initTestCase()
|
|||
qputenv("XCURSOR_SIZE", QByteArrayLiteral("0"));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
}
|
||||
|
||||
void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco_data()
|
||||
{
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6;
|
||||
}
|
||||
|
||||
void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco()
|
||||
|
@ -78,21 +102,22 @@ void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco()
|
|||
// a reason for creation failure could be physical size not existing
|
||||
// see BUG: 390314
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
Test::waylandServerSideDecoration()->create(surface.data(), surface.data());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data()));
|
||||
|
||||
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
|
||||
// destroy physical size
|
||||
KWaylandServer::Display *display = waylandServer()->display();
|
||||
KWayland::Server::Display *display = waylandServer()->display();
|
||||
auto output = display->outputs().first();
|
||||
output->setPhysicalSize(QSize(0, 0));
|
||||
// and fake a cursor theme change, so that the theme gets recreated
|
||||
emit KWin::Cursors::self()->mouse()->themeChanged();
|
||||
emit KWin::Cursor::self()->themeChanged();
|
||||
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(c->frameGeometry().center().x(), c->clientPos().y() / 2));
|
||||
KWin::Cursor::setPos(QPoint(c->geometry().center().x(), c->clientPos().y() / 2));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(DontCrashCursorPhysicalSizeEmpty)
|
||||
|
|
|
@ -1,21 +1,31 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "platform.h"
|
||||
#include "x11client.h"
|
||||
#include "composite.h"
|
||||
#include "client.h"
|
||||
#include "cursor.h"
|
||||
#include "scene.h"
|
||||
#include "screenedge.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "shell_client.h"
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include <KDecoration2/Decoration>
|
||||
|
@ -38,32 +48,32 @@ private Q_SLOTS:
|
|||
|
||||
void DontCrashEmptyDecorationTest::initTestCase()
|
||||
{
|
||||
if (!QFile::exists(QStringLiteral("/dev/dri/card0"))) {
|
||||
QSKIP("Needs a dri device");
|
||||
}
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// this test needs to enforce OpenGL compositing to get into the crashy condition
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
setenv("QT_QPA_PLATFORM", "wayland", true);
|
||||
waylandServer()->initWorkspace();
|
||||
|
||||
auto scene = KWin::Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
QCOMPARE(scene->compositingType(), KWin::OpenGL2Compositing);
|
||||
}
|
||||
|
||||
void DontCrashEmptyDecorationTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void DontCrashEmptyDecorationTest::testBug361551()
|
||||
|
@ -85,14 +95,14 @@ void DontCrashEmptyDecorationTest::testBug361551()
|
|||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded);
|
||||
QVERIFY(windowCreatedSpy.isValid());
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Client *client = windowCreatedSpy.first().first().value<X11Client *>();
|
||||
Client *client = windowCreatedSpy.first().first().value<Client*>();
|
||||
QVERIFY(client);
|
||||
QCOMPARE(client->window(), w);
|
||||
QVERIFY(client->isDecorated());
|
||||
|
||||
// let's set a stupid geometry
|
||||
client->setFrameGeometry({0, 0, 0, 0});
|
||||
QCOMPARE(client->frameGeometry(), QRect(0, 0, 0, 0));
|
||||
client->setGeometry(0, 0, 0, 0);
|
||||
QCOMPARE(client->geometry(), QRect(0, 0, 0, 0));
|
||||
|
||||
// and destroy the window again
|
||||
xcb_unmap_window(c, w);
|
||||
|
@ -100,7 +110,7 @@ void DontCrashEmptyDecorationTest::testBug361551()
|
|||
xcb_flush(c);
|
||||
xcb_disconnect(c);
|
||||
|
||||
QSignalSpy windowClosedSpy(client, &X11Client::windowClosed);
|
||||
QSignalSpy windowClosedSpy(client, &Client::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
}
|
||||
|
|
|
@ -1,15 +1,26 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "platform.h"
|
||||
#include "abstract_client.h"
|
||||
#include "x11client.h"
|
||||
#include "client.h"
|
||||
#include "deleted.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
|
@ -33,12 +44,12 @@ private Q_SLOTS:
|
|||
void DontCrashGlxgearsTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Deleted*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
}
|
||||
|
||||
void DontCrashGlxgearsTest::testGlxgears()
|
||||
|
@ -50,23 +61,21 @@ void DontCrashGlxgearsTest::testGlxgears()
|
|||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QProcess glxgears;
|
||||
glxgears.setProgram(QStringLiteral("glxgears"));
|
||||
glxgears.start();
|
||||
glxgears.start(QStringLiteral("glxgears"));
|
||||
QVERIFY(glxgears.waitForStarted());
|
||||
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
QCOMPARE(clientAddedSpy.count(), 1);
|
||||
QCOMPARE(workspace()->clientList().count(), 1);
|
||||
X11Client *glxgearsClient = workspace()->clientList().first();
|
||||
Client *glxgearsClient = workspace()->clientList().first();
|
||||
QVERIFY(glxgearsClient->isDecorated());
|
||||
QSignalSpy closedSpy(glxgearsClient, &X11Client::windowClosed);
|
||||
QSignalSpy closedSpy(glxgearsClient, &Client::windowClosed);
|
||||
QVERIFY(closedSpy.isValid());
|
||||
KDecoration2::Decoration *decoration = glxgearsClient->decoration();
|
||||
QVERIFY(decoration);
|
||||
|
||||
// send a mouse event to the position of the close button
|
||||
// TODO: position is dependent on the decoration in use. We should use a static target instead, a fake deco for autotests.
|
||||
QPointF pos = decoration->rect().topRight() + QPointF(-decoration->borderTop() / 2, decoration->borderTop() / 2);
|
||||
QPointF pos = decoration->rect().topRight() + QPointF(-decoration->borderRight() * 2, decoration->borderRight() * 2);
|
||||
QHoverEvent event(QEvent::HoverMove, pos, pos);
|
||||
QCoreApplication::instance()->sendEvent(decoration, &event);
|
||||
// mouse press
|
||||
|
|
|
@ -1,25 +1,36 @@
|
|||
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "platform.h"
|
||||
#include "x11client.h"
|
||||
#include "composite.h"
|
||||
#include "client.h"
|
||||
#include "cursor.h"
|
||||
#include "scene.h"
|
||||
#include "screenedge.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "shell_client.h"
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include <KWayland/Client/server_decoration.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <KDecoration2/Decoration>
|
||||
|
@ -38,17 +49,22 @@ private Q_SLOTS:
|
|||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
void testCreateWindow_data();
|
||||
void testCreateWindow();
|
||||
};
|
||||
|
||||
void DontCrashNoBorder::initTestCase()
|
||||
{
|
||||
if (!QFile::exists(QStringLiteral("/dev/dri/card0"))) {
|
||||
QSKIP("Needs a dri device");
|
||||
}
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
config->group("org.kde.kdecoration2").writeEntry("NoPlugin", true);
|
||||
|
@ -58,16 +74,12 @@ void DontCrashNoBorder::initTestCase()
|
|||
// this test needs to enforce OpenGL compositing to get into the crashy condition
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
setenv("QT_QPA_PLATFORM", "wayland", true);
|
||||
waylandServer()->initWorkspace();
|
||||
|
||||
auto scene = KWin::Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
QCOMPARE(scene->compositingType(), KWin::OpenGL2Compositing);
|
||||
}
|
||||
|
||||
void DontCrashNoBorder::init()
|
||||
|
@ -75,7 +87,7 @@ void DontCrashNoBorder::init()
|
|||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void DontCrashNoBorder::cleanup()
|
||||
|
@ -83,6 +95,15 @@ void DontCrashNoBorder::cleanup()
|
|||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DontCrashNoBorder::testCreateWindow_data()
|
||||
{
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6;
|
||||
}
|
||||
|
||||
void DontCrashNoBorder::testCreateWindow()
|
||||
{
|
||||
// create a window and ensure that this doesn't crash
|
||||
|
@ -90,7 +111,8 @@ void DontCrashNoBorder::testCreateWindow()
|
|||
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data()));
|
||||
QVERIFY(shellSurface);
|
||||
QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data()));
|
||||
QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged);
|
||||
|
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "abstract_client.h"
|
||||
#include "composite.h"
|
||||
#include "deleted.h"
|
||||
#include "effectloader.h"
|
||||
#include "effects.h"
|
||||
#include "platform.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include "effect_builtins.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Client/xdgshell.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dont_crash_reinitialize_compositor-0");
|
||||
|
||||
class DontCrashReinitializeCompositorTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testReinitializeCompositor_data();
|
||||
void testReinitializeCompositor();
|
||||
};
|
||||
|
||||
void DontCrashReinitializeCompositorTest::initTestCase()
|
||||
{
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::AbstractClient *>();
|
||||
qRegisterMetaType<KWin::Deleted *>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
ScriptedEffectLoader loader;
|
||||
const auto builtinNames = BuiltInEffects::availableEffectNames() << loader.listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
waylandServer()->initWorkspace();
|
||||
|
||||
auto scene = KWin::Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
QCOMPARE(scene->compositingType(), KWin::OpenGL2Compositing);
|
||||
}
|
||||
|
||||
void DontCrashReinitializeCompositorTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void DontCrashReinitializeCompositorTest::cleanup()
|
||||
{
|
||||
// Unload all effects.
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
effectsImpl->unloadAllEffects();
|
||||
QVERIFY(effectsImpl->loadedEffects().isEmpty());
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DontCrashReinitializeCompositorTest::testReinitializeCompositor_data()
|
||||
{
|
||||
QTest::addColumn<QString>("effectName");
|
||||
|
||||
QTest::newRow("Fade") << QStringLiteral("kwin4_effect_fade");
|
||||
QTest::newRow("Glide") << QStringLiteral("glide");
|
||||
QTest::newRow("Scale") << QStringLiteral("kwin4_effect_scale");
|
||||
}
|
||||
|
||||
void DontCrashReinitializeCompositorTest::testReinitializeCompositor()
|
||||
{
|
||||
// This test verifies that KWin doesn't crash when the compositor settings
|
||||
// have been changed while a scripted effect animates the disappearing of
|
||||
// a window.
|
||||
|
||||
// Make sure that we have the right effects ptr.
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
|
||||
// Create the test client.
|
||||
using namespace KWayland::Client;
|
||||
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client);
|
||||
|
||||
// Make sure that only the test effect is loaded.
|
||||
QFETCH(QString, effectName);
|
||||
QVERIFY(effectsImpl->loadEffect(effectName));
|
||||
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
|
||||
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
|
||||
Effect *effect = effectsImpl->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Close the test client.
|
||||
QSignalSpy windowClosedSpy(client, &AbstractClient::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
shellSurface.reset();
|
||||
surface.reset();
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
|
||||
// The test effect should start animating the test client. Is there a better
|
||||
// way to verify that the test effect actually animates the test client?
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Re-initialize the compositor, effects will be destroyed and created again.
|
||||
Compositor::self()->reinitialize();
|
||||
|
||||
// By this time, KWin should still be alive.
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::DontCrashReinitializeCompositorTest)
|
||||
#include "dont_crash_reinitialize_compositor.moc"
|
|
@ -1,17 +1,28 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "abstract_client.h"
|
||||
#include "cursor.h"
|
||||
#include "keyboard_input.h"
|
||||
#include "platform.h"
|
||||
#include "pointer_input.h"
|
||||
#include "shell_client.h"
|
||||
#include "screens.h"
|
||||
#include "useractions.h"
|
||||
#include "wayland_server.h"
|
||||
|
@ -20,6 +31,7 @@
|
|||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/keyboard.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
@ -45,18 +57,19 @@ private Q_SLOTS:
|
|||
|
||||
void TestDontCrashUseractionsMenu::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// force style to breeze as that's the one which triggered the crash
|
||||
QVERIFY(kwinApp()->setStyle(QStringLiteral("breeze")));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
|
@ -68,7 +81,7 @@ void TestDontCrashUseractionsMenu::init()
|
|||
QVERIFY(Test::setupWaylandConnection());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(1280, 512));
|
||||
KWin::Cursor::setPos(QPoint(1280, 512));
|
||||
}
|
||||
|
||||
void TestDontCrashUseractionsMenu::cleanup()
|
||||
|
@ -80,7 +93,7 @@ void TestDontCrashUseractionsMenu::testShowHideShowUseractionsMenu()
|
|||
{
|
||||
// this test creates the condition of BUG 382063
|
||||
QScopedPointer<Surface> surface1(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
|
||||
QScopedPointer<QObject> shellSurface1(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface1.data()));
|
||||
auto client = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client);
|
||||
|
||||
|
|
|
@ -3,10 +3,6 @@ if (XCB_ICCCM_FOUND)
|
|||
integrationTest(NAME testSlidingPopups SRCS slidingpopups_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testShadeWobblyWindows SRCS wobbly_shade_test.cpp LIBS XCB::ICCCM)
|
||||
endif()
|
||||
integrationTest(NAME testFade SRCS fade_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testEffectWindowGeometry SRCS windowgeometry_test.cpp)
|
||||
integrationTest(NAME testScriptedEffects SRCS scripted_effects_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testToplevelOpenCloseAnimation SRCS toplevel_open_close_animation_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testPopupOpenCloseAnimation SRCS popup_open_close_animation_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testDesktopSwitchingAnimation SRCS desktop_switching_animation_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testMinimizeAnimation SRCS minimize_animation_test.cpp)
|
||||
integrationTest(WAYLAND_ONLY NAME testMaximizeAnimation SRCS maximize_animation_test.cpp)
|
||||
|
|
|
@ -1,150 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "abstract_client.h"
|
||||
#include "composite.h"
|
||||
#include "effectloader.h"
|
||||
#include "effects.h"
|
||||
#include "platform.h"
|
||||
#include "scene.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include "effect_builtins.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Client/xdgshell.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_desktop_switching_animation-0");
|
||||
|
||||
class DesktopSwitchingAnimationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testSwitchDesktops_data();
|
||||
void testSwitchDesktops();
|
||||
};
|
||||
|
||||
void DesktopSwitchingAnimationTest::initTestCase()
|
||||
{
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::AbstractClient *>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
ScriptedEffectLoader loader;
|
||||
const auto builtinNames = BuiltInEffects::availableEffectNames() << loader.listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
waylandServer()->initWorkspace();
|
||||
|
||||
auto scene = Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
QCOMPARE(scene->compositingType(), OpenGL2Compositing);
|
||||
}
|
||||
|
||||
void DesktopSwitchingAnimationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void DesktopSwitchingAnimationTest::cleanup()
|
||||
{
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
effectsImpl->unloadAllEffects();
|
||||
QVERIFY(effectsImpl->loadedEffects().isEmpty());
|
||||
|
||||
VirtualDesktopManager::self()->setCount(1);
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DesktopSwitchingAnimationTest::testSwitchDesktops_data()
|
||||
{
|
||||
QTest::addColumn<QString>("effectName");
|
||||
|
||||
QTest::newRow("Desktop Cube Animation") << QStringLiteral("cubeslide");
|
||||
QTest::newRow("Fade Desktop") << QStringLiteral("kwin4_effect_fadedesktop");
|
||||
QTest::newRow("Slide") << QStringLiteral("slide");
|
||||
}
|
||||
|
||||
void DesktopSwitchingAnimationTest::testSwitchDesktops()
|
||||
{
|
||||
// This test verifies that virtual desktop switching animation effects actually
|
||||
// try to animate switching between desktops.
|
||||
|
||||
// We need at least 2 virtual desktops for the test.
|
||||
VirtualDesktopManager::self()->setCount(2);
|
||||
QCOMPARE(VirtualDesktopManager::self()->current(), 1u);
|
||||
QCOMPARE(VirtualDesktopManager::self()->count(), 2u);
|
||||
|
||||
// The Fade Desktop effect will do nothing if there are no clients to fade,
|
||||
// so we have to create a dummy test client.
|
||||
using namespace KWayland::Client;
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client);
|
||||
QCOMPARE(client->desktops().count(), 1);
|
||||
QCOMPARE(client->desktops().first(), VirtualDesktopManager::self()->desktops().first());
|
||||
|
||||
// Load effect that will be tested.
|
||||
QFETCH(QString, effectName);
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
QVERIFY(effectsImpl->loadEffect(effectName));
|
||||
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
|
||||
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
|
||||
Effect *effect = effectsImpl->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Switch to the second virtual desktop.
|
||||
VirtualDesktopManager::self()->setCurrent(2u);
|
||||
QCOMPARE(VirtualDesktopManager::self()->current(), 2u);
|
||||
QVERIFY(effect->isActive());
|
||||
QCOMPARE(effects->activeFullScreenEffect(), effect);
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
QTRY_COMPARE(effects->activeFullScreenEffect(), nullptr);
|
||||
|
||||
// Destroy the test client.
|
||||
surface.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(DesktopSwitchingAnimationTest)
|
||||
#include "desktop_switching_animation_test.moc"
|
|
@ -0,0 +1,182 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "composite.h"
|
||||
#include "effects.h"
|
||||
#include "effectloader.h"
|
||||
#include "cursor.h"
|
||||
#include "platform.h"
|
||||
#include "shell_client.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "effect_builtins.h"
|
||||
|
||||
#include <KConfigGroup>
|
||||
|
||||
#include <KWayland/Client/buffer.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
using namespace KWin;
|
||||
using namespace KWayland::Client;
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_translucency-0");
|
||||
|
||||
class FadeTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testWindowCloseAfterWindowHidden_data();
|
||||
void testWindowCloseAfterWindowHidden();
|
||||
|
||||
private:
|
||||
Effect *m_fadeEffect = nullptr;
|
||||
};
|
||||
|
||||
void FadeTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
qRegisterMetaType<KWin::Effect*>();
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// disable all effects - we don't want to have it interact with the rendering
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
ScriptedEffectLoader loader;
|
||||
const auto builtinNames = BuiltInEffects::availableEffectNames() << loader.listOfKnownEffects();
|
||||
for (QString name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", "1");
|
||||
kwinApp()->start();
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QVERIFY(KWin::Compositor::self());
|
||||
}
|
||||
|
||||
void FadeTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
|
||||
// load the translucency effect
|
||||
EffectsHandlerImpl *e = static_cast<EffectsHandlerImpl*>(effects);
|
||||
// find the effectsloader
|
||||
auto effectloader = e->findChild<AbstractEffectLoader*>();
|
||||
QVERIFY(effectloader);
|
||||
QSignalSpy effectLoadedSpy(effectloader, &AbstractEffectLoader::effectLoaded);
|
||||
QVERIFY(effectLoadedSpy.isValid());
|
||||
|
||||
QVERIFY(!e->isEffectLoaded(QStringLiteral("kwin4_effect_fade")));
|
||||
QVERIFY(e->loadEffect(QStringLiteral("kwin4_effect_fade")));
|
||||
QVERIFY(e->isEffectLoaded(QStringLiteral("kwin4_effect_fade")));
|
||||
|
||||
QCOMPARE(effectLoadedSpy.count(), 1);
|
||||
m_fadeEffect = effectLoadedSpy.first().first().value<Effect*>();
|
||||
QVERIFY(m_fadeEffect);
|
||||
}
|
||||
|
||||
void FadeTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
EffectsHandlerImpl *e = static_cast<EffectsHandlerImpl*>(effects);
|
||||
if (e->isEffectLoaded(QStringLiteral("kwin4_effect_fade"))) {
|
||||
e->unloadEffect(QStringLiteral("kwin4_effect_fade"));
|
||||
}
|
||||
QVERIFY(!e->isEffectLoaded(QStringLiteral("kwin4_effect_fade")));
|
||||
m_fadeEffect = nullptr;
|
||||
}
|
||||
|
||||
void FadeTest::testWindowCloseAfterWindowHidden_data()
|
||||
{
|
||||
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||
|
||||
QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
|
||||
QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5;
|
||||
QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6;
|
||||
}
|
||||
|
||||
void FadeTest::testWindowCloseAfterWindowHidden()
|
||||
{
|
||||
// this test simulates the showing/hiding/closing of a Wayland window
|
||||
// especially the situation that a window got unmapped and destroyed way later
|
||||
QVERIFY(!m_fadeEffect->isActive());
|
||||
|
||||
QSignalSpy windowAddedSpy(effects, &EffectsHandler::windowAdded);
|
||||
QVERIFY(windowAddedSpy.isValid());
|
||||
QSignalSpy windowHiddenSpy(effects, &EffectsHandler::windowHidden);
|
||||
QVERIFY(windowHiddenSpy.isValid());
|
||||
QSignalSpy windowShownSpy(effects, &EffectsHandler::windowShown);
|
||||
QVERIFY(windowShownSpy.isValid());
|
||||
QSignalSpy windowClosedSpy(effects, &EffectsHandler::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QFETCH(Test::ShellSurfaceType, type);
|
||||
QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data()));
|
||||
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QTRY_COMPARE(windowAddedSpy.count(), 1);
|
||||
QTRY_COMPARE(m_fadeEffect->isActive(), true);
|
||||
|
||||
QTest::qWait(500);
|
||||
QTRY_COMPARE(m_fadeEffect->isActive(), false);
|
||||
|
||||
// now unmap the surface
|
||||
surface->attachBuffer(Buffer::Ptr());
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
QVERIFY(windowHiddenSpy.wait());
|
||||
QCOMPARE(m_fadeEffect->isActive(), true);
|
||||
QTest::qWait(500);
|
||||
QTRY_COMPARE(m_fadeEffect->isActive(), false);
|
||||
|
||||
// and map again
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::red);
|
||||
QVERIFY(windowShownSpy.wait());
|
||||
QTRY_COMPARE(m_fadeEffect->isActive(), true);
|
||||
QTest::qWait(500);
|
||||
QTRY_COMPARE(m_fadeEffect->isActive(), false);
|
||||
|
||||
// and unmap once more
|
||||
surface->attachBuffer(Buffer::Ptr());
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
QVERIFY(windowHiddenSpy.wait());
|
||||
QCOMPARE(m_fadeEffect->isActive(), true);
|
||||
QTest::qWait(500);
|
||||
QTRY_COMPARE(m_fadeEffect->isActive(), false);
|
||||
|
||||
// and now destroy
|
||||
shellSurface.reset();
|
||||
surface.reset();
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
QCOMPARE(m_fadeEffect->isActive(), false);
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(FadeTest)
|
||||
#include "fade_test.moc"
|
|
@ -1,189 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "abstract_client.h"
|
||||
#include "composite.h"
|
||||
#include "effectloader.h"
|
||||
#include "effects.h"
|
||||
#include "platform.h"
|
||||
#include "scene.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include "effect_builtins.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Client/xdgshell.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_maximize_animation-0");
|
||||
|
||||
class MaximizeAnimationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testMaximizeRestore();
|
||||
};
|
||||
|
||||
void MaximizeAnimationTest::initTestCase()
|
||||
{
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::AbstractClient *>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
ScriptedEffectLoader loader;
|
||||
const auto builtinNames = BuiltInEffects::availableEffectNames() << loader.listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
waylandServer()->initWorkspace();
|
||||
}
|
||||
|
||||
void MaximizeAnimationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void MaximizeAnimationTest::cleanup()
|
||||
{
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
effectsImpl->unloadAllEffects();
|
||||
QVERIFY(effectsImpl->loadedEffects().isEmpty());
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void MaximizeAnimationTest::testMaximizeRestore()
|
||||
{
|
||||
// This test verifies that the maximize effect animates a client
|
||||
// when it's maximized or restored.
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
// Create the test client.
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly));
|
||||
|
||||
// Wait for the initial configure event.
|
||||
XdgShellSurface::States states;
|
||||
QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested);
|
||||
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
|
||||
QVERIFY(configureRequestedSpy.isValid());
|
||||
QVERIFY(configureRequestedSpy.wait());
|
||||
QCOMPARE(configureRequestedSpy.count(), 1);
|
||||
QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(0, 0));
|
||||
states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>();
|
||||
QVERIFY(!states.testFlag(XdgShellSurface::State::Activated));
|
||||
QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized));
|
||||
|
||||
// Draw contents of the surface.
|
||||
shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>());
|
||||
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client);
|
||||
QVERIFY(client->isActive());
|
||||
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
||||
|
||||
// We should receive a configure event when the client becomes active.
|
||||
QVERIFY(configureRequestedSpy.wait());
|
||||
QCOMPARE(configureRequestedSpy.count(), 2);
|
||||
states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>();
|
||||
QVERIFY(states.testFlag(XdgShellSurface::State::Activated));
|
||||
QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized));
|
||||
|
||||
// Load effect that will be tested.
|
||||
const QString effectName = QStringLiteral("kwin4_effect_maximize");
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
QVERIFY(effectsImpl->loadEffect(effectName));
|
||||
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
|
||||
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
|
||||
Effect *effect = effectsImpl->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Maximize the client.
|
||||
QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged);
|
||||
QVERIFY(frameGeometryChangedSpy.isValid());
|
||||
QSignalSpy maximizeChangedSpy(client, qOverload<AbstractClient *, bool, bool>(&AbstractClient::clientMaximizedStateChanged));
|
||||
QVERIFY(maximizeChangedSpy.isValid());
|
||||
|
||||
workspace()->slotWindowMaximize();
|
||||
QVERIFY(configureRequestedSpy.wait());
|
||||
QCOMPARE(configureRequestedSpy.count(), 3);
|
||||
QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(1280, 1024));
|
||||
states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>();
|
||||
QVERIFY(states.testFlag(XdgShellSurface::State::Activated));
|
||||
QVERIFY(states.testFlag(XdgShellSurface::State::Maximized));
|
||||
|
||||
// Draw contents of the maximized client.
|
||||
shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>());
|
||||
Test::render(surface.data(), QSize(1280, 1024), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy.wait());
|
||||
QCOMPARE(frameGeometryChangedSpy.count(), 1);
|
||||
QCOMPARE(maximizeChangedSpy.count(), 1);
|
||||
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Restore the client.
|
||||
workspace()->slotWindowMaximize();
|
||||
QVERIFY(configureRequestedSpy.wait());
|
||||
QCOMPARE(configureRequestedSpy.count(), 4);
|
||||
QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(100, 50));
|
||||
states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>();
|
||||
QVERIFY(states.testFlag(XdgShellSurface::State::Activated));
|
||||
QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized));
|
||||
|
||||
// Draw contents of the restored client.
|
||||
shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>());
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(frameGeometryChangedSpy.wait());
|
||||
QCOMPARE(frameGeometryChangedSpy.count(), 2);
|
||||
QCOMPARE(maximizeChangedSpy.count(), 2);
|
||||
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the test client.
|
||||
surface.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(MaximizeAnimationTest)
|
||||
#include "maximize_animation_test.moc"
|
|
@ -1,185 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "abstract_client.h"
|
||||
#include "composite.h"
|
||||
#include "effectloader.h"
|
||||
#include "effects.h"
|
||||
#include "platform.h"
|
||||
#include "scene.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include "effect_builtins.h"
|
||||
|
||||
#include <KWayland/Client/plasmashell.h>
|
||||
#include <KWayland/Client/plasmawindowmanagement.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Client/xdgshell.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_minimize_animation-0");
|
||||
|
||||
class MinimizeAnimationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testMinimizeUnminimize_data();
|
||||
void testMinimizeUnminimize();
|
||||
};
|
||||
|
||||
void MinimizeAnimationTest::initTestCase()
|
||||
{
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::AbstractClient *>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
ScriptedEffectLoader loader;
|
||||
const auto builtinNames = BuiltInEffects::availableEffectNames() << loader.listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
waylandServer()->initWorkspace();
|
||||
|
||||
auto scene = Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
QCOMPARE(scene->compositingType(), OpenGL2Compositing);
|
||||
}
|
||||
|
||||
void MinimizeAnimationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection(
|
||||
Test::AdditionalWaylandInterface::PlasmaShell |
|
||||
Test::AdditionalWaylandInterface::WindowManagement
|
||||
));
|
||||
}
|
||||
|
||||
void MinimizeAnimationTest::cleanup()
|
||||
{
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
effectsImpl->unloadAllEffects();
|
||||
QVERIFY(effectsImpl->loadedEffects().isEmpty());
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void MinimizeAnimationTest::testMinimizeUnminimize_data()
|
||||
{
|
||||
QTest::addColumn<QString>("effectName");
|
||||
|
||||
QTest::newRow("Magic Lamp") << QStringLiteral("magiclamp");
|
||||
QTest::newRow("Squash") << QStringLiteral("kwin4_effect_squash");
|
||||
}
|
||||
|
||||
void MinimizeAnimationTest::testMinimizeUnminimize()
|
||||
{
|
||||
// This test verifies that a minimize effect tries to animate a client
|
||||
// when it's minimized or unminimized.
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
QSignalSpy plasmaWindowCreatedSpy(Test::waylandWindowManagement(), &PlasmaWindowManagement::windowCreated);
|
||||
QVERIFY(plasmaWindowCreatedSpy.isValid());
|
||||
|
||||
// Create a panel at the top of the screen.
|
||||
const QRect panelRect = QRect(0, 0, 1280, 36);
|
||||
QScopedPointer<Surface> panelSurface(Test::createSurface());
|
||||
QVERIFY(!panelSurface.isNull());
|
||||
QScopedPointer<XdgShellSurface> panelShellSurface(Test::createXdgShellStableSurface(panelSurface.data()));
|
||||
QVERIFY(!panelShellSurface.isNull());
|
||||
QScopedPointer<PlasmaShellSurface> plasmaPanelShellSurface(Test::waylandPlasmaShell()->createSurface(panelSurface.data()));
|
||||
QVERIFY(!plasmaPanelShellSurface.isNull());
|
||||
plasmaPanelShellSurface->setRole(PlasmaShellSurface::Role::Panel);
|
||||
plasmaPanelShellSurface->setPosition(panelRect.topLeft());
|
||||
plasmaPanelShellSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible);
|
||||
AbstractClient *panel = Test::renderAndWaitForShown(panelSurface.data(), panelRect.size(), Qt::blue);
|
||||
QVERIFY(panel);
|
||||
QVERIFY(panel->isDock());
|
||||
QCOMPARE(panel->frameGeometry(), panelRect);
|
||||
QVERIFY(plasmaWindowCreatedSpy.wait());
|
||||
QCOMPARE(plasmaWindowCreatedSpy.count(), 1);
|
||||
|
||||
// Create the test client.
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::red);
|
||||
QVERIFY(client);
|
||||
QVERIFY(plasmaWindowCreatedSpy.wait());
|
||||
QCOMPARE(plasmaWindowCreatedSpy.count(), 2);
|
||||
|
||||
// We have to set the minimized geometry because the squash effect needs it,
|
||||
// otherwise it won't start animation.
|
||||
auto window = plasmaWindowCreatedSpy.last().first().value<PlasmaWindow *>();
|
||||
QVERIFY(window);
|
||||
const QRect iconRect = QRect(0, 0, 42, 36);
|
||||
window->setMinimizedGeometry(panelSurface.data(), iconRect);
|
||||
Test::flushWaylandConnection();
|
||||
QTRY_COMPARE(client->iconGeometry(), iconRect.translated(panel->frameGeometry().topLeft()));
|
||||
|
||||
// Load effect that will be tested.
|
||||
QFETCH(QString, effectName);
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
QVERIFY(effectsImpl->loadEffect(effectName));
|
||||
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
|
||||
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
|
||||
Effect *effect = effectsImpl->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Start the minimize animation.
|
||||
client->minimize();
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Start the unminimize animation.
|
||||
client->unminimize();
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the panel.
|
||||
panelSurface.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(panel));
|
||||
|
||||
// Destroy the test client.
|
||||
surface.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(MinimizeAnimationTest)
|
||||
#include "minimize_animation_test.moc"
|
|
@ -1,267 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "abstract_client.h"
|
||||
#include "deleted.h"
|
||||
#include "effectloader.h"
|
||||
#include "effects.h"
|
||||
#include "internal_client.h"
|
||||
#include "platform.h"
|
||||
#include "useractions.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include "decorations/decoratedclient.h"
|
||||
|
||||
#include "effect_builtins.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Client/xdgdecoration.h>
|
||||
#include <KWayland/Client/xdgshell.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_popup_open_close_animation-0");
|
||||
|
||||
class PopupOpenCloseAnimationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testAnimatePopups();
|
||||
void testAnimateUserActionsPopup();
|
||||
void testAnimateDecorationTooltips();
|
||||
};
|
||||
|
||||
void PopupOpenCloseAnimationTest::initTestCase()
|
||||
{
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::AbstractClient *>();
|
||||
qRegisterMetaType<KWin::Deleted *>();
|
||||
qRegisterMetaType<KWin::InternalClient *>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
ScriptedEffectLoader loader;
|
||||
const auto builtinNames = BuiltInEffects::availableEffectNames() << loader.listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
waylandServer()->initWorkspace();
|
||||
}
|
||||
|
||||
void PopupOpenCloseAnimationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::XdgDecoration));
|
||||
}
|
||||
|
||||
void PopupOpenCloseAnimationTest::cleanup()
|
||||
{
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
effectsImpl->unloadAllEffects();
|
||||
QVERIFY(effectsImpl->loadedEffects().isEmpty());
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void PopupOpenCloseAnimationTest::testAnimatePopups()
|
||||
{
|
||||
// This test verifies that popup open/close animation effects try
|
||||
// to animate popups(e.g. popup menus, tooltips, etc).
|
||||
|
||||
// Make sure that we have the right effects ptr.
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
|
||||
// Create the main window.
|
||||
using namespace KWayland::Client;
|
||||
QScopedPointer<Surface> mainWindowSurface(Test::createSurface());
|
||||
QVERIFY(!mainWindowSurface.isNull());
|
||||
QScopedPointer<XdgShellSurface> mainWindowShellSurface(Test::createXdgShellStableSurface(mainWindowSurface.data()));
|
||||
QVERIFY(!mainWindowShellSurface.isNull());
|
||||
AbstractClient *mainWindow = Test::renderAndWaitForShown(mainWindowSurface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(mainWindow);
|
||||
|
||||
// Load effect that will be tested.
|
||||
const QString effectName = QStringLiteral("kwin4_effect_fadingpopups");
|
||||
QVERIFY(effectsImpl->loadEffect(effectName));
|
||||
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
|
||||
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
|
||||
Effect *effect = effectsImpl->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Create a popup, it should be animated.
|
||||
QScopedPointer<Surface> popupSurface(Test::createSurface());
|
||||
QVERIFY(!popupSurface.isNull());
|
||||
XdgPositioner positioner(QSize(20, 20), QRect(0, 0, 10, 10));
|
||||
positioner.setGravity(Qt::BottomEdge | Qt::RightEdge);
|
||||
positioner.setAnchorEdge(Qt::BottomEdge | Qt::LeftEdge);
|
||||
QScopedPointer<XdgShellPopup> popupShellSurface(Test::createXdgShellStablePopup(popupSurface.data(), mainWindowShellSurface.data(), positioner));
|
||||
QVERIFY(!popupShellSurface.isNull());
|
||||
AbstractClient *popup = Test::renderAndWaitForShown(popupSurface.data(), positioner.initialSize(), Qt::red);
|
||||
QVERIFY(popup);
|
||||
QVERIFY(popup->isPopupWindow());
|
||||
QCOMPARE(popup->transientFor(), mainWindow);
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the popup, it should not be animated.
|
||||
QSignalSpy popupClosedSpy(popup, &AbstractClient::windowClosed);
|
||||
QVERIFY(popupClosedSpy.isValid());
|
||||
popupShellSurface.reset();
|
||||
popupSurface.reset();
|
||||
QVERIFY(popupClosedSpy.wait());
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the main window.
|
||||
mainWindowSurface.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(mainWindow));
|
||||
}
|
||||
|
||||
void PopupOpenCloseAnimationTest::testAnimateUserActionsPopup()
|
||||
{
|
||||
// This test verifies that popup open/close animation effects try
|
||||
// to animate the user actions popup.
|
||||
|
||||
// Make sure that we have the right effects ptr.
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
|
||||
// Create the test client.
|
||||
using namespace KWayland::Client;
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client);
|
||||
|
||||
// Load effect that will be tested.
|
||||
const QString effectName = QStringLiteral("kwin4_effect_fadingpopups");
|
||||
QVERIFY(effectsImpl->loadEffect(effectName));
|
||||
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
|
||||
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
|
||||
Effect *effect = effectsImpl->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Show the user actions popup.
|
||||
workspace()->showWindowMenu(QRect(), client);
|
||||
auto userActionsMenu = workspace()->userActionsMenu();
|
||||
QTRY_VERIFY(userActionsMenu->isShown());
|
||||
QVERIFY(userActionsMenu->hasClient());
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Close the user actions popup.
|
||||
kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, 0);
|
||||
kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, 1);
|
||||
QTRY_VERIFY(!userActionsMenu->isShown());
|
||||
QVERIFY(!userActionsMenu->hasClient());
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the test client.
|
||||
surface.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client));
|
||||
}
|
||||
|
||||
void PopupOpenCloseAnimationTest::testAnimateDecorationTooltips()
|
||||
{
|
||||
// This test verifies that popup open/close animation effects try
|
||||
// to animate decoration tooltips.
|
||||
|
||||
// Make sure that we have the right effects ptr.
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
|
||||
// Create the test client.
|
||||
using namespace KWayland::Client;
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QScopedPointer<XdgDecoration> deco(Test::xdgDecorationManager()->getToplevelDecoration(shellSurface.data()));
|
||||
QVERIFY(!deco.isNull());
|
||||
deco->setMode(XdgDecoration::Mode::ServerSide);
|
||||
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client);
|
||||
QVERIFY(client->isDecorated());
|
||||
|
||||
// Load effect that will be tested.
|
||||
const QString effectName = QStringLiteral("kwin4_effect_fadingpopups");
|
||||
QVERIFY(effectsImpl->loadEffect(effectName));
|
||||
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
|
||||
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
|
||||
Effect *effect = effectsImpl->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Show a decoration tooltip.
|
||||
QSignalSpy tooltipAddedSpy(workspace(), &Workspace::internalClientAdded);
|
||||
QVERIFY(tooltipAddedSpy.isValid());
|
||||
client->decoratedClient()->requestShowToolTip(QStringLiteral("KWin rocks!"));
|
||||
QVERIFY(tooltipAddedSpy.wait());
|
||||
InternalClient *tooltip = tooltipAddedSpy.first().first().value<InternalClient *>();
|
||||
QVERIFY(tooltip->isInternal());
|
||||
QVERIFY(tooltip->isPopupWindow());
|
||||
QVERIFY(tooltip->internalWindow()->flags().testFlag(Qt::ToolTip));
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Hide the decoration tooltip.
|
||||
QSignalSpy tooltipClosedSpy(tooltip, &InternalClient::windowClosed);
|
||||
QVERIFY(tooltipClosedSpy.isValid());
|
||||
client->decoratedClient()->requestHideToolTip();
|
||||
QVERIFY(tooltipClosedSpy.wait());
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the test client.
|
||||
surface.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(client));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(PopupOpenCloseAnimationTest)
|
||||
#include "popup_open_close_animation_test.moc"
|
|
@ -1,24 +1,35 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2018 David Edmundson <davidedmundson@kde.org>
|
||||
Copyright (C) 2018 David Edmundson <davidedmundson@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http:// www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#include "scripting/scriptedeffect.h"
|
||||
#include "libkwineffects/anidata_p.h"
|
||||
|
||||
#include "abstract_client.h"
|
||||
#include "composite.h"
|
||||
#include "cursor.h"
|
||||
#include "deleted.h"
|
||||
#include "cursor.h"
|
||||
#include "effect_builtins.h"
|
||||
#include "effectloader.h"
|
||||
#include "effects.h"
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "platform.h"
|
||||
#include "shell_client.h"
|
||||
#include "virtualdesktops.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
@ -38,8 +49,6 @@
|
|||
#include <KWayland/Client/xdgshell.h>
|
||||
|
||||
using namespace KWin;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_scripts-0");
|
||||
|
||||
class ScriptedEffectsTest : public QObject
|
||||
|
@ -57,18 +66,6 @@ private Q_SLOTS:
|
|||
void testAnimations();
|
||||
void testScreenEdge();
|
||||
void testScreenEdgeTouch();
|
||||
void testFullScreenEffect_data();
|
||||
void testFullScreenEffect();
|
||||
void testKeepAlive_data();
|
||||
void testKeepAlive();
|
||||
void testGrab();
|
||||
void testGrabAlreadyGrabbedWindow();
|
||||
void testGrabAlreadyGrabbedWindowForced();
|
||||
void testUngrab();
|
||||
void testRedirect_data();
|
||||
void testRedirect();
|
||||
void testComplete();
|
||||
|
||||
private:
|
||||
ScriptedEffect *loadEffect(const QString &name);
|
||||
};
|
||||
|
@ -79,7 +76,6 @@ class ScriptedEffectWithDebugSpy : public KWin::ScriptedEffect
|
|||
public:
|
||||
ScriptedEffectWithDebugSpy();
|
||||
bool load(const QString &name);
|
||||
using AnimationEffect::AniMap;
|
||||
using AnimationEffect::state;
|
||||
signals:
|
||||
void testOutput(const QString &data);
|
||||
|
@ -132,11 +128,11 @@ bool ScriptedEffectWithDebugSpy::load(const QString &name)
|
|||
|
||||
void ScriptedEffectsTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
qRegisterMetaType<KWin::Deleted*>();
|
||||
qRegisterMetaType<KWin::Effect*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
|
@ -156,13 +152,9 @@ void ScriptedEffectsTest::initTestCase()
|
|||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", "1");
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QVERIFY(Compositor::self());
|
||||
|
||||
auto scene = KWin::Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
QCOMPARE(scene->compositingType(), KWin::OpenGL2Compositing);
|
||||
|
||||
KWin::VirtualDesktopManager::self()->setCount(2);
|
||||
}
|
||||
|
||||
|
@ -174,12 +166,12 @@ void ScriptedEffectsTest::init()
|
|||
void ScriptedEffectsTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
|
||||
auto effectsImpl = static_cast<EffectsHandlerImpl *>(effects);
|
||||
effectsImpl->unloadAllEffects();
|
||||
QVERIFY(effectsImpl->loadedEffects().isEmpty());
|
||||
|
||||
KWin::VirtualDesktopManager::self()->setCurrent(1);
|
||||
auto *e = static_cast<EffectsHandlerImpl*>(effects);
|
||||
while (!e->loadedEffects().isEmpty()) {
|
||||
const QString effect = e->loadedEffects().first();
|
||||
e->unloadEffect(effect);
|
||||
QVERIFY(!e->isEffectLoaded(effect));
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testEffectsHandler()
|
||||
|
@ -187,7 +179,7 @@ void ScriptedEffectsTest::testEffectsHandler()
|
|||
// this triggers and tests some of the signals in EffectHandler, which is exposed to JS as context property "effects"
|
||||
auto *effect = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
auto waitFor = [&effectOutputSpy](const QString &expected) {
|
||||
auto waitFor = [&effectOutputSpy, this](const QString &expected) {
|
||||
QVERIFY(effectOutputSpy.count() > 0 || effectOutputSpy.wait());
|
||||
QCOMPARE(effectOutputSpy.first().first(), expected);
|
||||
effectOutputSpy.removeFirst();
|
||||
|
@ -200,7 +192,7 @@ void ScriptedEffectsTest::testEffectsHandler()
|
|||
using namespace KWayland::Client;
|
||||
auto *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
auto *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
auto *shellSurface = Test::createXdgShellV6Surface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
shellSurface->setTitle("WindowA");
|
||||
auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
|
@ -279,32 +271,35 @@ void ScriptedEffectsTest::testAnimations()
|
|||
using namespace KWayland::Client;
|
||||
auto *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
auto *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
auto *shellSurface = Test::createXdgShellV6Surface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
shellSurface->setTitle("Window 1");
|
||||
auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeClient(), c);
|
||||
|
||||
// we are running the event loop during renderAndWaitForShown
|
||||
// some time will pass with the event loop running between the window being added and getting to here
|
||||
// anim.duration is an aboslute value, but retarget will update the duration based on time passed
|
||||
int timePassed = 0;
|
||||
|
||||
{
|
||||
const auto state = effect->state();
|
||||
const AnimationEffect::AniMap state = effect->state();
|
||||
QCOMPARE(state.count(), 1);
|
||||
QCOMPARE(state.firstKey(), c->effectWindow());
|
||||
const auto &animationsForWindow = state.first().first;
|
||||
QCOMPARE(animationsForWindow.count(), animationCount);
|
||||
QCOMPARE(animationsForWindow[0].timeLine.duration(), 100ms);
|
||||
QCOMPARE(animationsForWindow[0].duration, 100);
|
||||
QCOMPARE(animationsForWindow[0].to, FPx2(1.4));
|
||||
QCOMPARE(animationsForWindow[0].attribute, AnimationEffect::Scale);
|
||||
QCOMPARE(animationsForWindow[0].timeLine.easingCurve().type(), QEasingCurve::OutCubic);
|
||||
QCOMPARE(animationsForWindow[0].terminationFlags,
|
||||
AnimationEffect::TerminateAtSource | AnimationEffect::TerminateAtTarget);
|
||||
|
||||
QCOMPARE(animationsForWindow[0].curve.type(), QEasingCurve::OutQuad);
|
||||
QCOMPARE(animationsForWindow[0].keepAtTarget, false);
|
||||
timePassed = animationsForWindow[0].time;
|
||||
if (animationCount == 2) {
|
||||
QCOMPARE(animationsForWindow[1].timeLine.duration(), 100ms);
|
||||
QCOMPARE(animationsForWindow[1].duration, 100);
|
||||
QCOMPARE(animationsForWindow[1].to, FPx2(0.0));
|
||||
QCOMPARE(animationsForWindow[1].attribute, AnimationEffect::Opacity);
|
||||
QCOMPARE(animationsForWindow[1].terminationFlags,
|
||||
AnimationEffect::TerminateAtSource | AnimationEffect::TerminateAtTarget);
|
||||
QCOMPARE(animationsForWindow[1].keepAtTarget, false);
|
||||
}
|
||||
}
|
||||
QCOMPARE(effectOutputSpy[0].first(), "true");
|
||||
|
@ -313,26 +308,24 @@ void ScriptedEffectsTest::testAnimations()
|
|||
|
||||
c->setMinimized(true);
|
||||
{
|
||||
const auto state = effect->state();
|
||||
const AnimationEffect::AniMap state = effect->state();
|
||||
QCOMPARE(state.count(), 1);
|
||||
const auto &animationsForWindow = state.first().first;
|
||||
QCOMPARE(animationsForWindow.count(), animationCount);
|
||||
QCOMPARE(animationsForWindow[0].timeLine.duration(), 200ms);
|
||||
QCOMPARE(animationsForWindow[0].duration, 200 + timePassed);
|
||||
QCOMPARE(animationsForWindow[0].to, FPx2(1.5));
|
||||
QCOMPARE(animationsForWindow[0].attribute, AnimationEffect::Scale);
|
||||
QCOMPARE(animationsForWindow[0].terminationFlags,
|
||||
AnimationEffect::TerminateAtSource | AnimationEffect::TerminateAtTarget);
|
||||
QCOMPARE(animationsForWindow[0].keepAtTarget, false);
|
||||
if (animationCount == 2) {
|
||||
QCOMPARE(animationsForWindow[1].timeLine.duration(), 200ms);
|
||||
QCOMPARE(animationsForWindow[1].duration, 200 + timePassed);
|
||||
QCOMPARE(animationsForWindow[1].to, FPx2(1.5));
|
||||
QCOMPARE(animationsForWindow[1].attribute, AnimationEffect::Opacity);
|
||||
QCOMPARE(animationsForWindow[1].terminationFlags,
|
||||
AnimationEffect::TerminateAtSource | AnimationEffect::TerminateAtTarget);
|
||||
QCOMPARE(animationsForWindow[1].keepAtTarget, false);
|
||||
}
|
||||
}
|
||||
c->setMinimized(false);
|
||||
{
|
||||
const auto state = effect->state();
|
||||
const AnimationEffect::AniMap state = effect->state();
|
||||
QCOMPARE(state.count(), 0);
|
||||
}
|
||||
}
|
||||
|
@ -358,423 +351,5 @@ void ScriptedEffectsTest::testScreenEdgeTouch()
|
|||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testFullScreenEffect_data()
|
||||
{
|
||||
QTest::addColumn<QString>("file");
|
||||
|
||||
QTest::newRow("single") << "fullScreenEffectTest";
|
||||
QTest::newRow("multi") << "fullScreenEffectTestMulti";
|
||||
QTest::newRow("global") << "fullScreenEffectTestGlobal";
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testFullScreenEffect()
|
||||
{
|
||||
QFETCH(QString, file);
|
||||
|
||||
auto *effectMain = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean
|
||||
QSignalSpy effectOutputSpy(effectMain, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QSignalSpy fullScreenEffectActiveSpy(effects, &EffectsHandler::hasActiveFullScreenEffectChanged);
|
||||
QSignalSpy isActiveFullScreenEffectSpy(effectMain, &ScriptedEffect::isActiveFullScreenEffectChanged);
|
||||
|
||||
QVERIFY(effectMain->load(file));
|
||||
|
||||
//load any random effect from another test to confirm fullscreen effect state is correctly
|
||||
//shown as being someone else
|
||||
auto effectOther = new ScriptedEffectWithDebugSpy();
|
||||
QVERIFY(effectOther->load("screenEdgeTouchTest"));
|
||||
QSignalSpy isActiveFullScreenEffectSpyOther(effectOther, &ScriptedEffect::isActiveFullScreenEffectChanged);
|
||||
|
||||
using namespace KWayland::Client;
|
||||
auto *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
auto *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
shellSurface->setTitle("Window 1");
|
||||
auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeClient(), c);
|
||||
|
||||
QCOMPARE(effects->hasActiveFullScreenEffect(), false);
|
||||
QCOMPARE(effectMain->isActiveFullScreenEffect(), false);
|
||||
|
||||
//trigger animation
|
||||
KWin::VirtualDesktopManager::self()->setCurrent(2);
|
||||
|
||||
QCOMPARE(effects->activeFullScreenEffect(), effectMain);
|
||||
QCOMPARE(effects->hasActiveFullScreenEffect(), true);
|
||||
QCOMPARE(fullScreenEffectActiveSpy.count(), 1);
|
||||
|
||||
QCOMPARE(effectMain->isActiveFullScreenEffect(), true);
|
||||
QCOMPARE(isActiveFullScreenEffectSpy.count(), 1);
|
||||
|
||||
QCOMPARE(effectOther->isActiveFullScreenEffect(), false);
|
||||
QCOMPARE(isActiveFullScreenEffectSpyOther.count(), 0);
|
||||
|
||||
//after 500ms trigger another full screen animation
|
||||
QTest::qWait(500);
|
||||
KWin::VirtualDesktopManager::self()->setCurrent(1);
|
||||
QCOMPARE(effects->activeFullScreenEffect(), effectMain);
|
||||
|
||||
//after 1000ms (+a safety margin for time based tests) we should still be the active full screen effect
|
||||
//despite first animation expiring
|
||||
QTest::qWait(500+100);
|
||||
QCOMPARE(effects->activeFullScreenEffect(), effectMain);
|
||||
|
||||
//after 1500ms (+a safetey margin) we should have no full screen effect
|
||||
QTest::qWait(500+100);
|
||||
QCOMPARE(effects->activeFullScreenEffect(), nullptr);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testKeepAlive_data()
|
||||
{
|
||||
QTest::addColumn<QString>("file");
|
||||
QTest::addColumn<bool>("keepAlive");
|
||||
|
||||
QTest::newRow("keep") << "keepAliveTest" << true;
|
||||
QTest::newRow("don't keep") << "keepAliveTestDontKeep" << false;
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testKeepAlive()
|
||||
{
|
||||
// this test checks whether closed windows are kept alive
|
||||
// when keepAlive property is set to true(false)
|
||||
|
||||
QFETCH(QString, file);
|
||||
QFETCH(bool, keepAlive);
|
||||
|
||||
auto *effect = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effectOutputSpy.isValid());
|
||||
QVERIFY(effect->load(file));
|
||||
|
||||
// create a window
|
||||
using namespace KWayland::Client;
|
||||
auto *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
auto *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeClient(), c);
|
||||
|
||||
// no active animations at the beginning
|
||||
QCOMPARE(effect->state().count(), 0);
|
||||
|
||||
// trigger windowClosed signal
|
||||
surface->deleteLater();
|
||||
QVERIFY(effectOutputSpy.count() == 1 || effectOutputSpy.wait());
|
||||
|
||||
if (keepAlive) {
|
||||
QCOMPARE(effect->state().count(), 1);
|
||||
|
||||
QTest::qWait(500);
|
||||
QCOMPARE(effect->state().count(), 1);
|
||||
|
||||
QTest::qWait(500 + 100); // 100ms is extra safety margin
|
||||
QCOMPARE(effect->state().count(), 0);
|
||||
} else {
|
||||
// the test effect doesn't keep the window alive, so it should be
|
||||
// removed immediately
|
||||
QSignalSpy deletedRemovedSpy(workspace(), &Workspace::deletedRemoved);
|
||||
QVERIFY(deletedRemovedSpy.isValid());
|
||||
QVERIFY(deletedRemovedSpy.count() == 1 || deletedRemovedSpy.wait(100)); // 100ms is less than duration of the animation
|
||||
QCOMPARE(effect->state().count(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testGrab()
|
||||
{
|
||||
// this test verifies that scripted effects can grab windows that are
|
||||
// not already grabbed
|
||||
|
||||
// load the test effect
|
||||
auto effect = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effectOutputSpy.isValid());
|
||||
QVERIFY(effect->load(QStringLiteral("grabTest")));
|
||||
|
||||
// create test client
|
||||
using namespace KWayland::Client;
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
AbstractClient *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeClient(), c);
|
||||
|
||||
// the test effect should grab the test client successfully
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
QCOMPARE(effectOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
QCOMPARE(c->effectWindow()->data(WindowAddedGrabRole).value<void *>(), effect);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testGrabAlreadyGrabbedWindow()
|
||||
{
|
||||
// this test verifies that scripted effects cannot grab already grabbed
|
||||
// windows (unless force is set to true of course)
|
||||
|
||||
// load effect that will hold the window grab
|
||||
auto owner = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy ownerOutputSpy(owner, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(ownerOutputSpy.isValid());
|
||||
QVERIFY(owner->load(QStringLiteral("grabAlreadyGrabbedWindowTest_owner")));
|
||||
|
||||
// load effect that will try to grab already grabbed window
|
||||
auto grabber = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy grabberOutputSpy(grabber, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(grabberOutputSpy.isValid());
|
||||
QVERIFY(grabber->load(QStringLiteral("grabAlreadyGrabbedWindowTest_grabber")));
|
||||
|
||||
// create test client
|
||||
using namespace KWayland::Client;
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
AbstractClient *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeClient(), c);
|
||||
|
||||
// effect that initially held the grab should still hold the grab
|
||||
QCOMPARE(ownerOutputSpy.count(), 1);
|
||||
QCOMPARE(ownerOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
QCOMPARE(c->effectWindow()->data(WindowAddedGrabRole).value<void *>(), owner);
|
||||
|
||||
// effect that tried to grab already grabbed window should fail miserably
|
||||
QCOMPARE(grabberOutputSpy.count(), 1);
|
||||
QCOMPARE(grabberOutputSpy.first().first(), QStringLiteral("fail"));
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testGrabAlreadyGrabbedWindowForced()
|
||||
{
|
||||
// this test verifies that scripted effects can steal window grabs when
|
||||
// they forcefully try to grab windows
|
||||
|
||||
// load effect that initially will be holding the window grab
|
||||
auto owner = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy ownerOutputSpy(owner, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(ownerOutputSpy.isValid());
|
||||
QVERIFY(owner->load(QStringLiteral("grabAlreadyGrabbedWindowForcedTest_owner")));
|
||||
|
||||
// load effect that will try to steal the window grab
|
||||
auto thief = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy thiefOutputSpy(thief, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(thiefOutputSpy.isValid());
|
||||
QVERIFY(thief->load(QStringLiteral("grabAlreadyGrabbedWindowForcedTest_thief")));
|
||||
|
||||
// create test client
|
||||
using namespace KWayland::Client;
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
AbstractClient *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeClient(), c);
|
||||
|
||||
// verify that the owner in fact held the grab
|
||||
QCOMPARE(ownerOutputSpy.count(), 1);
|
||||
QCOMPARE(ownerOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
|
||||
// effect that grabbed the test client forcefully should now hold the grab
|
||||
QCOMPARE(thiefOutputSpy.count(), 1);
|
||||
QCOMPARE(thiefOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
QCOMPARE(c->effectWindow()->data(WindowAddedGrabRole).value<void *>(), thief);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testUngrab()
|
||||
{
|
||||
// this test verifies that scripted effects can ungrab windows that they
|
||||
// are previously grabbed
|
||||
|
||||
// load the test effect
|
||||
auto effect = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effectOutputSpy.isValid());
|
||||
QVERIFY(effect->load(QStringLiteral("ungrabTest")));
|
||||
|
||||
// create test client
|
||||
using namespace KWayland::Client;
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
AbstractClient *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeClient(), c);
|
||||
|
||||
// the test effect should grab the test client successfully
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
QCOMPARE(effectOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
QCOMPARE(c->effectWindow()->data(WindowAddedGrabRole).value<void *>(), effect);
|
||||
|
||||
// when the test effect sees that a window was minimized, it will try to ungrab it
|
||||
effectOutputSpy.clear();
|
||||
c->setMinimized(true);
|
||||
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
QCOMPARE(effectOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
QCOMPARE(c->effectWindow()->data(WindowAddedGrabRole).value<void *>(), nullptr);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testRedirect_data()
|
||||
{
|
||||
QTest::addColumn<QString>("file");
|
||||
QTest::addColumn<bool>("shouldTerminate");
|
||||
QTest::newRow("animate/DontTerminateAtSource") << "redirectAnimateDontTerminateTest" << false;
|
||||
QTest::newRow("animate/TerminateAtSource") << "redirectAnimateTerminateTest" << true;
|
||||
QTest::newRow("set/DontTerminate") << "redirectSetDontTerminateTest" << false;
|
||||
QTest::newRow("set/Terminate") << "redirectSetTerminateTest" << true;
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testRedirect()
|
||||
{
|
||||
// this test verifies that redirect() works
|
||||
|
||||
// load the test effect
|
||||
auto effect = new ScriptedEffectWithDebugSpy;
|
||||
QFETCH(QString, file);
|
||||
QVERIFY(effect->load(file));
|
||||
|
||||
// create test client
|
||||
using namespace KWayland::Client;
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
AbstractClient *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeClient(), c);
|
||||
|
||||
auto around = [] (std::chrono::milliseconds elapsed,
|
||||
std::chrono::milliseconds pivot,
|
||||
std::chrono::milliseconds margin) {
|
||||
return qAbs(elapsed.count() - pivot.count()) < margin.count();
|
||||
};
|
||||
|
||||
// initially, the test animation is at the source position
|
||||
|
||||
{
|
||||
const auto state = effect->state();
|
||||
QCOMPARE(state.count(), 1);
|
||||
QCOMPARE(state.firstKey(), c->effectWindow());
|
||||
const QList<AniData> animations = state.first().first;
|
||||
QCOMPARE(animations.count(), 1);
|
||||
QCOMPARE(animations[0].timeLine.direction(), TimeLine::Forward);
|
||||
QVERIFY(around(animations[0].timeLine.elapsed(), 0ms, 50ms));
|
||||
}
|
||||
|
||||
// minimize the test client after 250ms, when the test effect sees that
|
||||
// a window was minimized, it will try to reverse animation for it
|
||||
QTest::qWait(250);
|
||||
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effectOutputSpy.isValid());
|
||||
|
||||
c->setMinimized(true);
|
||||
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
QCOMPARE(effectOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
|
||||
{
|
||||
const auto state = effect->state();
|
||||
QCOMPARE(state.count(), 1);
|
||||
QCOMPARE(state.firstKey(), c->effectWindow());
|
||||
const QList<AniData> animations = state.first().first;
|
||||
QCOMPARE(animations.count(), 1);
|
||||
QCOMPARE(animations[0].timeLine.direction(), TimeLine::Backward);
|
||||
QVERIFY(around(animations[0].timeLine.elapsed(), 1000ms - 250ms, 50ms));
|
||||
}
|
||||
|
||||
// wait for the animation to reach the start position, 100ms is an extra
|
||||
// safety margin
|
||||
QTest::qWait(250 + 100);
|
||||
|
||||
QFETCH(bool, shouldTerminate);
|
||||
if (shouldTerminate) {
|
||||
const auto state = effect->state();
|
||||
QCOMPARE(state.count(), 0);
|
||||
} else {
|
||||
const auto state = effect->state();
|
||||
QCOMPARE(state.count(), 1);
|
||||
QCOMPARE(state.firstKey(), c->effectWindow());
|
||||
const QList<AniData> animations = state.first().first;
|
||||
QCOMPARE(animations.count(), 1);
|
||||
QCOMPARE(animations[0].timeLine.direction(), TimeLine::Backward);
|
||||
QCOMPARE(animations[0].timeLine.elapsed(), 1000ms);
|
||||
QCOMPARE(animations[0].timeLine.value(), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testComplete()
|
||||
{
|
||||
// this test verifies that complete works
|
||||
|
||||
// load the test effect
|
||||
auto effect = new ScriptedEffectWithDebugSpy;
|
||||
QVERIFY(effect->load(QStringLiteral("completeTest")));
|
||||
|
||||
// create test client
|
||||
using namespace KWayland::Client;
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
AbstractClient *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeClient(), c);
|
||||
|
||||
auto around = [] (std::chrono::milliseconds elapsed,
|
||||
std::chrono::milliseconds pivot,
|
||||
std::chrono::milliseconds margin) {
|
||||
return qAbs(elapsed.count() - pivot.count()) < margin.count();
|
||||
};
|
||||
|
||||
// initially, the test animation should be at the start position
|
||||
{
|
||||
const auto state = effect->state();
|
||||
QCOMPARE(state.count(), 1);
|
||||
QCOMPARE(state.firstKey(), c->effectWindow());
|
||||
const QList<AniData> animations = state.first().first;
|
||||
QCOMPARE(animations.count(), 1);
|
||||
QVERIFY(around(animations[0].timeLine.elapsed(), 0ms, 50ms));
|
||||
QVERIFY(!animations[0].timeLine.done());
|
||||
}
|
||||
|
||||
// wait for 250ms
|
||||
QTest::qWait(250);
|
||||
|
||||
{
|
||||
const auto state = effect->state();
|
||||
QCOMPARE(state.count(), 1);
|
||||
QCOMPARE(state.firstKey(), c->effectWindow());
|
||||
const QList<AniData> animations = state.first().first;
|
||||
QCOMPARE(animations.count(), 1);
|
||||
QVERIFY(around(animations[0].timeLine.elapsed(), 250ms, 50ms));
|
||||
QVERIFY(!animations[0].timeLine.done());
|
||||
}
|
||||
|
||||
// minimize the test client, when the test effect sees that a window was
|
||||
// minimized, it will try to complete animation for it
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effectOutputSpy.isValid());
|
||||
|
||||
c->setMinimized(true);
|
||||
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
QCOMPARE(effectOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
|
||||
{
|
||||
const auto state = effect->state();
|
||||
QCOMPARE(state.count(), 1);
|
||||
QCOMPARE(state.firstKey(), c->effectWindow());
|
||||
const QList<AniData> animations = state.first().first;
|
||||
QCOMPARE(animations.count(), 1);
|
||||
QCOMPARE(animations[0].timeLine.elapsed(), 1000ms);
|
||||
QVERIFY(animations[0].timeLine.done());
|
||||
}
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(ScriptedEffectsTest)
|
||||
#include "scripted_effects_test.moc"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
effects.windowAdded.connect(function(w) {
|
||||
w.anim1 = effect.animate(w, Effect.Scale, 100, 1.4, 0.2, 0, QEasingCurve.OutCubic);
|
||||
w.anim1 = effect.animate(w, Effect.Scale, 100, 1.4, 0.2, 0, QEasingCurve.OutQuad);
|
||||
sendTestResponse(typeof(w.anim1) == "number");
|
||||
});
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ effects.windowAdded.connect(function(w) {
|
|||
animations: [{
|
||||
type: Effect.Scale,
|
||||
to: 1.4,
|
||||
curve: QEasingCurve.OutCubic
|
||||
curve: QEasingCurve.OutQuad
|
||||
}, {
|
||||
type: Effect.Opacity,
|
||||
curve: QEasingCurve.OutCubic,
|
||||
curve: QEasingCurve.OutQuad,
|
||||
to: 0.0
|
||||
}]
|
||||
});
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
window.animation = set({
|
||||
window: window,
|
||||
curve: QEasingCurve.Linear,
|
||||
duration: animationTime(1000),
|
||||
type: Effect.Opacity,
|
||||
from: 0,
|
||||
to: 1,
|
||||
keepAlive: false
|
||||
});
|
||||
});
|
||||
|
||||
effects.windowMinimized.connect(function (window) {
|
||||
if (complete(window.animation)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,8 +0,0 @@
|
|||
effects['desktopChanged(int,int)'].connect(function(old, current) {
|
||||
var stackingOrder = effects.stackingOrder;
|
||||
for (var i=0; i<stackingOrder.length; i++) {
|
||||
var w = stackingOrder[i];
|
||||
//1 second long random animation. Final param indicates fullscreen
|
||||
w.anim1 = effect.animate(w, Effect.Scale, 1000, 1.4, 0.2, 0, QEasingCurve.Linear, 0, true);
|
||||
}
|
||||
});
|
|
@ -1,21 +0,0 @@
|
|||
effects['desktopChanged(int,int)'].connect(function(old, current) {
|
||||
var stackingOrder = effects.stackingOrder;
|
||||
for (var i=0; i<stackingOrder.length; i++) {
|
||||
var w = stackingOrder[i];
|
||||
//1 second long random animation, marked as fullscreen
|
||||
w.anim1 = animate({
|
||||
window: w,
|
||||
duration: 1000,
|
||||
fullScreen: true,
|
||||
animations: [{
|
||||
type: Effect.Scale,
|
||||
curve: Effect.GaussianCurve,
|
||||
to: 1.4
|
||||
}, {
|
||||
type: Effect.Opacity,
|
||||
curve: Effect.GaussianCurve,
|
||||
to: 0.0
|
||||
}]
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,22 +0,0 @@
|
|||
effects['desktopChanged(int,int)'].connect(function(old, current) {
|
||||
var stackingOrder = effects.stackingOrder;
|
||||
for (var i=0; i<stackingOrder.length; i++) {
|
||||
var w = stackingOrder[i];
|
||||
//1 second long random animation, marked as fullscreen
|
||||
w.anim1 = animate({
|
||||
window: w,
|
||||
duration: 1000,
|
||||
animations: [{
|
||||
type: Effect.Scale,
|
||||
curve: Effect.GaussianCurve,
|
||||
to: 1.4,
|
||||
fullScreen: true
|
||||
}, {
|
||||
type: Effect.Opacity,
|
||||
curve: Effect.GaussianCurve,
|
||||
to: 0.0,
|
||||
fullScreen: true
|
||||
}]
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,7 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
if (effect.grab(window, Effect.WindowAddedGrabRole)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,7 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
if (effect.grab(window, Effect.WindowAddedGrabRole, true)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,7 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
if (effect.grab(window, Effect.WindowAddedGrabRole)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,7 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
if (effect.grab(window, Effect.WindowAddedGrabRole)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,7 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
if (effect.grab(window, Effect.WindowAddedGrabRole)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,13 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
effects.windowClosed.connect(function (window) {
|
||||
animate({
|
||||
window: window,
|
||||
type: Effect.Scale,
|
||||
duration: 1000,
|
||||
from: 1.0,
|
||||
to: 0.0
|
||||
// by default, keepAlive is set to true
|
||||
});
|
||||
sendTestResponse("triggered");
|
||||
});
|
|
@ -1,13 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
effects.windowClosed.connect(function (window) {
|
||||
animate({
|
||||
window: window,
|
||||
type: Effect.Scale,
|
||||
duration: 1000,
|
||||
from: 1.0,
|
||||
to: 0.0,
|
||||
keepAlive: false
|
||||
});
|
||||
sendTestResponse("triggered");
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
window.animation = animate({
|
||||
window: window,
|
||||
curve: QEasingCurve.Linear,
|
||||
duration: animationTime(1000),
|
||||
type: Effect.Opacity,
|
||||
from: 0.0,
|
||||
to: 1.0
|
||||
})
|
||||
});
|
||||
|
||||
effects.windowMinimized.connect(function (window) {
|
||||
if (redirect(window.animation, Effect.Backward, Effect.DontTerminate)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
window.animation = animate({
|
||||
window: window,
|
||||
curve: QEasingCurve.Linear,
|
||||
duration: animationTime(1000),
|
||||
type: Effect.Opacity,
|
||||
from: 0.0,
|
||||
to: 1.0
|
||||
})
|
||||
});
|
||||
|
||||
effects.windowMinimized.connect(function (window) {
|
||||
if (redirect(window.animation, Effect.Backward, Effect.TerminateAtSource)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,19 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
window.animation = set({
|
||||
window: window,
|
||||
curve: QEasingCurve.Linear,
|
||||
duration: animationTime(1000),
|
||||
type: Effect.Opacity,
|
||||
from: 0.0,
|
||||
to: 1.0,
|
||||
keepAlive: false
|
||||
});
|
||||
});
|
||||
|
||||
effects.windowMinimized.connect(function (window) {
|
||||
if (redirect(window.animation, Effect.Backward, Effect.DontTerminate)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,19 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
window.animation = set({
|
||||
window: window,
|
||||
curve: QEasingCurve.Linear,
|
||||
duration: animationTime(1000),
|
||||
type: Effect.Opacity,
|
||||
from: 0.0,
|
||||
to: 1.0,
|
||||
keepAlive: false
|
||||
});
|
||||
});
|
||||
|
||||
effects.windowMinimized.connect(function (window) {
|
||||
if (redirect(window.animation, Effect.Backward, Effect.TerminateAtSource)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
effects.windowAdded.connect(function (window) {
|
||||
if (effect.grab(window, Effect.WindowAddedGrabRole)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
||||
|
||||
effects.windowMinimized.connect(function (window) {
|
||||
if (effect.ungrab(window, Effect.WindowAddedGrabRole)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
|
@ -1,20 +1,30 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "x11client.h"
|
||||
#include "client.h"
|
||||
#include "composite.h"
|
||||
#include "deleted.h"
|
||||
#include "effects.h"
|
||||
#include "effectloader.h"
|
||||
#include "cursor.h"
|
||||
#include "platform.h"
|
||||
#include "scene.h"
|
||||
#include "shell_client.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "effect_builtins.h"
|
||||
|
@ -24,6 +34,7 @@
|
|||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/slide.h>
|
||||
|
||||
#include <netwm.h>
|
||||
|
@ -48,12 +59,11 @@ private Q_SLOTS:
|
|||
|
||||
void SlidingPopupsTest::initTestCase()
|
||||
{
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
qRegisterMetaType<KWin::Deleted*>();
|
||||
qRegisterMetaType<KWin::Effect*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
|
@ -73,15 +83,13 @@ void SlidingPopupsTest::initTestCase()
|
|||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
if (QFile::exists(QStringLiteral("/dev/dri/card0"))) {
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
}
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", "1");
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QVERIFY(Compositor::self());
|
||||
|
||||
auto scene = KWin::Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
QCOMPARE(scene->compositingType(), KWin::OpenGL2Compositing);
|
||||
}
|
||||
|
||||
void SlidingPopupsTest::init()
|
||||
|
@ -115,8 +123,6 @@ void SlidingPopupsTest::testWithOtherEffect_data()
|
|||
|
||||
QTest::newRow("fade, slide") << QStringList{QStringLiteral("kwin4_effect_fade"), QStringLiteral("slidingpopups")};
|
||||
QTest::newRow("slide, fade") << QStringList{QStringLiteral("slidingpopups"), QStringLiteral("kwin4_effect_fade")};
|
||||
QTest::newRow("scale, slide") << QStringList{QStringLiteral("kwin4_effect_scale"), QStringLiteral("slidingpopups")};
|
||||
QTest::newRow("slide, scale") << QStringList{QStringLiteral("slidingpopups"), QStringLiteral("kwin4_effect_scale")};
|
||||
|
||||
if (effects->compositingType() & KWin::OpenGLCompositing) {
|
||||
QTest::newRow("glide, slide") << QStringList{QStringLiteral("glide"), QStringLiteral("slidingpopups")};
|
||||
|
@ -206,7 +212,7 @@ void SlidingPopupsTest::testWithOtherEffect()
|
|||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded);
|
||||
QVERIFY(windowCreatedSpy.isValid());
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Client *client = windowCreatedSpy.first().first().value<X11Client *>();
|
||||
Client *client = windowCreatedSpy.first().first().value<Client*>();
|
||||
QVERIFY(client);
|
||||
QCOMPARE(client->window(), w);
|
||||
QVERIFY(client->isNormalWindow());
|
||||
|
@ -225,7 +231,7 @@ void SlidingPopupsTest::testWithOtherEffect()
|
|||
xcb_unmap_window(c.data(), w);
|
||||
xcb_flush(c.data());
|
||||
|
||||
QSignalSpy windowClosedSpy(client, &X11Client::windowClosed);
|
||||
QSignalSpy windowClosedSpy(client, &Client::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
|
||||
QSignalSpy windowDeletedSpy(effects, &EffectsHandler::windowDeleted);
|
||||
|
@ -252,8 +258,6 @@ void SlidingPopupsTest::testWithOtherEffectWayland_data()
|
|||
|
||||
QTest::newRow("fade, slide") << QStringList{QStringLiteral("kwin4_effect_fade"), QStringLiteral("slidingpopups")};
|
||||
QTest::newRow("slide, fade") << QStringList{QStringLiteral("slidingpopups"), QStringLiteral("kwin4_effect_fade")};
|
||||
QTest::newRow("scale, slide") << QStringList{QStringLiteral("kwin4_effect_scale"), QStringLiteral("slidingpopups")};
|
||||
QTest::newRow("slide, scale") << QStringList{QStringLiteral("slidingpopups"), QStringLiteral("kwin4_effect_scale")};
|
||||
|
||||
if (effects->compositingType() & KWin::OpenGLCompositing) {
|
||||
QTest::newRow("glide, slide") << QStringList{QStringLiteral("glide"), QStringLiteral("slidingpopups")};
|
||||
|
@ -323,7 +327,7 @@ void SlidingPopupsTest::testWithOtherEffectWayland()
|
|||
QScopedPointer<Slide> slide(slideManager->createSlide(surface.data()));
|
||||
slide->setLocation(Slide::Location::Left);
|
||||
slide->commit();
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(shellSurface);
|
||||
QCOMPARE(windowAddedSpy.count(), 0);
|
||||
auto client = Test::renderAndWaitForShown(surface.data(), QSize(10, 20), Qt::blue);
|
||||
|
@ -344,7 +348,7 @@ void SlidingPopupsTest::testWithOtherEffectWayland()
|
|||
shellSurface.reset();
|
||||
surface.reset();
|
||||
|
||||
QSignalSpy windowClosedSpy(client, &X11Client::windowClosed);
|
||||
QSignalSpy windowClosedSpy(client, &Client::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
|
||||
QSignalSpy windowDeletedSpy(effects, &EffectsHandler::windowDeleted);
|
||||
|
|
|
@ -1,213 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "abstract_client.h"
|
||||
#include "composite.h"
|
||||
#include "deleted.h"
|
||||
#include "effectloader.h"
|
||||
#include "effects.h"
|
||||
#include "platform.h"
|
||||
#include "scene.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include "effect_builtins.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_toplevel_open_close_animation-0");
|
||||
|
||||
class ToplevelOpenCloseAnimationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testAnimateToplevels_data();
|
||||
void testAnimateToplevels();
|
||||
void testDontAnimatePopups_data();
|
||||
void testDontAnimatePopups();
|
||||
};
|
||||
|
||||
void ToplevelOpenCloseAnimationTest::initTestCase()
|
||||
{
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::AbstractClient *>();
|
||||
qRegisterMetaType<KWin::Deleted *>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
ScriptedEffectLoader loader;
|
||||
const auto builtinNames = BuiltInEffects::availableEffectNames() << loader.listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
waylandServer()->initWorkspace();
|
||||
|
||||
auto scene = KWin::Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
QCOMPARE(scene->compositingType(), KWin::OpenGL2Compositing);
|
||||
}
|
||||
|
||||
void ToplevelOpenCloseAnimationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void ToplevelOpenCloseAnimationTest::cleanup()
|
||||
{
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
effectsImpl->unloadAllEffects();
|
||||
QVERIFY(effectsImpl->loadedEffects().isEmpty());
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void ToplevelOpenCloseAnimationTest::testAnimateToplevels_data()
|
||||
{
|
||||
QTest::addColumn<QString>("effectName");
|
||||
|
||||
QTest::newRow("Fade") << QStringLiteral("kwin4_effect_fade");
|
||||
QTest::newRow("Glide") << QStringLiteral("glide");
|
||||
QTest::newRow("Scale") << QStringLiteral("kwin4_effect_scale");
|
||||
}
|
||||
|
||||
void ToplevelOpenCloseAnimationTest::testAnimateToplevels()
|
||||
{
|
||||
// This test verifies that window open/close animation effects try to
|
||||
// animate the appearing and the disappearing of toplevel windows.
|
||||
|
||||
// Make sure that we have the right effects ptr.
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
|
||||
// Load effect that will be tested.
|
||||
QFETCH(QString, effectName);
|
||||
QVERIFY(effectsImpl->loadEffect(effectName));
|
||||
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
|
||||
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
|
||||
Effect *effect = effectsImpl->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Create the test client.
|
||||
using namespace KWayland::Client;
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(client);
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Close the test client, the effect should start animating the disappearing
|
||||
// of the client.
|
||||
QSignalSpy windowClosedSpy(client, &AbstractClient::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
shellSurface.reset();
|
||||
surface.reset();
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
}
|
||||
|
||||
void ToplevelOpenCloseAnimationTest::testDontAnimatePopups_data()
|
||||
{
|
||||
QTest::addColumn<QString>("effectName");
|
||||
|
||||
QTest::newRow("Fade") << QStringLiteral("kwin4_effect_fade");
|
||||
QTest::newRow("Glide") << QStringLiteral("glide");
|
||||
QTest::newRow("Scale") << QStringLiteral("kwin4_effect_scale");
|
||||
}
|
||||
|
||||
void ToplevelOpenCloseAnimationTest::testDontAnimatePopups()
|
||||
{
|
||||
// This test verifies that window open/close animation effects don't try
|
||||
// to animate popups(e.g. popup menus, tooltips, etc).
|
||||
|
||||
// Make sure that we have the right effects ptr.
|
||||
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
|
||||
QVERIFY(effectsImpl);
|
||||
|
||||
// Create the main window.
|
||||
using namespace KWayland::Client;
|
||||
QScopedPointer<Surface> mainWindowSurface(Test::createSurface());
|
||||
QVERIFY(!mainWindowSurface.isNull());
|
||||
QScopedPointer<Test::XdgToplevel> mainWindowShellSurface(Test::createXdgToplevelSurface(mainWindowSurface.data()));
|
||||
QVERIFY(!mainWindowShellSurface.isNull());
|
||||
AbstractClient *mainWindow = Test::renderAndWaitForShown(mainWindowSurface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(mainWindow);
|
||||
|
||||
// Load effect that will be tested.
|
||||
QFETCH(QString, effectName);
|
||||
QVERIFY(effectsImpl->loadEffect(effectName));
|
||||
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
|
||||
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
|
||||
Effect *effect = effectsImpl->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Create a popup, it should not be animated.
|
||||
QScopedPointer<Surface> popupSurface(Test::createSurface());
|
||||
QVERIFY(!popupSurface.isNull());
|
||||
QScopedPointer<Test::XdgPositioner> positioner(Test::createXdgPositioner());
|
||||
QVERIFY(positioner);
|
||||
positioner->set_size(20, 20);
|
||||
positioner->set_anchor_rect(0, 0, 10, 10);
|
||||
positioner->set_gravity(Test::XdgPositioner::gravity_bottom_right);
|
||||
positioner->set_anchor(Test::XdgPositioner::anchor_bottom_left);
|
||||
QScopedPointer<Test::XdgPopup> popupShellSurface(Test::createXdgPopupSurface(popupSurface.data(), mainWindowShellSurface->xdgSurface(), positioner.data()));
|
||||
QVERIFY(!popupShellSurface.isNull());
|
||||
AbstractClient *popup = Test::renderAndWaitForShown(popupSurface.data(), QSize(20, 20), Qt::red);
|
||||
QVERIFY(popup);
|
||||
QVERIFY(popup->isPopupWindow());
|
||||
QCOMPARE(popup->transientFor(), mainWindow);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the popup, it should not be animated.
|
||||
QSignalSpy popupClosedSpy(popup, &AbstractClient::windowClosed);
|
||||
QVERIFY(popupClosedSpy.isValid());
|
||||
popupShellSurface.reset();
|
||||
popupSurface.reset();
|
||||
QVERIFY(popupClosedSpy.wait());
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the main window.
|
||||
mainWindowSurface.reset();
|
||||
QVERIFY(Test::waitForWindowDestroyed(mainWindow));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(ToplevelOpenCloseAnimationTest)
|
||||
#include "toplevel_open_close_animation_test.moc"
|
|
@ -1,18 +1,30 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "x11client.h"
|
||||
#include "client.h"
|
||||
#include "composite.h"
|
||||
#include "effects.h"
|
||||
#include "effectloader.h"
|
||||
#include "cursor.h"
|
||||
#include "platform.h"
|
||||
#include "shell_client.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "effect_builtins.h"
|
||||
|
@ -42,11 +54,11 @@ private:
|
|||
|
||||
void TranslucencyTest::initTestCase()
|
||||
{
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
qRegisterMetaType<KWin::Effect*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
|
@ -66,7 +78,7 @@ void TranslucencyTest::initTestCase()
|
|||
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", "1");
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QVERIFY(Compositor::self());
|
||||
}
|
||||
|
||||
|
@ -138,7 +150,7 @@ void TranslucencyTest::testMoveAfterDesktopChange()
|
|||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded);
|
||||
QVERIFY(windowCreatedSpy.isValid());
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Client *client = windowCreatedSpy.first().first().value<X11Client *>();
|
||||
Client *client = windowCreatedSpy.first().first().value<Client*>();
|
||||
QVERIFY(client);
|
||||
QCOMPARE(client->window(), w);
|
||||
QVERIFY(client->isDecorated());
|
||||
|
@ -151,7 +163,7 @@ void TranslucencyTest::testMoveAfterDesktopChange()
|
|||
workspace()->sendClientToDesktop(client, 2, false);
|
||||
effects->setCurrentDesktop(2);
|
||||
QVERIFY(!m_translucencyEffect->isActive());
|
||||
KWin::Cursors::self()->mouse()->setPos(client->frameGeometry().center());
|
||||
KWin::Cursor::setPos(client->geometry().center());
|
||||
workspace()->performWindowOperation(client, Options::MoveOp);
|
||||
QVERIFY(m_translucencyEffect->isActive());
|
||||
QTest::qWait(200);
|
||||
|
@ -166,7 +178,7 @@ void TranslucencyTest::testMoveAfterDesktopChange()
|
|||
xcb_unmap_window(c.data(), w);
|
||||
xcb_flush(c.data());
|
||||
|
||||
QSignalSpy windowClosedSpy(client, &X11Client::windowClosed);
|
||||
QSignalSpy windowClosedSpy(client, &Client::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
xcb_destroy_window(c.data(), w);
|
||||
|
@ -206,7 +218,7 @@ void TranslucencyTest::testDialogClose()
|
|||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded);
|
||||
QVERIFY(windowCreatedSpy.isValid());
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Client *client = windowCreatedSpy.first().first().value<X11Client *>();
|
||||
Client *client = windowCreatedSpy.first().first().value<Client*>();
|
||||
QVERIFY(client);
|
||||
QCOMPARE(client->window(), w);
|
||||
QVERIFY(client->isDecorated());
|
||||
|
@ -218,7 +230,7 @@ void TranslucencyTest::testDialogClose()
|
|||
xcb_unmap_window(c.data(), w);
|
||||
xcb_flush(c.data());
|
||||
|
||||
QSignalSpy windowClosedSpy(client, &X11Client::windowClosed);
|
||||
QSignalSpy windowClosedSpy(client, &Client::windowClosed);
|
||||
QVERIFY(windowClosedSpy.isValid());
|
||||
|
||||
QSignalSpy windowDeletedSpy(effects, &EffectsHandler::windowDeleted);
|
||||
|
|
|
@ -1,18 +1,29 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "abstract_client.h"
|
||||
#include "composite.h"
|
||||
#include "effects.h"
|
||||
#include "effectloader.h"
|
||||
#include "cursor.h"
|
||||
#include "platform.h"
|
||||
#include "shell_client.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "effect_builtins.h"
|
||||
|
@ -20,6 +31,7 @@
|
|||
#include <KConfigGroup>
|
||||
|
||||
#include <KWayland/Client/buffer.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
@ -39,10 +51,11 @@ private Q_SLOTS:
|
|||
|
||||
void WindowGeometryTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::ShellClient*>();
|
||||
qRegisterMetaType<KWin::AbstractClient*>();
|
||||
qRegisterMetaType<KWin::Effect*>();
|
||||
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
||||
QVERIFY(applicationStartedSpy.isValid());
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
|
@ -61,7 +74,7 @@ void WindowGeometryTest::initTestCase()
|
|||
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", "1");
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
QVERIFY(KWin::Compositor::self());
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue