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
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
dde-session-shell (6.0.17) unstable; urgency=medium

* fix: trayWidget shouldn't acquire focus
* fix: add runtime dependency `onboard` for dde-session-shell

-- YuMing He <heyuming@deepin.org> Tue, 30 Jan 2024 10:17:50 +0800

dde-session-shell (6.0.16) unstable; urgency=medium

* fix: switch tty can not lock screen
Expand Down
6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${dist:Depends},
deepin-authenticate(>=1.2.27),
libssl3,
libxcb-util0|libxcb-util1,
xsettingsd
xsettingsd,
onboard
Provides: lightdm-greeter
Recommends: onboard,
dss-network-plugin,
Recommends: dss-network-plugin,
dde-network-dialog
Conflicts: dde-workspace,
deepin-notifications,
Expand Down
26 changes: 13 additions & 13 deletions modules/virtualkeyboard/keyboardiconwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ void KeyboardIconWidget::setIconPath(const QString &iconPath)
update();
}

bool KeyboardIconWidget::event(QEvent *event) {
if (event->type() == QEvent::User + 10) {
QWidget *topLevelWidget = this->topLevelWidget();
if (topLevelWidget) {
// 获取顶层窗口,虚拟键盘窗口中需要知道顶层窗口以便移动位置
Q_EMIT clicked(topLevelWidget);
}
}

return QWidget::event(event);
}


void KeyboardIconWidget::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
Expand Down Expand Up @@ -53,16 +66,3 @@ void KeyboardIconWidget::hideEvent(QHideEvent *event)

QWidget::hideEvent(event);
}

void KeyboardIconWidget::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
QWidget *topLevelWidget = this->topLevelWidget();
if (topLevelWidget) {
// 获取顶层窗口,虚拟键盘窗口中需要知道顶层窗口以便移动位置
Q_EMIT clicked(topLevelWidget);
}
}

QWidget::mousePressEvent(event);
}
8 changes: 4 additions & 4 deletions modules/virtualkeyboard/keyboardiconwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class KeyboardIconWidget : public QWidget
void clicked(QWidget *parent);

protected:
virtual void paintEvent(QPaintEvent *event);
virtual void hideEvent(QHideEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
bool event(QEvent *event) override;
virtual void paintEvent(QPaintEvent *event);
virtual void hideEvent(QHideEvent *event);

private:
QString m_iconPath;
QString m_iconPath;
};

#endif // KEYBOARDICONWIDGET_H
19 changes: 18 additions & 1 deletion src/widgets/controlwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,38 @@ static constexpr int TipsBottomDistance = 10;
using namespace dss;
DCORE_USE_NAMESPACE

void FloatingButton::showCustomWidget() const {
qInfo() << __PRETTY_FUNCTION__;
QEvent eve{static_cast<QEvent::Type>(QEvent::User + 10)};
if (pluginItem() != nullptr) {
QCoreApplication::sendEvent(pluginItem(), &eve);
}
}

bool FloatingButton::eventFilter(QObject *watch, QEvent *event)
{
if (watch == this) {
if (event->type() == QEvent::MouseButtonRelease) {
QMouseEvent *e = static_cast<QMouseEvent *>(event);
if (e->button() == Qt::RightButton) {
Q_EMIT requestShowMenu();
} else if (e->button() == Qt::LeftButton) {
showCustomWidget();
}
} else if (event->type() == QEvent::Enter) {
Q_EMIT requestShowTips();
} else if (event->type() == QEvent::Leave || event->type() == QEvent::MouseButtonPress) {
Q_EMIT requestHideTips();
} else if (event->type() == QEvent::KeyRelease) {
auto *keyEve = dynamic_cast<QKeyEvent *>(event);
if (keyEve->key() == Qt::Key_Return ||
keyEve->key() == Qt::Key_Enter) {
showCustomWidget();
}
}
}

return false;
return DFloatingButton::eventFilter(watch, event);
}

ControlWidget::ControlWidget(const SessionBaseModel *model, QWidget *parent)
Expand Down Expand Up @@ -228,6 +244,7 @@ void ControlWidget::addModule(module::BaseModuleInterface *module)
layout->setSpacing(0);
layout->setMargin(0);
layout->addWidget(trayWidget);
button->setPluginItem(trayWidget);
} else {
button->setIcon(QIcon(trayModule->icon()));
}
Expand Down
9 changes: 7 additions & 2 deletions src/widgets/controlwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ class FloatingButton : public DFloatingButton
return m_tipText;
}

Q_SIGNALS:
void setPluginItem(QWidget *item) { m_item = item; }
QWidget *pluginItem() const { return m_item; }

Q_SIGNALS:
void requestShowMenu();
void requestShowTips();
void requestHideTips();
Expand All @@ -85,7 +88,9 @@ class FloatingButton : public DFloatingButton
bool eventFilter(QObject *watch, QEvent *event) override;

private:
QString m_tipText;
void showCustomWidget() const;
QString m_tipText;
QWidget *m_item{nullptr};
};
class ControlWidget : public QWidget
{
Expand Down