mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
check wid
Change-Id: I44b10ad9ee9f4c2590f82b88fa1acbcf23e7e835
This commit is contained in:
parent
3ff0ce241e
commit
c252d5052a
Notes:
Deepin Code Review
2017-06-12 20:17:36 +08:00
Verified+1: Anonymous Coward #1000004 Verified+1: <zhaofangfang@linuxdeepin.com> Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Mon, 12 Jun 2017 20:17:33 +0800 Reviewed-on: https://cr.deepin.io/23737 Project: dde/dde-dock Branch: refs/heads/master
@ -121,6 +121,11 @@ public Q_SLOTS: // METHODS
|
||||
return asyncCall(QStringLiteral("RequestDock"));
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> Check()
|
||||
{
|
||||
return asyncCall(QStringLiteral("Check"));
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> RequestUndock()
|
||||
{
|
||||
return asyncCall(QStringLiteral("RequestUndock"));
|
||||
|
@ -4,6 +4,9 @@
|
||||
#include "util/imagefactory.h"
|
||||
#include "xcb/xcb_misc.h"
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include <QPainter>
|
||||
#include <QDrag>
|
||||
#include <QMouseEvent>
|
||||
@ -81,6 +84,7 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
||||
connect(m_appPreviewTips, &_PreviewContainer::requestPreviewWindow, this, &AppItem::requestPreviewWindow, Qt::QueuedConnection);
|
||||
connect(m_appPreviewTips, &_PreviewContainer::requestCancelPreview, this, &AppItem::requestCancelPreview, Qt::QueuedConnection);
|
||||
connect(m_appPreviewTips, &_PreviewContainer::requestHidePreview, this, &AppItem::hidePopup, Qt::QueuedConnection);
|
||||
connect(m_appPreviewTips, &_PreviewContainer::requestCheckWindows, m_itemEntry, &DBusDockEntry::Check);
|
||||
|
||||
updateTitle();
|
||||
refershIcon();
|
||||
|
@ -133,6 +133,7 @@ void _PreviewContainer::appendSnapWidget(const WId wid)
|
||||
connect(snap, &AppSnapshot::clicked, this, &_PreviewContainer::requestCancelPreview, Qt::QueuedConnection);
|
||||
connect(snap, &AppSnapshot::clicked, this, &_PreviewContainer::requestHidePreview, Qt::QueuedConnection);
|
||||
connect(snap, &AppSnapshot::entered, this, &_PreviewContainer::previewEntered, Qt::QueuedConnection);
|
||||
connect(snap, &AppSnapshot::requestCheckWindow, this, &_PreviewContainer::requestCheckWindows);
|
||||
|
||||
m_windowListLayout->addWidget(snap);
|
||||
|
||||
|
@ -29,6 +29,7 @@ signals:
|
||||
void requestPreviewWindow(const WId wid) const;
|
||||
void requestCancelPreview() const;
|
||||
void requestHidePreview() const;
|
||||
void requestCheckWindows() const;
|
||||
|
||||
public:
|
||||
void setWindowInfos(const WindowDict &infos);
|
||||
|
@ -79,9 +79,17 @@ void AppSnapshot::fetchSnapshot()
|
||||
|
||||
const auto display = QX11Info::display();
|
||||
|
||||
XWindowAttributes attrs;
|
||||
XGetWindowAttributes(display, m_wid, &attrs);
|
||||
XImage *ximage = XGetImage(display, m_wid, 0, 0, attrs.width, attrs.height, AllPlanes, ZPixmap);
|
||||
Window unused_window;
|
||||
int unused_int;
|
||||
unsigned unused_uint, w, h;
|
||||
XGetGeometry(display, m_wid, &unused_window, &unused_int, &unused_int, &w, &h, &unused_uint, &unused_uint);
|
||||
XImage *ximage = XGetImage(display, m_wid, 0, 0, w, h, AllPlanes, ZPixmap);
|
||||
if (!ximage)
|
||||
{
|
||||
emit requestCheckWindow();
|
||||
return;
|
||||
}
|
||||
|
||||
const QImage qimage((const uchar*)(ximage->data), ximage->width, ximage->height, ximage->bytes_per_line, QImage::Format_RGB32);
|
||||
Q_ASSERT(!qimage.isNull());
|
||||
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
signals:
|
||||
void entered(const WId wid) const;
|
||||
void clicked(const WId wid) const;
|
||||
void requestCheckWindow() const;
|
||||
|
||||
public slots:
|
||||
void fetchSnapshot();
|
||||
|
@ -48,11 +48,14 @@ void FloatingPreview::paintEvent(QPaintEvent *e)
|
||||
if (m_tracked.isNull())
|
||||
return;
|
||||
|
||||
const QImage snapshot = m_tracked->snapshot();
|
||||
if (snapshot.isNull())
|
||||
return;
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
const QRect r = rect().marginsRemoved(QMargins(8, 8, 8, 8));
|
||||
const QImage snapshot = m_tracked->snapshot();
|
||||
const QImage im = snapshot.scaled(r.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
const QRect ir = im.rect();
|
||||
const QPoint offset = r.center() - ir.center();
|
||||
|
Loading…
x
Reference in New Issue
Block a user