mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Support managing _NET_WM_ICON_GEOMETRY
Resolves:https://bugzilla.deepin.io/show_bug.cgi?id=5295 Change-Id: Ib159db2751fb240f52b74f30e023ff8c3095c2ba
This commit is contained in:
parent
8cc89686d7
commit
3e443707d5
Notes:
Deepin Code Review
2016-06-14 07:19:47 +00:00
Code-Review+2: Sian Cao <yinshuiboy@gmail.com> Verified+1: Anonymous Coward #1000004 Submitted-by: Hualet Wang <mr.asianwang@gmail.com> Submitted-at: Thu, 10 Mar 2016 15:47:33 +0800 Reviewed-on: https://cr.deepin.io/11094 Project: dde/dde-dock Branch: refs/heads/master
@ -89,3 +89,8 @@ void XcbMisc::set_strut_partial(xcb_window_t winId, Orientation orientation, uin
|
||||
|
||||
xcb_ewmh_set_wm_strut_partial(&m_ewmh_connection, winId, strut_partial);
|
||||
}
|
||||
|
||||
void XcbMisc::set_window_icon_geometry(xcb_window_t winId, QRect geo)
|
||||
{
|
||||
xcb_ewmh_set_wm_icon_geometry(&m_ewmh_connection, winId, geo.x(), geo.y(), geo.width(), geo.height());
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
#ifndef XCB_MISC_H
|
||||
#define XCB_MISC_H
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
#include <xcb/xcb_ewmh.h>
|
||||
|
||||
class XcbMisc
|
||||
@ -34,6 +36,7 @@ public:
|
||||
|
||||
void set_window_type(xcb_window_t winId, WindowType winType);
|
||||
void set_strut_partial(xcb_window_t winId, Orientation orientation, uint strut, uint start, uint end);
|
||||
void set_window_icon_geometry(xcb_window_t winId, QRect geo);
|
||||
|
||||
private:
|
||||
XcbMisc();
|
||||
|
@ -185,6 +185,9 @@ void DockPanel::onDockModeChanged(Dock::DockMode, Dock::DockMode)
|
||||
mLayout->setAlignment(m_pluginLayout, Qt::AlignVCenter);
|
||||
m_pluginLayout->setAlignment(Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
// interval 0 stands for timeout will be triggered on idle.
|
||||
QTimer::singleShot(0, m_appLayout, &DockAppLayout::updateWindowIconGeometries);
|
||||
}
|
||||
|
||||
void DockPanel::onHideStateChanged(int dockState)
|
||||
@ -251,9 +254,9 @@ void DockPanel::onContentsSizeChanged()
|
||||
|
||||
m_appLayout->setFixedSize(rec.width - m_pluginLayout->width() - m_launcherItem->width(), m_dockModeData->getItemHeight());
|
||||
}
|
||||
m_appLayout->updateWindowIconGeometries();
|
||||
|
||||
setFixedSize(sizeHint().width(), m_dockModeData->getDockHeight());
|
||||
|
||||
emit sizeChanged();
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
**/
|
||||
|
||||
#include "dockappitem.h"
|
||||
#include "xcb_misc.h"
|
||||
|
||||
const QEasingCurve MOVE_ANIMATION_CURVE = QEasingCurve::OutCubic;
|
||||
|
||||
@ -234,6 +235,8 @@ void DockAppItem::updateXidTitleMap()
|
||||
QJsonObject obj = v.toObject();
|
||||
m_itemData.xidTitleMap.insert(obj.value("Xid").toInt(), obj.value("Title").toString());
|
||||
}
|
||||
|
||||
setWindowIconGeometries();
|
||||
}
|
||||
|
||||
void DockAppItem::updateMenuJsonString()
|
||||
@ -241,6 +244,14 @@ void DockAppItem::updateMenuJsonString()
|
||||
m_itemData.menuJsonString = m_entryProxyer->data().value("menu");
|
||||
}
|
||||
|
||||
void DockAppItem::setWindowIconGeometries()
|
||||
{
|
||||
for (int xid : m_itemData.xidTitleMap.keys()) {
|
||||
qDebug() << "set _NET_WM_WINDOW_ICON_GEOMETRY for window " << xid << " to " << globalPos() << size();
|
||||
XcbMisc::instance()->set_window_icon_geometry(xid, QRect(globalPos(), size()));
|
||||
}
|
||||
}
|
||||
|
||||
void DockAppItem::onDbusDataChanged(const QString &, const QString &)
|
||||
{
|
||||
updateTitle();
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
void setEntryProxyer(DBusDockEntry *entryProxyer);
|
||||
bool actived() const;
|
||||
void setActived(bool actived);
|
||||
void setWindowIconGeometries();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
@ -197,6 +197,18 @@ void DockAppLayout::initEntries() const
|
||||
m_appManager->initEntries();
|
||||
}
|
||||
|
||||
void DockAppLayout::updateWindowIconGeometries()
|
||||
{
|
||||
qDebug() << "update window icon geometries.";
|
||||
|
||||
for (QWidget *w : widgets()) {
|
||||
DockAppItem * item = qobject_cast<DockAppItem *>(w);
|
||||
if (item) {
|
||||
item->setWindowIconGeometries();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockAppLayout::enterEvent(QEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
@ -290,6 +302,9 @@ void DockAppLayout::onDrop(QDropEvent *event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// interval 0 stands for timeout will be triggered on idle.
|
||||
QTimer::singleShot(0, this, &DockAppLayout::updateWindowIconGeometries);
|
||||
}
|
||||
|
||||
void DockAppLayout::onDragLeave(QDragLeaveEvent *event)
|
||||
|
@ -25,6 +25,9 @@ public:
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
void initEntries() const;
|
||||
|
||||
public slots:
|
||||
void updateWindowIconGeometries();
|
||||
|
||||
signals:
|
||||
void needPreviewUpdate();
|
||||
void needPreviewHide(bool immediately);
|
||||
|
Loading…
x
Reference in New Issue
Block a user