mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
mobileshell: Add more null checks
This commit is contained in:
parent
0b26be6331
commit
bd95aa89b4
1 changed files with 27 additions and 15 deletions
|
|
@ -95,26 +95,37 @@ void ShellUtil::launchApp(const QString &storageId)
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellUtil::setInputTransparent(QQuickWindow *window, bool transparent) {
|
void ShellUtil::setInputTransparent(QQuickWindow *window, bool transparent)
|
||||||
if (window) {
|
{
|
||||||
Qt::WindowFlags flags = window->flags();
|
if (!window) {
|
||||||
if (transparent) {
|
return;
|
||||||
flags |= Qt::WindowTransparentForInput;
|
|
||||||
} else {
|
|
||||||
flags &= ~Qt::WindowTransparentForInput;
|
|
||||||
}
|
|
||||||
window->setFlags(flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Qt::WindowFlags flags = window->flags();
|
||||||
|
if (transparent) {
|
||||||
|
flags |= Qt::WindowTransparentForInput;
|
||||||
|
} else {
|
||||||
|
flags &= ~Qt::WindowTransparentForInput;
|
||||||
|
}
|
||||||
|
window->setFlags(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellUtil::setWindowLayer(QQuickWindow *window, LayerShellQt::Window::Layer layer) {
|
void ShellUtil::setWindowLayer(QQuickWindow *window, LayerShellQt::Window::Layer layer)
|
||||||
if (window) {
|
{
|
||||||
auto layerShellWindow = LayerShellQt::Window::get(window);
|
if (!window) {
|
||||||
layerShellWindow->setLayer(layer);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto layerShellWindow = LayerShellQt::Window::get(window);
|
||||||
|
layerShellWindow->setLayer(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellUtil::setInputRegion(QWindow *window, const QRect ®ion) {
|
void ShellUtil::setInputRegion(QWindow *window, const QRect ®ion)
|
||||||
|
{
|
||||||
|
if (!window) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
|
auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
|
||||||
if (!waylandWindow) {
|
if (!waylandWindow) {
|
||||||
qWarning() << "Failed to retrieve Wayland window handle.";
|
qWarning() << "Failed to retrieve Wayland window handle.";
|
||||||
|
|
@ -152,6 +163,7 @@ void ShellUtil::setInputRegion(QWindow *window, const QRect ®ion) {
|
||||||
wl_surface_commit(surface);
|
wl_surface_commit(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ShellUtil::toPlainText(QString htmlString) {
|
QString ShellUtil::toPlainText(QString htmlString)
|
||||||
|
{
|
||||||
return QTextDocumentFragment::fromHtml(htmlString).toPlainText();
|
return QTextDocumentFragment::fromHtml(htmlString).toPlainText();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue