Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frame/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ target_link_directories(dde-shell-frame INTERFACE

if (BUILD_WITH_X11)
target_compile_definitions(dde-shell-frame PRIVATE BUILD_WITH_X11)
pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb-ewmh xtst x11)
pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb-ewmh xcb-icccm xtst x11)
target_sources(dde-shell-frame PRIVATE layershell/x11dlayershellemulation.h layershell/x11dlayershellemulation.cpp)
target_link_libraries(dde-shell-frame PRIVATE PkgConfig::XCB)
endif(BUILD_WITH_X11)
Expand Down
2 changes: 1 addition & 1 deletion frame/layershell/dlayershellwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DLayerShellWindowPrivate
}

QWindow* parentWindow;
QString scope = QStringLiteral("window");
QString scope;
DLayerShellWindow::Anchors anchors = {DLayerShellWindow::AnchorNone};
int32_t exclusionZone = 0;
DLayerShellWindow::KeyboardInteractivity keyboardInteractivity = DLayerShellWindow::KeyboardInteractivityNone;
Expand Down
37 changes: 35 additions & 2 deletions frame/layershell/x11dlayershellemulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
#include "dlayershellwindow.h"
#include "x11dlayershellemulation.h"

#include <QScreen>
#include <QMargins>
#include <QGuiApplication>

Check warning on line 9 in frame/layershell/x11dlayershellemulation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QGuiApplication> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QLoggingCategory>

Check warning on line 10 in frame/layershell/x11dlayershellemulation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QLoggingCategory> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QMargins>

Check warning on line 11 in frame/layershell/x11dlayershellemulation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QMargins> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QScreen>

Check warning on line 12 in frame/layershell/x11dlayershellemulation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QScreen> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <qpa/qplatformwindow.h>

Check warning on line 14 in frame/layershell/x11dlayershellemulation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <qpa/qplatformwindow.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <qpa/qplatformwindow_p.h>

Check warning on line 15 in frame/layershell/x11dlayershellemulation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <qpa/qplatformwindow_p.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <xcb/xcb.h>

Check warning on line 17 in frame/layershell/x11dlayershellemulation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <xcb/xcb.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <xcb/xcb_ewmh.h>

Check warning on line 18 in frame/layershell/x11dlayershellemulation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <xcb/xcb_ewmh.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <xcb/xcb_icccm.h>

Check warning on line 19 in frame/layershell/x11dlayershellemulation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <xcb/xcb_icccm.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

DS_BEGIN_NAMESPACE

Expand Down Expand Up @@ -66,6 +67,9 @@

connect(qApp, &QGuiApplication::screenRemoved, &m_exclusionZoneChangedTimer, static_cast<void (QTimer::*)()>(&QTimer::start));

onScopeChanged();
connect(m_dlayerShellWindow, &DLayerShellWindow::scopeChanged, this, &LayerShellEmulation::onScopeChanged);

// connect(m_dlayerShellWindow, &DS_NAMESPACE::DLayerShellWindow::keyboardInteractivityChanged, this, &LayerShellEmulation::onKeyboardInteractivityChanged);
}

Expand Down Expand Up @@ -272,6 +276,35 @@
xcb_ewmh_set_wm_strut_partial(&ewmh_connection, m_window->winId(), strut_partial);
}

void LayerShellEmulation::onScopeChanged()
{
auto *x11Application = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
if (!x11Application || !m_window->winId()) {
return;
}

QString instanceName = m_dlayerShellWindow->scope();
if (instanceName.isEmpty()) {
// Don't set WM_CLASS for default scope, let X11 use its default behavior
return;
}

// Set WM_CLASS property
// Format: instance_name\0class_name\0
// - instance_name: scope value (e.g., "dock", "notification")
// - class_name: application binary name (e.g., "dde-shell")
QString className = QCoreApplication::applicationName();
QByteArray wmClassData;
wmClassData.append(instanceName.toUtf8());
wmClassData.append('\0');
wmClassData.append(className.toUtf8());
wmClassData.append('\0');

xcb_icccm_set_wm_class(x11Application->connection(), m_window->winId(), wmClassData.length(), wmClassData.constData());

qCDebug(layershell) << "Set WM_CLASS for window" << m_window->winId() << " wm_class:" << wmClassData;
}

// void X11Emulation::onKeyboardInteractivityChanged()
// {
// // kwin no implentation on wayland
Expand Down
1 change: 1 addition & 0 deletions frame/layershell/x11dlayershellemulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private slots:
// margins or anchor changed
void onPositionChanged();
void onExclusionZoneChanged();
void onScopeChanged();
// void onKeyboardInteractivityChanged();

private:
Expand Down
Loading