parent
477575e9fb
commit
bcc11daef9
@ -1,52 +0,0 @@
|
|||||||
From 703db225dfa722af66e330547a3353238e76ec38 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Palo Kisa <palo.kisa@gmail.com>
|
|
||||||
Date: Wed, 27 Apr 2022 08:27:06 +0200
|
|
||||||
Subject: [PATCH] dialog: Force correct position after move from outside
|
|
||||||
|
|
||||||
..of application.
|
|
||||||
|
|
||||||
For some reason the dialog gets repositioned by "outer world" (VM?) to
|
|
||||||
wrong position (0,0). The root cause of this move is yet unknown and
|
|
||||||
this is a workaround to avoid wong position of the window.
|
|
||||||
---
|
|
||||||
dialog.cpp | 14 ++++++++++++++
|
|
||||||
dialog.h | 1 +
|
|
||||||
2 files changed, 15 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/dialog.cpp b/dialog.cpp
|
|
||||||
index 7164c65..5667817 100644
|
|
||||||
--- a/dialog.cpp
|
|
||||||
+++ b/dialog.cpp
|
|
||||||
@@ -183,6 +183,20 @@ void Dialog::resizeEvent(QResizeEvent *event)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+/************************************************
|
|
||||||
+
|
|
||||||
+ ************************************************/
|
|
||||||
+void Dialog::moveEvent(QMoveEvent *event)
|
|
||||||
+{
|
|
||||||
+ // Note: For some reason the dialog gets repositioned by "outer world" (VM?) to
|
|
||||||
+ // wrong position (0,0). The root cause of this move is yet unknown and
|
|
||||||
+ // this is a workaround to avoid wong position of the window.
|
|
||||||
+ if (event->spontaneous())
|
|
||||||
+ QTimer::singleShot(0, this, &Dialog::realign);
|
|
||||||
+ return QDialog::moveEvent(event);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
diff --git a/dialog.h b/dialog.h
|
|
||||||
index 0ca29bf..a71dd3d 100644
|
|
||||||
--- a/dialog.h
|
|
||||||
+++ b/dialog.h
|
|
||||||
@@ -64,6 +64,7 @@ class Dialog : public QDialog
|
|
||||||
protected:
|
|
||||||
void closeEvent(QCloseEvent *event);
|
|
||||||
void resizeEvent(QResizeEvent *event);
|
|
||||||
+ void moveEvent(QMoveEvent *event);
|
|
||||||
bool eventFilter(QObject *object, QEvent *event);
|
|
||||||
bool editKeyPressEvent(QKeyEvent *event);
|
|
||||||
bool listKeyPressEvent(QKeyEvent *event);
|
|
@ -1,75 +0,0 @@
|
|||||||
From 88a4d2fb49bc37794a14b7d86b90d515f472d372 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Palo Kisa <palo.kisa@gmail.com>
|
|
||||||
Date: Wed, 27 Apr 2022 08:32:54 +0200
|
|
||||||
Subject: [PATCH] dialog: Listen to KwindowSystem signals only when shown
|
|
||||||
|
|
||||||
Most of the time the runner window is not shown and we don't need to be
|
|
||||||
notified about all the focus/desktop changes.
|
|
||||||
---
|
|
||||||
dialog.cpp | 25 ++++++++++++++++++++++---
|
|
||||||
dialog.h | 2 ++
|
|
||||||
2 files changed, 24 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/dialog.cpp b/dialog.cpp
|
|
||||||
index 5667817..0b9a0e9 100644
|
|
||||||
--- a/dialog.cpp
|
|
||||||
+++ b/dialog.cpp
|
|
||||||
@@ -133,8 +133,6 @@ Dialog::Dialog(QWidget *parent) :
|
|
||||||
|
|
||||||
connect(mGlobalShortcut, &GlobalKeyShortcut::Action::activated, this, &Dialog::showHide);
|
|
||||||
connect(mGlobalShortcut, &GlobalKeyShortcut::Action::shortcutChanged, this, &Dialog::shortcutChanged);
|
|
||||||
- connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, this, &Dialog::onActiveWindowChanged);
|
|
||||||
- connect(KWindowSystem::self(), &KWindowSystem::currentDesktopChanged, this, &Dialog::onCurrentDesktopChanged);
|
|
||||||
|
|
||||||
resize(mSettings->value(QL1S("dialog/width"), 400).toInt(), size().height());
|
|
||||||
|
|
||||||
@@ -197,6 +195,28 @@ void Dialog::moveEvent(QMoveEvent *event)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+/************************************************
|
|
||||||
+
|
|
||||||
+ ************************************************/
|
|
||||||
+void Dialog::showEvent(QShowEvent *event)
|
|
||||||
+{
|
|
||||||
+ connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, this, &Dialog::onActiveWindowChanged);
|
|
||||||
+ connect(KWindowSystem::self(), &KWindowSystem::currentDesktopChanged, this, &Dialog::onCurrentDesktopChanged);
|
|
||||||
+ return QDialog::showEvent(event);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+/************************************************
|
|
||||||
+
|
|
||||||
+ ************************************************/
|
|
||||||
+void Dialog::hideEvent(QHideEvent *event)
|
|
||||||
+{
|
|
||||||
+ QDialog::hideEvent(event);
|
|
||||||
+ disconnect(KWindowSystem::self(), &KWindowSystem::currentDesktopChanged, this, &Dialog::onCurrentDesktopChanged);
|
|
||||||
+ disconnect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, this, &Dialog::onActiveWindowChanged);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
@@ -397,7 +417,6 @@ void Dialog::applySettings()
|
|
||||||
mCommandItemModel->showHistoryFirst(mSettings->value(QL1S("dialog/history_first"), true).toBool());
|
|
||||||
ui->commandList->setShownCount(mSettings->value(QL1S("dialog/list_shown_items"), 4).toInt());
|
|
||||||
|
|
||||||
- realign();
|
|
||||||
mSettings->sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/dialog.h b/dialog.h
|
|
||||||
index a71dd3d..8b7b36f 100644
|
|
||||||
--- a/dialog.h
|
|
||||||
+++ b/dialog.h
|
|
||||||
@@ -65,6 +65,8 @@ class Dialog : public QDialog
|
|
||||||
void closeEvent(QCloseEvent *event);
|
|
||||||
void resizeEvent(QResizeEvent *event);
|
|
||||||
void moveEvent(QMoveEvent *event);
|
|
||||||
+ void showEvent(QShowEvent *event);
|
|
||||||
+ void hideEvent(QHideEvent *event);
|
|
||||||
bool eventFilter(QObject *object, QEvent *event);
|
|
||||||
bool editKeyPressEvent(QKeyEvent *event);
|
|
||||||
bool listKeyPressEvent(QKeyEvent *event);
|
|
@ -1,2 +0,0 @@
|
|||||||
221-1.patch
|
|
||||||
221-2.patch
|
|
Loading…
Reference in new issue