mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-25 19:21:41 +03:00
added methods to reserve screen space
This commit is contained in:
parent
2c6ab968bd
commit
9debe8dbb3
@ -9,8 +9,11 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QRect>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
|
|
||||||
|
#include <Plasma>
|
||||||
|
|
||||||
namespace Latte {
|
namespace Latte {
|
||||||
|
|
||||||
class AbstractWindowInterface : public QObject {
|
class AbstractWindowInterface : public QObject {
|
||||||
@ -27,6 +30,9 @@ public:
|
|||||||
virtual WindowInfoWrap requestInfoActive() = 0;
|
virtual WindowInfoWrap requestInfoActive() = 0;
|
||||||
virtual const std::list<WId> &windows() = 0;
|
virtual const std::list<WId> &windows() = 0;
|
||||||
|
|
||||||
|
virtual void setDockStruts(const QRect &dockRect, Plasma::Types::Location location) = 0;
|
||||||
|
virtual void removeDockStruts() = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void activeWindowChanged(WId wid);
|
void activeWindowChanged(WId wid);
|
||||||
void windowChanged(const WindowInfoWrap &winfo);
|
void windowChanged(const WindowInfoWrap &winfo);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "xwindowinterface.h"
|
#include "xwindowinterface.h"
|
||||||
|
#include "../liblattedock/extras.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QtX11Extras/QX11Info>
|
#include <QtX11Extras/QX11Info>
|
||||||
|
|
||||||
#include <KWindowSystem>
|
#include <KWindowSystem>
|
||||||
@ -64,6 +66,54 @@ const std::list<WId> &XWindowInterface::windows()
|
|||||||
return m_windows;
|
return m_windows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XWindowInterface::setDockStruts(const QRect &dockRect, Plasma::Types::Location location)
|
||||||
|
{
|
||||||
|
NETExtendedStrut strut;
|
||||||
|
|
||||||
|
switch (location) {
|
||||||
|
case Plasma::Types::TopEdge:
|
||||||
|
strut.top_width = dockRect.height();
|
||||||
|
strut.top_start = dockRect.x();
|
||||||
|
strut.top_end = dockRect.x() + dockRect.width() - 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Plasma::Types::BottomEdge:
|
||||||
|
strut.bottom_width = dockRect.height();
|
||||||
|
strut.bottom_start = dockRect.x();
|
||||||
|
strut.bottom_end = dockRect.x() + dockRect.width() - 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Plasma::Types::LeftEdge:
|
||||||
|
strut.left_width = dockRect.width();
|
||||||
|
strut.left_start = dockRect.y();
|
||||||
|
strut.left_end = dockRect.y() + dockRect.height() - 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Plasma::Types::RightEdge:
|
||||||
|
strut.right_width = dockRect.width();
|
||||||
|
strut.right_start = dockRect.y();
|
||||||
|
strut.right_end = dockRect.y() + dockRect.height() - 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
qWarning() << "wrong location:" << qEnumToStr(location);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
KWindowSystem::setExtendedStrut(m_view->winId(),
|
||||||
|
strut.left_width, strut.left_start, strut.left_end,
|
||||||
|
strut.right_width, strut.right_start, strut.right_end,
|
||||||
|
strut.top_width, strut.top_start, strut.top_end,
|
||||||
|
strut.bottom_width, strut.bottom_start, strut.bottom_end
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XWindowInterface::removeDockStruts()
|
||||||
|
{
|
||||||
|
KWindowSystem::setStrut(m_view->winId(), 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
WindowInfoWrap XWindowInterface::requestInfoActive()
|
WindowInfoWrap XWindowInterface::requestInfoActive()
|
||||||
{
|
{
|
||||||
return requestInfo(KWindowSystem::activeWindow());
|
return requestInfo(KWindowSystem::activeWindow());
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#ifndef XWINDOWINTERFACE_H
|
#ifndef XWINDOWINTERFACE_H
|
||||||
#define XWINDOWINTERFACE_H
|
#define XWINDOWINTERFACE_H
|
||||||
|
|
||||||
|
#include "abstractwindowinterface.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include <KWindowInfo>
|
#include <KWindowInfo>
|
||||||
|
#include <Plasma>
|
||||||
#include "abstractwindowinterface.h"
|
|
||||||
|
|
||||||
namespace Latte {
|
namespace Latte {
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ class XWindowInterface : public AbstractWindowInterface {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
XWindowInterface(QQuickWindow *const view, QObject *parent);
|
XWindowInterface(QQuickWindow *const view, QObject *parent);
|
||||||
virtual ~XWindowInterface();
|
~XWindowInterface() override;
|
||||||
|
|
||||||
void setDockDefaultFlags() override;
|
void setDockDefaultFlags() override;
|
||||||
|
|
||||||
@ -23,6 +24,9 @@ public:
|
|||||||
WindowInfoWrap requestInfoActive() override;
|
WindowInfoWrap requestInfoActive() override;
|
||||||
const std::list<WId> &windows() override;
|
const std::list<WId> &windows() override;
|
||||||
|
|
||||||
|
void setDockStruts(const QRect &dockRect, Plasma::Types::Location location) override;
|
||||||
|
void removeDockStruts() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isValidWindow(const KWindowInfo &winfo);
|
bool isValidWindow(const KWindowInfo &winfo);
|
||||||
void windowChangedProxy(WId wid, NET::Properties prop1, NET::Properties2 prop2);
|
void windowChangedProxy(WId wid, NET::Properties prop1, NET::Properties2 prop2);
|
||||||
|
Loading…
Reference in New Issue
Block a user