kwin/wayland_cursor_theme.h
David Edmundson 5b4eb80c8f Set specific edge cursor shape when resizing
Summary:
Instead of seeing the cursor <--> on the left edge you now see an icon
that looks like |<-  .

This brings kwin decorations in line with GTK CSD icons.

In theory this is also useful to tell which window will resize in the
case of side-by-side windows (regardless of whether borders are on or
not). In practice with the adwaita icon theme I tested with it's not
very intuitive to realise which is which till you learn the icon.

Change is more involved than it should be as Qt::CursorShape doesn't
have these entries, and I don't want to shadow that enum internally or
have
to change kwin effect code.

Specifics depend on cursor icon theme if they are not present it will
fallback to the <--> icon. (Breeze does not have them currently)

Test Plan:
Resized some windows (on X and on Wayland)
Correct icon appeared on Adwaita
Existing icon appeared on Breeze

Reviewers: #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13396
2018-06-11 10:05:07 +01:00

64 lines
1.6 KiB
C++

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2015 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/>.
*********************************************************************/
#ifndef KWIN_WAYLAND_CURSOR_THEME_H
#define KWIN_WAYLAND_CURSOR_THEME_H
#include <kwin_export.h>
#include <QObject>
#include "cursor.h"
struct wl_cursor_image;
struct wl_cursor_theme;
namespace KWayland
{
namespace Client
{
class ShmPool;
}
}
namespace KWin
{
class KWIN_EXPORT WaylandCursorTheme : public QObject
{
Q_OBJECT
public:
explicit WaylandCursorTheme(KWayland::Client::ShmPool *shm, QObject *parent = nullptr);
virtual ~WaylandCursorTheme();
wl_cursor_image *get(CursorShape shape);
wl_cursor_image *get(const QByteArray &name);
Q_SIGNALS:
void themeChanged();
private:
void loadTheme();
void destroyTheme();
wl_cursor_theme *m_theme;
KWayland::Client::ShmPool *m_shm = nullptr;
};
}
#endif