Skip to content

Commit 4d5bce5

Browse files
committed
feat: add transient_seat_v1 implementation
Create separate seats for virtual-pointer and virtual-keyboard Log:
1 parent e344a1e commit 4d5bce5

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/seat/helper.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
#include <qwidleinhibitv1.h>
9191
#include <qwalphamodifierv1.h>
9292
#include <qwdrm.h>
93+
#include <qwtransientseatv1.h>
9394

9495
#include <QAction>
9596
#include <QKeySequence>
@@ -1098,6 +1099,20 @@ void Helper::init()
10981099
qw_data_control_manager_v1::create(*m_server->handle());
10991100
qw_ext_data_control_manager_v1::create(*m_server->handle(), EXT_DATA_CONTROL_MANAGER_V1_VERSION);
11001101
qw_alpha_modifier_v1::create(*m_server->handle());
1102+
connect(m_transientSeatManager, &qw_transient_seat_manager_v1::notify_create_seat, this, [this](wlr_transient_seat_v1 *transientSeat) {
1103+
qw_transient_seat_v1 *qwTransientSeat = qw_transient_seat_v1::from(transientSeat);
1104+
static uint64_t i = 0;
1105+
QString name = QStringLiteral("transient-%1").arg(m_transientSeatCounter++, 0, 10);
1106+
WSeat *seat = new WSeat(name);
1107+
if (seat && seat->nativeHandle()) {
1108+
connect(seat->handle(), &qw_seat::before_destroy, this, [this, seat]{
1109+
seat->safeDeleteLater();
1110+
});
1111+
qwTransientSeat->ready(seat->nativeHandle());
1112+
} else {
1113+
qwTransientSeat->deny();
1114+
}
1115+
});
11011116

11021117
m_dockPreview = engine->createDockPreview(m_renderWindow->contentItem());
11031118

src/seat/helper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class qw_idle_inhibit_manager_v1;
6363
class qw_output_configuration_v1;
6464
class qw_output_power_manager_v1;
6565
class qw_idle_inhibitor_v1;
66+
class qw_transient_seat_manager_v1;
6667
QW_END_NAMESPACE
6768

6869
WAYLIB_SERVER_USE_NAMESPACE
@@ -318,6 +319,7 @@ private Q_SLOTS:
318319
WBackend *m_backend = nullptr;
319320
qw_renderer *m_renderer = nullptr;
320321
qw_allocator *m_allocator = nullptr;
322+
qw_transient_seat_manager_v1 *m_transientSeatManager = nullptr;
321323

322324
// protocols
323325
qw_compositor *m_compositor = nullptr;
@@ -366,4 +368,5 @@ private Q_SLOTS:
366368
UserModel *m_userModel{ nullptr };
367369

368370
quint32 m_atomDeepinNoTitlebar;
371+
u_int64_t m_transientSeatCounter = 0;
369372
};

0 commit comments

Comments
 (0)