mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
set window type to _NET_WM_WINDOW_TYPE_DOCK
This commit is contained in:
parent
d2feb8c227
commit
dedca4034a
@ -24,7 +24,14 @@ int main(int argc, char *argv[])
|
||||
MainWidget w;
|
||||
w.show();
|
||||
|
||||
XcbMisc::instance()->set_strut_partial(w.winId(), XcbMisc::OrientationBottom, w.height(), w.x(), w.x() + w.width());
|
||||
XcbMisc::instance()->set_window_type(w.winId(),
|
||||
XcbMisc::Dock);
|
||||
|
||||
XcbMisc::instance()->set_strut_partial(w.winId(),
|
||||
XcbMisc::OrientationBottom,
|
||||
w.height(),
|
||||
w.x(),
|
||||
w.x() + w.width());
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
|
||||
this->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->move(0,rec.height());
|
||||
this->move(0, rec.height() - this->height());
|
||||
|
||||
connect(DockModeData::instance(), SIGNAL(dockModeChanged(Dock::DockMode,Dock::DockMode)),
|
||||
this, SLOT(slotDockModeChanged(Dock::DockMode,Dock::DockMode)));
|
||||
|
@ -28,7 +28,25 @@ XcbMisc * XcbMisc::instance()
|
||||
return _xcb_misc_instance;
|
||||
}
|
||||
|
||||
void XcbMisc::set_strut_partial(int winId, Orientation orientation, uint strut, uint start, uint end)
|
||||
void XcbMisc::set_window_type(xcb_window_t winId, WindowType winType)
|
||||
{
|
||||
xcb_atom_t atoms[1];
|
||||
|
||||
switch (winType) {
|
||||
case WindowType::Desktop:
|
||||
atoms[0] = m_ewmh_connection._NET_WM_WINDOW_TYPE_DESKTOP;
|
||||
break;
|
||||
case WindowType::Dock:
|
||||
atoms[0] = m_ewmh_connection._NET_WM_WINDOW_TYPE_DOCK;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
xcb_ewmh_set_wm_window_type(&m_ewmh_connection, winId, 1, atoms);
|
||||
}
|
||||
|
||||
void XcbMisc::set_strut_partial(xcb_window_t winId, Orientation orientation, uint strut, uint start, uint end)
|
||||
{
|
||||
// xcb_ewmh_wm_strut_partial_t strut_partial is very different from
|
||||
// xcb_ewmh_wm_strut_partial_t strut_partial {};
|
||||
|
@ -14,11 +14,17 @@ public:
|
||||
OrientationBottom
|
||||
};
|
||||
|
||||
enum WindowType {
|
||||
Dock,
|
||||
Desktop
|
||||
};
|
||||
|
||||
virtual ~XcbMisc();
|
||||
|
||||
static XcbMisc * instance();
|
||||
|
||||
void set_strut_partial(int winId, Orientation orientation, uint strut, uint start, uint end);
|
||||
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);
|
||||
|
||||
private:
|
||||
XcbMisc();
|
||||
|
Loading…
x
Reference in New Issue
Block a user