63 lines
1.5 KiB
C++
63 lines
1.5 KiB
C++
/*
|
|
Xembed Tray Manager Proxy - holds one embedded window
|
|
SPDX-FileCopyrightText: 2015 David Edmundson <davidedmundson@kde.org>
|
|
SPDX-FileCopyrightText: 2019 Konrad Materka <materka@gmail.com>
|
|
SPDX-License-Identifier: LGPL-2.1-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QPixmap>
|
|
#include <QPoint>
|
|
#include <QImage>
|
|
#include <QGuiApplication>
|
|
|
|
#include <xcb/xcb.h>
|
|
#include <xcb/xcb_image.h>
|
|
|
|
class TrayManagerProxy : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit TrayManagerProxy(xcb_window_t wid, QObject *parent = nullptr);
|
|
~TrayManagerProxy() override;
|
|
|
|
void update();
|
|
void resizeWindow(const uint16_t width, const uint16_t height) const;
|
|
|
|
/**
|
|
* @return the window id of this item
|
|
*/
|
|
uint32_t windowId() const { return m_windowId; }
|
|
|
|
/**
|
|
* @return the name/title of this item
|
|
*/
|
|
QString name() const { return m_name; }
|
|
|
|
private:
|
|
enum InjectMode {
|
|
Direct,
|
|
XTest,
|
|
};
|
|
|
|
QSize calculateClientWindowSize() const;
|
|
void sendClick(uint8_t mouseButton, int x, int y);
|
|
QImage getImageNonComposite() const;
|
|
bool isTransparentImage(const QImage &image) const;
|
|
QImage convertFromNative(xcb_image_t *xcbImage) const;
|
|
QPoint calculateClickPoint() const;
|
|
void setActiveForInput(bool active) const;
|
|
QString getWindowName() const;
|
|
|
|
QNativeInterface::QX11Application *m_x11Interface = nullptr;
|
|
xcb_window_t m_windowId;
|
|
xcb_window_t m_containerWid;
|
|
uint32_t m_damageId = 0;
|
|
InjectMode m_injectMode;
|
|
QString m_name;
|
|
QImage m_lastImage;
|
|
};
|