fix(wayland): Fixed 990 machine crashing when running under the machine
Description:修复990机器下运行会崩溃的问题 Log: 无
This commit is contained in:
parent
cfe2038a26
commit
eb675096ee
|
@ -28,4 +28,4 @@ set(Common_SRC
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(Common STATIC ${Common_SRC})
|
add_library(Common STATIC ${Common_SRC})
|
||||||
target_link_libraries(Common Qt5::Core Qt5::DBus Qt5::Widgets ${GIOUNIX2_LIBRARIES} ${KF5Wayland_LIBRARIES} -lKF5WaylandClient -lKF5WaylandServer KF5::WindowSystem)
|
target_link_libraries(Common Qt5::Core Qt5::DBus Qt5::Widgets Qt5::X11Extras ${GIOUNIX2_LIBRARIES} ${KF5Wayland_LIBRARIES} -lKF5WaylandClient -lKF5WaylandServer KF5::WindowSystem)
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "plasma-shell-manager.h"
|
#include "plasma-shell-manager.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QX11Info>
|
||||||
|
|
||||||
#include <KWayland/Client/connection_thread.h>
|
#include <KWayland/Client/connection_thread.h>
|
||||||
#include <KWayland/Client/registry.h>
|
#include <KWayland/Client/registry.h>
|
||||||
|
@ -31,6 +32,9 @@ static PlasmaShellManager* global_instance = nullptr;
|
||||||
|
|
||||||
PlasmaShellManager *PlasmaShellManager::getInstance()
|
PlasmaShellManager *PlasmaShellManager::getInstance()
|
||||||
{
|
{
|
||||||
|
if(QString(qgetenv("XDG_SESSION_TYPE")) != "wayland" || QX11Info::isPlatformX11()){
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
if (!global_instance)
|
if (!global_instance)
|
||||||
{
|
{
|
||||||
global_instance = new PlasmaShellManager;
|
global_instance = new PlasmaShellManager;
|
||||||
|
|
|
@ -28,7 +28,7 @@ LettersWidget::LettersWidget(QWidget *parent/* = nullptr*/)
|
||||||
this->setAttribute(Qt::WA_TranslucentBackground);//背景透明
|
this->setAttribute(Qt::WA_TranslucentBackground);//背景透明
|
||||||
initUI();
|
initUI();
|
||||||
|
|
||||||
if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") {
|
if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland" && !QX11Info::isPlatformX11()) {
|
||||||
isWayland = true;
|
isWayland = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,7 @@ bool FullBackgroundWidget::eventFilter(QObject *obj, QEvent *event)
|
||||||
if(event->type() == QEvent::WindowDeactivate){
|
if(event->type() == QEvent::WindowDeactivate){
|
||||||
QTimer::singleShot(50,this,SLOT(laterActivate()));
|
QTimer::singleShot(50,this,SLOT(laterActivate()));
|
||||||
}else if(event->type() == QEvent::WindowActivate){
|
}else if(event->type() == QEvent::WindowActivate){
|
||||||
if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") {
|
if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland" && !QX11Info::isPlatformX11()) {
|
||||||
PlasmaShellManager::getInstance()->setAppWindowKeepAbove(true);
|
PlasmaShellManager::getInstance()->setAppWindowKeepAbove(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1222,7 +1222,7 @@ void FullBackgroundWidget::onDesktopResized()
|
||||||
update();
|
update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") {
|
if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland" && !QX11Info::isPlatformX11() ) {
|
||||||
PlasmaShellManager::getInstance()->setPos(this->windowHandle(),QPoint(0,0));
|
PlasmaShellManager::getInstance()->setPos(this->windowHandle(),QPoint(0,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QX11Info>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QDBusInterface>
|
#include <QDBusInterface>
|
||||||
#include "plasma-shell-manager.h"
|
#include "plasma-shell-manager.h"
|
||||||
|
@ -253,9 +254,6 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_INTEL
|
#ifndef USE_INTEL
|
||||||
if (QString(qgetenv("XDG_SESSION_TYPE")) == "wayland")
|
|
||||||
window->show();
|
|
||||||
else
|
|
||||||
window->show();
|
window->show();
|
||||||
window->activateWindow();
|
window->activateWindow();
|
||||||
#endif
|
#endif
|
||||||
|
@ -300,7 +298,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
bool isWayland = false;
|
bool isWayland = false;
|
||||||
if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") {
|
if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland" && !QX11Info::isPlatformX11()) {
|
||||||
isWayland = true;
|
isWayland = true;
|
||||||
}
|
}
|
||||||
if (isWayland){
|
if (isWayland){
|
||||||
|
|
Loading…
Reference in New Issue