diff --git a/como/input/dbus/device.h b/como/input/dbus/device.h index f3e54a5f6b..c18924969d 100644 --- a/como/input/dbus/device.h +++ b/como/input/dbus/device.h @@ -153,6 +153,29 @@ class COMO_EXPORT device : public QObject Q_PROPERTY(bool supportsOutputArea READ supportsOutputArea CONSTANT) Q_PROPERTY(QRectF defaultOutputArea READ defaultOutputArea CONSTANT) Q_PROPERTY(QRectF outputArea READ outputArea WRITE setOutputArea NOTIFY outputAreaChanged) + Q_PROPERTY(bool defaultMapToWorkspace READ defaultMapToWorkspace CONSTANT) + Q_PROPERTY(bool mapToWorkspace READ isMapToWorkspace WRITE setMapToWorkspace NOTIFY + mapToWorkspaceChanged) + Q_PROPERTY(QString deviceGroupId READ deviceGroupId CONSTANT) + + bool defaultMapToWorkspace() const + { + return false; + } + + bool isMapToWorkspace() const + { + return false; + } + + void setMapToWorkspace(bool /*mapToWorkspace*/) + { + } + + QString deviceGroupId() const + { + return {}; + } public: explicit device(input::control::keyboard* control, QObject* parent); @@ -298,6 +321,7 @@ class COMO_EXPORT device : public QObject void scrollFactorChanged(); void clickMethodChanged(); void outputAreaChanged(); + void mapToWorkspaceChanged(); }; } diff --git a/como/input/extern/xcursor.c b/como/input/extern/xcursor.c index 1697532444..a2ffc44292 100644 --- a/como/input/extern/xcursor.c +++ b/como/input/extern/xcursor.c @@ -28,17 +28,17 @@ #define _DEFAULT_SOURCE #include "xcursor.h" +#include #include #include #include -#include /* * From libXcursor/include/X11/extensions/Xcursor.h */ -#define XcursorTrue 1 -#define XcursorFalse 0 +#define XcursorTrue 1 +#define XcursorFalse 0 /* * Cursor files start with a header. The header @@ -71,7 +71,7 @@ * CARD32 position absolute file position */ -#define XCURSOR_MAGIC 0x72756358 /* "Xcur" LSBFirst */ +#define XCURSOR_MAGIC 0x72756358 /* "Xcur" LSBFirst */ /* * Current Xcursor version number. Will be substituted by configure @@ -81,32 +81,32 @@ #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)) +#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 */ +#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 */ +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; /* @@ -125,13 +125,14 @@ typedef struct _XcursorFileHeader { * CARD32 version chunk type version */ -#define XCURSOR_CHUNK_HEADER_LEN (4 * 4) +#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 */ +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; /* @@ -148,18 +149,19 @@ typedef struct _XcursorChunkHeader { * 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; +#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; /* @@ -178,23 +180,15 @@ typedef struct _XcursorComment { * 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); -}; +#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 _XcursorComments { - int ncomment; /* number of comments */ - XcursorComment **comments; /* array of XcursorComment pointers */ +typedef struct _XcursorComments +{ + int ncomment; /* number of comments */ + XcursorComment **comments; /* array of XcursorComment pointers */ } XcursorComments; /* @@ -202,21 +196,20 @@ typedef struct _XcursorComments { */ static XcursorImage * -XcursorImageCreate (int width, int height) +XcursorImageCreate(int width, int height) { - XcursorImage *image; + XcursorImage *image; if (width < 0 || height < 0) - return NULL; + return NULL; if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE) - return NULL; + return NULL; - image = malloc (sizeof (XcursorImage) + - width * height * sizeof (XcursorPixel)); + image = malloc(sizeof(XcursorImage) + width * height * sizeof(XcursorPixel)); if (!image) - return NULL; + return NULL; image->version = XCURSOR_IMAGE_VERSION; - image->pixels = (XcursorPixel *) (image + 1); + image->pixels = (XcursorPixel *)(image + 1); image->size = width > height ? width : height; image->width = width; image->height = height; @@ -225,373 +218,305 @@ XcursorImageCreate (int width, int height) } static void -XcursorImageDestroy (XcursorImage *image) +XcursorImageDestroy(XcursorImage *image) { - free (image); + free(image); } static XcursorImages * -XcursorImagesCreate (int size) +XcursorImagesCreate(int size) { - XcursorImages *images; + XcursorImages *images; - images = malloc (sizeof (XcursorImages) + - size * sizeof (XcursorImage *)); + images = malloc(sizeof(XcursorImages) + size * sizeof(XcursorImage *)); if (!images) - return NULL; + return NULL; images->nimage = 0; - images->images = (XcursorImage **) (images + 1); + images->images = (XcursorImage **)(images + 1); return images; } -void -XcursorImagesDestroy (XcursorImages *images) +void XcursorImagesDestroy(XcursorImages *images) { - int n; + int n; if (!images) return; for (n = 0; n < images->nimage; n++) - XcursorImageDestroy (images->images[n]); - free (images); + XcursorImageDestroy(images->images[n]); + free(images); } static XcursorBool -_XcursorReadUInt (XcursorFile *file, XcursorUInt *u) +_XcursorReadUInt(XcursorFile *file, XcursorUInt *u) { - unsigned char bytes[4]; + uint8_t bytes[4]; if (!file || !u) return XcursorFalse; - if ((*file->read) (file, bytes, 4) != 4) - 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); + *u = ((XcursorUInt)(bytes[0]) << 0) | ((XcursorUInt)(bytes[1]) << 8) | ((XcursorUInt)(bytes[2]) << 16) | ((XcursorUInt)(bytes[3]) << 24); return XcursorTrue; } static void -_XcursorFileHeaderDestroy (XcursorFileHeader *fileHeader) +_XcursorFileHeaderDestroy(XcursorFileHeader *fileHeader) { - free (fileHeader); + free(fileHeader); } static XcursorFileHeader * -_XcursorFileHeaderCreate (XcursorUInt ntoc) +_XcursorFileHeaderCreate(XcursorUInt ntoc) { - XcursorFileHeader *fileHeader; + XcursorFileHeader *fileHeader; if (ntoc > 0x10000) - return NULL; - fileHeader = malloc (sizeof (XcursorFileHeader) + - ntoc * sizeof (XcursorFileToc)); + return NULL; + fileHeader = malloc(sizeof(XcursorFileHeader) + ntoc * sizeof(XcursorFileToc)); if (!fileHeader) - return NULL; + 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); + fileHeader->tocs = (XcursorFileToc *)(fileHeader + 1); return fileHeader; } static XcursorFileHeader * -_XcursorReadFileHeader (XcursorFile *file) +_XcursorReadFileHeader(XcursorFile *file) { - XcursorFileHeader head, *fileHeader; - XcursorUInt skip; - unsigned int n; + XcursorFileHeader head, *fileHeader; + XcursorUInt skip; + unsigned int n; if (!file) return NULL; - if (!_XcursorReadUInt (file, &head.magic)) - 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; + 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 (!(*file->skip)(file, skip)) + return NULL; + fileHeader = _XcursorFileHeaderCreate(head.ntoc); if (!fileHeader) - return NULL; + 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; + 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; + if (n != fileHeader->ntoc) { + _XcursorFileHeaderDestroy(fileHeader); + return NULL; } return fileHeader; } static XcursorBool -_XcursorSeekToToc (XcursorFile *file, - XcursorFileHeader *fileHeader, - int toc) +_XcursorSeekToToc(XcursorFile *file, + XcursorFileHeader *fileHeader, + int toc) { - if (!file || !fileHeader || \ - (*file->seek) (file, fileHeader->tocs[toc].position, SEEK_SET) == EOF) - return XcursorFalse; - return XcursorTrue; + if (!file || !fileHeader) + return XcursorFalse; + return (*file->seek)(file, fileHeader->tocs[toc].position); } static XcursorBool -_XcursorFileReadChunkHeader (XcursorFile *file, - XcursorFileHeader *fileHeader, - int toc, - XcursorChunkHeader *chunkHeader) +_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; + 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; + 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)) +#define dist(a, b) ((a) > (b) ? (a) - (b) : (b) - (a)) static XcursorDim -_XcursorFindBestSize (XcursorFileHeader *fileHeader, - XcursorDim size, - int *nsizesp) +_XcursorFindBestSize(XcursorFileHeader *fileHeader, + XcursorDim size, + int *nsizesp) { unsigned int n; - int nsizes = 0; - XcursorDim bestSize = 0; - XcursorDim thisSize; + 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++; + 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) +_XcursorFindImageToc(XcursorFileHeader *fileHeader, + XcursorDim size, + int count) { - unsigned int toc; - XcursorDim thisSize; + 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--; + 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 -1; return toc; } static XcursorImage * -_XcursorReadImage (XcursorFile *file, - XcursorFileHeader *fileHeader, - int toc) +_XcursorReadImage(XcursorFile *file, + XcursorFileHeader *fileHeader, + int toc) { - XcursorChunkHeader chunkHeader; - XcursorImage head; - XcursorImage *image; - int n; - XcursorPixel *p; + 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; + 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 > XCURSOR_IMAGE_MAX_SIZE || head.height > XCURSOR_IMAGE_MAX_SIZE) + return NULL; if (head.width == 0 || head.height == 0) - return NULL; + return NULL; if (head.xhot > head.width || head.yhot > head.height) - return NULL; + return NULL; /* Create the image and initialize it */ - image = XcursorImageCreate (head.width, head.height); + image = XcursorImageCreate(head.width, head.height); if (image == NULL) - return NULL; + return NULL; if (chunkHeader.version < image->version) - image->version = chunkHeader.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++; + while (n--) { + if (!_XcursorReadUInt(file, p)) { + XcursorImageDestroy(image); + return NULL; + } + p++; } return image; } -static XcursorImages * -XcursorXcFileLoadImages (XcursorFile *file, int size) +XcursorImages * +XcursorXcFileLoadImages(XcursorFile *file, int size) { - XcursorFileHeader *fileHeader; - XcursorDim bestSize; - int nsize; - XcursorImages *images; - int n; - int toc; + XcursorFileHeader *fileHeader; + XcursorDim bestSize; + int nsize; + XcursorImages *images; + int n; + int toc; if (!file || size < 0) - return NULL; - fileHeader = _XcursorReadFileHeader (file); + return NULL; + fileHeader = _XcursorReadFileHeader(file); if (!fileHeader) - return NULL; - bestSize = _XcursorFindBestSize (fileHeader, (XcursorDim) size, &nsize); - if (!bestSize) - { - _XcursorFileHeaderDestroy (fileHeader); - return NULL; + return NULL; + bestSize = _XcursorFindBestSize(fileHeader, (XcursorDim)size, &nsize); + if (!bestSize) { + _XcursorFileHeaderDestroy(fileHeader); + return NULL; } - images = XcursorImagesCreate (nsize); - if (!images) - { - _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++; + 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; + _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; -} - -XcursorImages * -XcursorFileLoadImages (const char *file, int size) -{ - XcursorFile f; - XcursorImages *images; - - FILE *fp = fopen(file, "r"); - if (!fp) - return NULL; - - _XcursorStdioFileInitialize (fp, &f); - images = XcursorXcFileLoadImages (&f, size); - fclose(fp); - - return images; -} diff --git a/como/input/extern/xcursor.h b/como/input/extern/xcursor.h index 4837cc956a..9d28486e92 100644 --- a/como/input/extern/xcursor.h +++ b/como/input/extern/xcursor.h @@ -35,36 +35,47 @@ extern "C" { #include -typedef int XcursorBool; -typedef uint32_t XcursorUInt; +typedef int XcursorBool; +typedef uint32_t XcursorUInt; -typedef XcursorUInt XcursorDim; -typedef XcursorUInt XcursorPixel; +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 */ +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 */ +typedef struct _XcursorImages +{ + int nimage; /* number of images */ + XcursorImage **images; /* array of XcursorImage pointers */ } XcursorImages; +typedef struct _XcursorFile XcursorFile; + +struct _XcursorFile +{ + void *closure; + int (*read)(XcursorFile *file, uint8_t *buf, int len); + XcursorBool (*skip)(XcursorFile *file, long offset); + XcursorBool (*seek)(XcursorFile *file, long offset); +}; + XcursorImages * -XcursorFileLoadImages (const char *file, int size); +XcursorXcFileLoadImages(XcursorFile *file, int size); -void -XcursorImagesDestroy (XcursorImages *images); +void XcursorImagesDestroy(XcursorImages *images); #ifdef __cplusplus } diff --git a/como/input/wayland/xcursor_theme.cpp b/como/input/wayland/xcursor_theme.cpp index 5e288b96cd..a77bc583d3 100644 --- a/como/input/wayland/xcursor_theme.cpp +++ b/como/input/wayland/xcursor_theme.cpp @@ -82,8 +82,28 @@ std::chrono::milliseconds xcursor_sprite::delay() const static QList load_cursor(QString const& file_path, int target_size, double device_pixel_ratio) { - auto images - = XcursorFileLoadImages(QFile::encodeName(file_path), target_size * device_pixel_ratio); + QFile file(file_path); + if (!file.open(QFile::ReadOnly)) { + return {}; + } + + XcursorFile reader{ + .closure = &file, + .read = [](XcursorFile* file, uint8_t* buffer, int len) -> int { + QFile* device = static_cast(file->closure); + return device->read(reinterpret_cast(buffer), len); + }, + .skip = [](XcursorFile* file, long offset) -> XcursorBool { + QFile* device = static_cast(file->closure); + return device->skip(offset) != -1; + }, + .seek = [](XcursorFile* file, long offset) -> XcursorBool { + QFile* device = static_cast(file->closure); + return device->seek(offset); + }, + }; + + auto images = XcursorXcFileLoadImages(&reader, target_size * device_pixel_ratio); if (!images) { return {}; } diff --git a/como/render/effect/interface/effect_window.h b/como/render/effect/interface/effect_window.h index 0215c9d1db..91e57e42f7 100644 --- a/como/render/effect/interface/effect_window.h +++ b/como/render/effect/interface/effect_window.h @@ -238,11 +238,6 @@ class COMO_EXPORT EffectWindow : public QObject * Geometry of the actual window contents inside the whole (including decorations) window. */ Q_PROPERTY(QRect contentsRect READ contentsRect) - /** - * Geometry of the transparent rect in the decoration. - * May be different from contentsRect if the decoration is extended into the client area. - */ - Q_PROPERTY(QRect decorationInnerRect READ decorationInnerRect) Q_PROPERTY(bool hasDecoration READ hasDecoration) Q_PROPERTY(QStringList activities READ activities) Q_PROPERTY(bool onCurrentActivity READ isOnCurrentActivity) @@ -435,12 +430,6 @@ class COMO_EXPORT EffectWindow : public QObject * Geometry of the actual window contents inside the whole (including decorations) window. */ virtual QRect contentsRect() const = 0; - /** - * Geometry of the transparent rect in the decoration. - * May be different from contentsRect() if the decoration is extended into the client area. - * @since 4.5 - */ - virtual QRect decorationInnerRect() const = 0; bool hasDecoration() const; virtual bool decorationHasAlpha() const = 0; /** diff --git a/como/render/effect/window_impl.h b/como/render/effect/window_impl.h index 02434aae13..6b48263b5e 100644 --- a/como/render/effect/window_impl.h +++ b/como/render/effect/window_impl.h @@ -677,11 +677,6 @@ class effects_window_impl : public EffectWindow *window.ref_win); } - QRect decorationInnerRect() const override - { - return contentsRect(); - } - KDecoration2::Decoration* decoration() const override { return std::visit(overload{[](auto&& ref_win) { return win::decoration(ref_win); }}, diff --git a/como/win/move.h b/como/win/move.h index f7119a1436..319cc71d96 100644 --- a/como/win/move.h +++ b/como/win/move.h @@ -117,7 +117,7 @@ void update_cursor(Win* win) break; default: if (mov_res.enabled) { - shape = Qt::SizeAllCursor; + shape = Qt::ClosedHandCursor; } else { shape = Qt::ArrowCursor; } diff --git a/plugins/effects/CMakeLists.txt b/plugins/effects/CMakeLists.txt index b2c9d1c1d9..e2fe3b548b 100644 --- a/plugins/effects/CMakeLists.txt +++ b/plugins/effects/CMakeLists.txt @@ -89,7 +89,6 @@ add_subdirectory(logout) add_subdirectory(magiclamp) add_subdirectory(magnifier) add_subdirectory(maximize) -add_subdirectory(morphingpopups) add_subdirectory(mouseclick) add_subdirectory(mousemark) add_subdirectory(overview) diff --git a/plugins/effects/backgroundcontrast/contrast.cpp b/plugins/effects/backgroundcontrast/contrast.cpp index 274c3ecfb2..78ecf320df 100644 --- a/plugins/effects/backgroundcontrast/contrast.cpp +++ b/plugins/effects/backgroundcontrast/contrast.cpp @@ -129,11 +129,11 @@ QRegion ContrastEffect::contrastRegion(const EffectWindow* w) const if (auto const it = m_windowData.find(w); it != m_windowData.end()) { auto const& appRegion = it->second.contrastRegion; if (!appRegion.isEmpty()) { - region |= appRegion.translated(w->contentsRect().topLeft()) & w->decorationInnerRect(); + region |= appRegion.translated(w->contentsRect().topLeft()) & w->contentsRect(); } else { // An empty region means that the blur effect should be enabled // for the whole window. - region = w->decorationInnerRect(); + region = w->contentsRect(); } } diff --git a/plugins/effects/blur/blur.cpp b/plugins/effects/blur/blur.cpp index bb6acab4a2..3fdb765d9d 100644 --- a/plugins/effects/blur/blur.cpp +++ b/plugins/effects/blur/blur.cpp @@ -293,7 +293,7 @@ QRegion BlurEffect::deco_blur_region(EffectWindow const* win) const return QRegion(); } - auto const decorationRegion = QRegion(win->decoration()->rect()) - win->decorationInnerRect(); + auto const decorationRegion = QRegion(win->decoration()->rect()) - win->contentsRect(); // We return only blurred regions that belong to decoration region. return decorationRegion.intersected(win->decoration()->blurRegion()); @@ -331,7 +331,7 @@ QRegion BlurEffect::blur_region(EffectWindow const* win) const return win->rect(); } - auto region = app_region.translated(win->contentsRect().topLeft()) & win->decorationInnerRect(); + auto region = app_region.translated(win->contentsRect().topLeft()) & win->contentsRect(); if (win->decorationHasAlpha() && deco_supports_blur_behind(win)) { region |= deco_blur_region(win); } diff --git a/plugins/effects/logout/package/contents/code/main.js b/plugins/effects/logout/package/contents/code/main.js index db33749a34..c5ed605d2e 100644 --- a/plugins/effects/logout/package/contents/code/main.js +++ b/plugins/effects/logout/package/contents/code/main.js @@ -9,12 +9,6 @@ SPDX-License-Identifier: GPL-2.0-or-later "use strict"; var logoutEffect = { - inDuration: animationTime(800), - outDuration: animationTime(400), - loadConfig: function () { - logoutEffect.inDuration = animationTime(800); - logoutEffect.outDuration = animationTime(400); - }, isLogoutWindow: function (window) { if (window.windowClass === "ksmserver-logout-greeter ksmserver-logout-greeter") { return true; @@ -32,7 +26,7 @@ var logoutEffect = { } window.inAnimation = animate({ window: window, - duration: logoutEffect.inDuration, + duration: animationTime(800), type: Effect.Opacity, from: 0.0, to: 1.0 @@ -49,14 +43,13 @@ var logoutEffect = { } window.outAnimation = animate({ window: window, - duration: logoutEffect.outDuration, + duration: animationTime(400), type: Effect.Opacity, from: 1.0, to: 0.0 }); }, init: function () { - logoutEffect.loadConfig(); effects.windowAdded.connect(logoutEffect.opened); effects.windowClosed.connect(logoutEffect.closed); } diff --git a/plugins/effects/morphingpopups/CMakeLists.txt b/plugins/effects/morphingpopups/CMakeLists.txt deleted file mode 100644 index 822331cd86..0000000000 --- a/plugins/effects/morphingpopups/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Vlad Zahorodnii -# -# SPDX-License-Identifier: GPL-2.0-or-later - -kwin_add_scripted_effect(morphingpopups package) diff --git a/plugins/effects/morphingpopups/package/contents/code/main.js b/plugins/effects/morphingpopups/package/contents/code/main.js deleted file mode 100644 index b2db22b8a5..0000000000 --- a/plugins/effects/morphingpopups/package/contents/code/main.js +++ /dev/null @@ -1,131 +0,0 @@ -/* - SPDX-FileCopyrightText: 2012 Martin Gräßlin - SPDX-FileCopyrightText: 2016 Marco Martin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -"use strict"; - -var morphingEffect = { - duration: animationTime(150), - loadConfig: function () { - morphingEffect.duration = animationTime(150); - }, - - handleFrameGeometryChanged: function (window, oldGeometry) { - var newGeometry = window.geometry; - - //only do the transition for near enough tooltips, - //don't cross the whole screen: ugly - var distance = Math.abs(oldGeometry.x - newGeometry.x) + Math.abs(oldGeometry.y - newGeometry.y); - - if (distance > (newGeometry.width + newGeometry.height) * 2) { - if (window.moveAnimation) { - delete window.moveAnimation; - } - if (window.fadeAnimation) { - delete window.fadeAnimation; - } - - return; - } - - //don't resize it "too much", set as four times - if ((newGeometry.width / oldGeometry.width) > 4 || - (oldGeometry.width / newGeometry.width) > 4 || - (newGeometry.height / oldGeometry.height) > 4 || - (oldGeometry.height / newGeometry.height) > 4) { - return; - } - - window.setData(Effect.WindowForceBackgroundContrastRole, true); - window.setData(Effect.WindowForceBlurRole, true); - - var couldRetarget = false; - - if (window.moveAnimation) { - if (window.moveAnimation[0]) { - couldRetarget = retarget(window.moveAnimation[0], { - value1: newGeometry.width, - value2: newGeometry.height - }, morphingEffect.duration); - } - if (couldRetarget && window.moveAnimation[1]) { - couldRetarget = retarget(window.moveAnimation[1], { - value1: newGeometry.x + newGeometry.width/2, - value2: newGeometry.y + newGeometry.height / 2 - }, morphingEffect.duration); - } - if (!couldRetarget) { - cancel(window.moveAnimation[0]); - } - - } - - if (!couldRetarget) { - window.moveAnimation = animate({ - window: window, - duration: morphingEffect.duration, - animations: [{ - type: Effect.Size, - to: { - value1: newGeometry.width, - value2: newGeometry.height - }, - from: { - value1: oldGeometry.width, - value2: oldGeometry.height - } - }, { - type: Effect.Position, - to: { - value1: newGeometry.x + newGeometry.width / 2, - value2: newGeometry.y + newGeometry.height / 2 - }, - from: { - value1: oldGeometry.x + oldGeometry.width / 2, - value2: oldGeometry.y + oldGeometry.height / 2 - } - }] - }); - - } - - couldRetarget = false; - if (window.fadeAnimation) { - couldRetarget = retarget(window.fadeAnimation[0], 1.0, morphingEffect.duration); - } - - if (!couldRetarget) { - window.fadeAnimation = animate({ - window: window, - duration: morphingEffect.duration, - animations: [{ - type: Effect.CrossFadePrevious, - to: 1.0, - from: 0.0 - }] - }); - } - }, - - manage: function (window) { - //only tooltips and notifications - if (!window.tooltip && !window.notification && !window.criticalNotification) { - return; - } - - window.windowFrameGeometryChanged.connect(morphingEffect.handleFrameGeometryChanged); - }, - - init: function () { - effect.configChanged.connect(morphingEffect.loadConfig); - effects.windowAdded.connect(morphingEffect.manage); - - for (const window of effects.stackingOrder) { - morphingEffect.manage(window); - } - } -}; -morphingEffect.init(); diff --git a/plugins/effects/morphingpopups/package/metadata.json b/plugins/effects/morphingpopups/package/metadata.json deleted file mode 100644 index d14c8b9c29..0000000000 --- a/plugins/effects/morphingpopups/package/metadata.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "KPackageStructure": "KWin/Effect", - "KPlugin": { - "Authors": [ - { - "Email": "mart@kde.org", - "Name": "Marco Martin", - "Name[ar]": "ماركو مارتن", - "Name[az]": "Marco Martin", - "Name[be]": "Marco Martin", - "Name[bg]": "Marco Martin", - "Name[ca@valencia]": "Marco Martin", - "Name[ca]": "Marco Martin", - "Name[cs]": "Marco Martin", - "Name[de]": "Marco Martin", - "Name[en_GB]": "Marco Martin", - "Name[es]": "Marco Martin", - "Name[et]": "Marco Martin", - "Name[eu]": "Marco Martin", - "Name[fi]": "Marco Martin", - "Name[fr]": "Marco Martin", - "Name[hu]": "Marco Martin", - "Name[ia]": "Marco Martin", - "Name[id]": "Marco Martin", - "Name[it]": "Marco Martin", - "Name[ja]": "Marco Martin", - "Name[ka]": "Marco Martin", - "Name[ko]": "Marco Martin", - "Name[lt]": "Marco Martin", - "Name[nl]": "Marco Martin", - "Name[nn]": "Marco Martin", - "Name[pl]": "Marco Martin", - "Name[pt]": "Marco Martin", - "Name[pt_BR]": "Marco Martin", - "Name[ro]": "Marco Martin", - "Name[ru]": "Marco Martin", - "Name[sk]": "Marco Martin", - "Name[sl]": "Marco Martin", - "Name[sv]": "Marco Martin", - "Name[ta]": "மார்கோ மார்ட்டின்", - "Name[tr]": "Marco Martin", - "Name[uk]": "Marco Martin", - "Name[vi]": "Marco Martin", - "Name[x-test]": "xxMarco Martinxx", - "Name[zh_CN]": "Marco Martin", - "Name[zh_TW]": "Marco Martin" - } - ], - "Category": "Appearance", - "Description": "Cross fade animation when Tooltips or Notifications change their geometry", - "Description[ar]": "تحريك التلاشي المتقاطع عندما يغير التلميح أو الإشعار من أبعاده", - "Description[be]": "Анімацыя згасання пры змене геаметрыі выплыўных падказак і апавяшчэнняў", - "Description[bg]": "Кръстосано преливане, когато подсказките или известията променят геометрията си", - "Description[ca@valencia]": "Animació d'esvaïment creuat quan els consells d'eines o les notificacions canvien la seua geometria", - "Description[ca]": "Animació d'esvaïment creuat quan els consells d'eines o les notificacions canvien la seva geometria", - "Description[de]": "Überblendende Animationen, wenn Kurzinfos oder Benachrichtigungen ihre Geometrie ändern", - "Description[en_GB]": "Cross fade animation when Tooltips or Notifications change their geometry", - "Description[es]": "Animación cruzada cuando las ayudas emergentes o las notificaciones cambian su geometría", - "Description[et]": "Animatsioon hääbumisega, kui kohtspikrid või märguanded muudavad geomeetriat", - "Description[eu]": "Desagertze gurutzatua tresnen argibideek edo jakinarazpenek geometria aldatzen dutenean", - "Description[fi]": "Häivytysanimaatio työkaluvihjeiden tai ilmoitusten muutettua muotoaan", - "Description[fr]": "Animation en fondu enchaîné lorsque des infobulles ou des notifications modifient leurs géométries", - "Description[ia]": "Transversa animation distingite quando Consilios o Notificationes cambia le lor geometria", - "Description[it]": "Animazione in dissolvenza quando i suggerimenti e le notifiche cambiano la loro geometria", - "Description[ja]": "ツールチップや通知ポップアップのジオメトリ変更時のクロスフェードアニメーション", - "Description[nl]": "Verwissel animatie van opkomen/vervagen wanneer tekstballonnen of meldingen hun geometrie wijzigen", - "Description[nn]": "Krysstoningsanimasjon når hjelpebobler eller varslingar endrar form", - "Description[pl]": "Efekt zmiany kształtu podpowiedzi i powiadomień przy zmianie ich geometrii", - "Description[pt]": "Animações desvanecidas quando as dicas ou notificações mudam de tamanho", - "Description[ru]": "При изменении формы всплывающих подсказок или уведомлений они плавно растягиваются или сжимаются", - "Description[sl]": "Animacija navzkrižnega preliva, ko se orodnim namigom ali obvestilom spremeni geometrija", - "Description[ta]": "கருவித்துப்புகளின் மற்றும் அறிவிப்புகளின் அளவை மாற்றும்போது அவற்றை மங்கசெய்து மாற்றும்", - "Description[tr]": "Araç ipuçları veya bildirimler boyutları değiştiğinde gösterilecek çapraz geçiş canlandırması", - "Description[uk]": "Анімація зі зміною освітленості під час зміни геометрії панелей підказок і сповіщень", - "Description[vi]": "Hiệu ứng động mờ dần khi các chú giải hay thông báo thay đổi hình dạng", - "Description[x-test]": "xxCross fade animation when Tooltips or Notifications change their geometryxx", - "Description[zh_CN]": "工具提示/通知信息框大小变化时呈现过渡动效", - "Description[zh_TW]": "當工具提示或通知變更位置時交錯淡出動畫", - "EnabledByDefault": true, - "Icon": "preferences-system-windows-effect-morphingpopups", - "Id": "morphingpopups", - "License": "GPL", - "Name": "Morphing Popups", - "Name[ar]": "المنبثقات المتحورة", - "Name[be]": "Трансфармаванне выплыўных акон", - "Name[bg]": "Променящи се изскачащи прозорци", - "Name[ca@valencia]": "Missatges emergents en metamorfosi", - "Name[ca]": "Missatges emergents en metamorfosi", - "Name[cs]": "Morfující vyskakovací okna", - "Name[de]": "Verformende Aufklappfenster", - "Name[en_GB]": "Morphing Popups", - "Name[es]": "Transformación de ventanas emergentes", - "Name[eu]": "Eraldatzen diren gainerakorrak", - "Name[fi]": "Ponnahdusikkunoiden muodonmuutos", - "Name[fr]": "Effectuer un fondu enchaîné des infobulles", - "Name[ia]": "Popups de Morphing", - "Name[it]": "Finestre a comparsa che si trasformano", - "Name[ja]": "変形するポップアップ", - "Name[ka]": "ტრანსფორმირებადი მხტუნარები", - "Name[nl]": "Morphing pop-ups", - "Name[nn]": "Formendring for sprettoppvindauge", - "Name[pl]": "Zmiennokształtne okna", - "Name[pt]": "Janelas Mutantes", - "Name[pt_BR]": "Mensagens com mudança de forma", - "Name[ru]": "Анимация преобразования всплывающих окон", - "Name[sl]": "Pogovorna okna pretvorb", - "Name[tr]": "Dönüşen Açılır Pencereler", - "Name[uk]": "Аморфні контекстні панелі", - "Name[vi]": "Ô bật lên biến dạng", - "Name[x-test]": "xxMorphing Popupsxx", - "Name[zh_CN]": "气泡大小渐变动画", - "Name[zh_TW]": "交錯彈出視窗" - }, - "X-KDE-Ordering": 60, - "X-KWin-Video-Url": "https://files.kde.org/plasma/kwin/effect-videos/morphingpopups.ogv", - "X-Plasma-API": "javascript" -} diff --git a/plugins/effects/overview/qml/main.qml b/plugins/effects/overview/qml/main.qml index 604d4ccf96..d6f0d6c1d4 100644 --- a/plugins/effects/overview/qml/main.qml +++ b/plugins/effects/overview/qml/main.qml @@ -32,7 +32,6 @@ FocusScope { property bool organized: false property bool verticalDesktopBar: KWinComponents.Workspace.desktopGridHeight >= bar.desktopCount && KWinComponents.Workspace.desktopGridHeight != 1 - property bool anyDesktopBar: verticalDesktopBar || KWinComponents.Workspace.desktopGridHeight == 1 // The values of overviewVal and gridVal might not be 0 on startup, // but we always want to animate from 0 to those values. So, we initially @@ -272,7 +271,6 @@ FocusScope { Item { id: desktopBar - visible: container.anyDesktopBar // (overviewVal, gridVal) represents the state of the overview // in a 2D coordinate plane. Math.atan2 returns the angle between @@ -308,7 +306,7 @@ FocusScope { opacity: desktopBar.opacity anchors.left: container.verticalDesktopBar ? desktopBar.right : parent.left anchors.right: parent.right - anchors.top: container.verticalDesktopBar || !container.anyDesktopBar ? parent.top : desktopBar.bottom + anchors.top: container.verticalDesktopBar ? parent.top : desktopBar.bottom anchors.topMargin: Kirigami.Units.largeSpacing height: searchField.height + 1 * Kirigami.Units.largeSpacing @@ -340,7 +338,7 @@ FocusScope { // These are the minimum position of maximum size of the desktop preview in the overview property int minX: Kirigami.Units.largeSpacing + (container.verticalDesktopBar ? desktopBar.width : 0) - property int minY: Kirigami.Units.largeSpacing + topBar.height + (container.verticalDesktopBar || !container.anyDesktopBar ? 0 : desktopBar.height) + property int minY: Kirigami.Units.largeSpacing + topBar.height + (container.verticalDesktopBar ? 0 : desktopBar.height) property int maxWidth: currentGeometry.width - minX - Kirigami.Units.gridUnit * 2 property int maxHeight: currentGeometry.height - minY - Kirigami.Units.gridUnit * 2 @@ -655,7 +653,6 @@ FocusScope { partialActivationFactor: container.overviewVal + container.gridVal * effect.organizedGrid targetScale: { - if (!container.anyDesktopBar) return targetScale; if (overviewVal != 1) return targetScale; let coordinate = container.verticalDesktopBar ? 'x' : 'y' if (!activeDragHandler.active) { diff --git a/plugins/effects/private/qml/WindowHeapDelegate.qml b/plugins/effects/private/qml/WindowHeapDelegate.qml index b1b2620efd..8bbbb9c762 100644 --- a/plugins/effects/private/qml/WindowHeapDelegate.qml +++ b/plugins/effects/private/qml/WindowHeapDelegate.qml @@ -103,8 +103,8 @@ Item { Drag.supportedActions: Qt.MoveAction Drag.source: thumb.window Drag.hotSpot: Qt.point( - thumb.activeDragHandler.centroid.pressPosition.x * thumb.targetScale, - thumb.activeDragHandler.centroid.pressPosition.y * thumb.targetScale) + thumb.activeDragHandler.centroid.pressPosition.x, + thumb.activeDragHandler.centroid.pressPosition.y) Drag.keys: ["kwin-window"] onXChanged: effect.checkItemDraggedOutOfScreen(thumbSource) @@ -166,20 +166,27 @@ Item { anchors.bottom: thumbSource.bottom anchors.bottomMargin: -Math.round(height / 4) visible: !thumb.activeHidden && !activeDragHandler.active - - - PlasmaExtras.ShadowedLabel { + PC3.Label { id: caption visible: thumb.windowTitleVisible width: cell.width maximumLineCount: 1 anchors.top: parent.bottom + anchors.topMargin: Kirigami.Units.smallSpacing anchors.horizontalCenter: parent.horizontalCenter elide: Text.ElideRight text: thumb.window.caption + color: Kirigami.Theme.textColor textFormat: Text.PlainText horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter + background: Rectangle { + anchors.centerIn: parent + height: parent.contentHeight + Kirigami.Units.smallSpacing + width: parent.contentWidth + Kirigami.Units.smallSpacing + color: Kirigami.Theme.backgroundColor + radius: Kirigami.Units.cornerRadius + } } } @@ -226,10 +233,10 @@ Item { name: "partial" PropertyChanges { target: thumb - x: (thumb.window.x - targetScreen.geometry.x - (thumb.windowHeap.absolutePositioning ? windowHeap.layout.Kirigami.ScenePosition.x : 0)) * (1 - thumb.partialActivationFactor) + cell.x * thumb.partialActivationFactor - y: (thumb.window.y - targetScreen.geometry.y - (thumb.windowHeap.absolutePositioning ? windowHeap.layout.Kirigami.ScenePosition.y : 0)) * (1 - thumb.partialActivationFactor) + cell.y * thumb.partialActivationFactor - width: thumb.window.width * (1 - thumb.partialActivationFactor) + cell.width * thumb.partialActivationFactor - height: thumb.window.height * (1 - thumb.partialActivationFactor) + cell.height * thumb.partialActivationFactor + x: (thumb.window.x - targetScreen.geometry.x - (thumb.windowHeap.absolutePositioning ? windowHeap.layout.Kirigami.ScenePosition.x : 0)) * (thumb.activeHidden ? 1 : 1 - thumb.partialActivationFactor) + (thumb.activeHidden ? 0 : cell.x * thumb.partialActivationFactor) + y: (thumb.window.y - targetScreen.geometry.y - (thumb.windowHeap.absolutePositioning ? windowHeap.layout.Kirigami.ScenePosition.y : 0)) * (thumb.activeHidden ? 1 : 1 - thumb.partialActivationFactor) + (thumb.activeHidden ? 0 : cell.y * thumb.partialActivationFactor) + width: thumb.window.width * (thumb.activeHidden ? 1 : 1 - thumb.partialActivationFactor) + cell.width * (thumb.activeHidden ? 0 : thumb.partialActivationFactor) + height: thumb.window.height * (thumb.activeHidden ? 1 : 1 - thumb.partialActivationFactor) + cell.height * (thumb.activeHidden ? 0 : thumb.partialActivationFactor) opacity: thumb.initialHidden ? (thumb.activeHidden ? 0 : thumb.partialActivationFactor) : (thumb.activeHidden ? 1 - thumb.partialActivationFactor : 1) diff --git a/plugins/effects/showpaint/showpaint.cpp b/plugins/effects/showpaint/showpaint.cpp index ef5ba751a0..f001644b20 100644 --- a/plugins/effects/showpaint/showpaint.cpp +++ b/plugins/effects/showpaint/showpaint.cpp @@ -28,7 +28,8 @@ ShowPaintEffect::ShowPaintEffect() auto* toggleAction = new QAction(this); toggleAction->setObjectName(QStringLiteral("Toggle")); toggleAction->setText(i18n("Toggle Show Paint")); - effects->registerGlobalShortcutAndDefault({}, toggleAction); + effects->registerGlobalShortcutAndDefault( + QList() << (Qt::CTRL | Qt::META | Qt::ALT | Qt::Key_P), toggleAction); connect(toggleAction, &QAction::triggered, this, &ShowPaintEffect::toggle); } diff --git a/plugins/effects/showpaint/showpaint_config.cpp b/plugins/effects/showpaint/showpaint_config.cpp index 65194abbd1..5f4de03165 100644 --- a/plugins/effects/showpaint/showpaint_config.cpp +++ b/plugins/effects/showpaint/showpaint_config.cpp @@ -33,8 +33,10 @@ ShowPaintEffectConfig::ShowPaintEffectConfig(QObject* parent, const KPluginMetaD QAction* toggleAction = actionCollection->addAction(QStringLiteral("Toggle")); toggleAction->setText(i18n("Toggle Show Paint")); toggleAction->setProperty("isConfigurationAction", true); - KGlobalAccel::self()->setDefaultShortcut(toggleAction, {}); - KGlobalAccel::self()->setShortcut(toggleAction, {}); + KGlobalAccel::self()->setDefaultShortcut( + toggleAction, QList() << (Qt::CTRL | Qt::META | Qt::ALT | Qt::Key_P)); + KGlobalAccel::self()->setShortcut( + toggleAction, QList() << (Qt::CTRL | Qt::META | Qt::ALT | Qt::Key_P)); m_ui.shortcutsEditor->addCollection(actionCollection); diff --git a/plugins/kdecorations/aurorae/src/qml/MenuButton.qml b/plugins/kdecorations/aurorae/src/qml/MenuButton.qml index 88655961d3..fa2c261cbb 100644 --- a/plugins/kdecorations/aurorae/src/qml/MenuButton.qml +++ b/plugins/kdecorations/aurorae/src/qml/MenuButton.qml @@ -15,10 +15,14 @@ import QtQuick import org.kde.kwin.decoration import org.kde.kirigami 2.20 as Kirigami -DecorationButton { - property bool closeOnDoubleClick: decorationSettings.closeOnDoubleClickOnMenu +Item { id: menuButton - buttonType: DecorationOptions.DecorationButtonMenu + property int buttonType: DecorationOptions.DecorationButtonMenu + property bool hovered: false + property bool pressed: false + property bool toggled: false + property bool closeOnDoubleClick: decorationSettings.closeOnDoubleClickOnMenu + Kirigami.Icon { anchors.fill: parent source: decoration.client.icon @@ -61,7 +65,7 @@ DecorationButton { } parent.pressed = false; } - onClicked: { + onClicked: (mouse) => { // for right clicks we show the menu instantly // and if the option is disabled we always show menu directly if (!menuButton.closeOnDoubleClick || mouse.button == Qt.RightButton) { diff --git a/plugins/scripts/desktopchangeosd/package/contents/ui/osd.qml b/plugins/scripts/desktopchangeosd/package/contents/ui/osd.qml index f3eaef917f..0c0cf0d3b1 100644 --- a/plugins/scripts/desktopchangeosd/package/contents/ui/osd.qml +++ b/plugins/scripts/desktopchangeosd/package/contents/ui/osd.qml @@ -10,12 +10,13 @@ import org.kde.kirigami 2.20 as Kirigami import org.kde.ksvg 1.0 as KSvg import org.kde.kwin -PlasmaCore.Dialog { +PlasmaCore.Window { id: dialog - location: PlasmaCore.Types.Floating visible: false flags: Qt.X11BypassWindowManagerHint | Qt.FramelessWindowHint - outputOnly: true + + width: mainItem.implicitWidth + leftPadding + rightPadding + height: mainItem.implicitHeight + topPadding + bottomPadding mainItem: Item { function loadConfig() { @@ -35,8 +36,8 @@ PlasmaCore.Dialog { property int animationDuration: 1000 property bool showGrid: true - width: dialogItem.showGrid ? view.itemWidth * view.columns : Math.ceil(textElement.implicitWidth) - height: dialogItem.showGrid ? view.itemHeight * view.rows + textElement.height : textElement.height + implicitWidth: dialogItem.showGrid ? view.itemWidth * view.columns : Math.ceil(textElement.implicitWidth) + implicitHeight: dialogItem.showGrid ? view.itemHeight * view.rows + textElement.implicitHeight : textElement.implicitHeight Kirigami.Heading { id: textElement diff --git a/tests/integration/pointer_input.cpp b/tests/integration/pointer_input.cpp index 727bde9086..d81e85c973 100644 --- a/tests/integration/pointer_input.cpp +++ b/tests/integration/pointer_input.cpp @@ -1659,10 +1659,10 @@ TEST_CASE("pointer input", "[input]") pointer_button_pressed(BTN_LEFT, timestamp++); QVERIFY(win::is_move(c)); - auto const sizeAllCursor = loadReferenceThemeCursor(Qt::SizeAllCursor); - QVERIFY(!sizeAllCursor.image.isNull()); - QCOMPARE(cursor()->platform_image().first, sizeAllCursor.image); - QCOMPARE(cursor()->platform_image().second, sizeAllCursor.hot_spot); + auto const closed_hand_cursor = loadReferenceThemeCursor(Qt::ClosedHandCursor); + QVERIFY(!closed_hand_cursor.image.isNull()); + QCOMPARE(cursor()->platform_image().first, closed_hand_cursor.image); + QCOMPARE(cursor()->platform_image().second, closed_hand_cursor.hot_spot); // finish moving the client keyboard_key_released(KEY_LEFTMETA, timestamp++);