Changeset View
Changeset View
Standalone View
Standalone View
shell_client.cpp
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 83 | ShellClient::ShellClient(XdgShellSurfaceInterface *surface) | |||
---|---|---|---|---|---|
84 | : AbstractClient() | 84 | : AbstractClient() | ||
85 | , m_shellSurface(nullptr) | 85 | , m_shellSurface(nullptr) | ||
86 | , m_xdgShellSurface(surface) | 86 | , m_xdgShellSurface(surface) | ||
87 | , m_xdgShellPopup(nullptr) | 87 | , m_xdgShellPopup(nullptr) | ||
88 | , m_internal(surface->client() == waylandServer()->internalConnection()) | 88 | , m_internal(surface->client() == waylandServer()->internalConnection()) | ||
89 | { | 89 | { | ||
90 | setSurface(surface->surface()); | 90 | setSurface(surface->surface()); | ||
91 | init(); | 91 | init(); | ||
92 | m_initialSetupBlocker.reset(new RequestGeometryBlocker(this)); | ||||
93 | connect(surface->surface(), &SurfaceInterface::committed, this, &ShellClient::finishInit); | ||||
92 | } | 94 | } | ||
93 | 95 | | |||
94 | ShellClient::ShellClient(XdgShellPopupInterface *surface) | 96 | ShellClient::ShellClient(XdgShellPopupInterface *surface) | ||
95 | : AbstractClient() | 97 | : AbstractClient() | ||
96 | , m_shellSurface(nullptr) | 98 | , m_shellSurface(nullptr) | ||
97 | , m_xdgShellSurface(nullptr) | 99 | , m_xdgShellSurface(nullptr) | ||
98 | , m_xdgShellPopup(surface) | 100 | , m_xdgShellPopup(surface) | ||
99 | , m_internal(surface->client() == waylandServer()->internalConnection()) | 101 | , m_internal(surface->client() == waylandServer()->internalConnection()) | ||
100 | { | 102 | { | ||
101 | setSurface(surface->surface()); | 103 | setSurface(surface->surface()); | ||
102 | init(); | 104 | init(); | ||
105 | m_initialSetupBlocker.reset(new RequestGeometryBlocker(this)); | ||||
106 | connect(surface->surface(), &SurfaceInterface::committed, this, &ShellClient::finishInit); | ||||
103 | } | 107 | } | ||
104 | 108 | | |||
105 | ShellClient::~ShellClient() = default; | 109 | ShellClient::~ShellClient() = default; | ||
106 | 110 | | |||
107 | template <class T> | 111 | template <class T> | ||
108 | void ShellClient::initSurface(T *shellSurface) | 112 | void ShellClient::initSurface(T *shellSurface) | ||
109 | { | 113 | { | ||
110 | m_caption = shellSurface->title().simplified(); | 114 | m_caption = shellSurface->title().simplified(); | ||
▲ Show 20 Lines • Show All 202 Lines • ▼ Show 20 Line(s) | 316 | auto configure = [this] { | |||
313 | if (m_closing) { | 317 | if (m_closing) { | ||
314 | return; | 318 | return; | ||
315 | } | 319 | } | ||
316 | if (m_requestGeometryBlockCounter != 0 || areGeometryUpdatesBlocked()) { | 320 | if (m_requestGeometryBlockCounter != 0 || areGeometryUpdatesBlocked()) { | ||
317 | return; | 321 | return; | ||
318 | } | 322 | } | ||
319 | m_xdgShellSurface->configure(xdgSurfaceStates(), m_requestedClientSize); | 323 | m_xdgShellSurface->configure(xdgSurfaceStates(), m_requestedClientSize); | ||
320 | }; | 324 | }; | ||
321 | configure(); | | |||
322 | connect(this, &AbstractClient::activeChanged, this, configure); | 325 | connect(this, &AbstractClient::activeChanged, this, configure); | ||
323 | connect(this, &AbstractClient::clientStartUserMovedResized, this, configure); | 326 | connect(this, &AbstractClient::clientStartUserMovedResized, this, configure); | ||
324 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, configure); | 327 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, configure); | ||
325 | } else if (m_xdgShellPopup) { | 328 | } else if (m_xdgShellPopup) { | ||
326 | connect(m_xdgShellPopup, &XdgShellPopupInterface::grabRequested, this, [this](SeatInterface *seat, quint32 serial) { | 329 | connect(m_xdgShellPopup, &XdgShellPopupInterface::grabRequested, this, [this](SeatInterface *seat, quint32 serial) { | ||
327 | Q_UNUSED(seat) | 330 | Q_UNUSED(seat) | ||
328 | Q_UNUSED(serial) | 331 | Q_UNUSED(serial) | ||
329 | //TODO - should check the parent had focus | 332 | //TODO - should check the parent had focus | ||
330 | m_hasPopupGrab = true; | 333 | m_hasPopupGrab = true; | ||
331 | }); | 334 | }); | ||
332 | 335 | | |||
333 | connect(m_xdgShellPopup, &XdgShellPopupInterface::configureAcknowledged, this, [this](int serial) { | 336 | connect(m_xdgShellPopup, &XdgShellPopupInterface::configureAcknowledged, this, [this](int serial) { | ||
334 | m_lastAckedConfigureRequest = serial; | 337 | m_lastAckedConfigureRequest = serial; | ||
335 | }); | 338 | }); | ||
336 | 339 | | |||
337 | QRect position = QRect(m_xdgShellPopup->transientOffset(), m_xdgShellPopup->initialSize()); | | |||
338 | m_xdgShellPopup->configure(position); | | |||
339 | | ||||
340 | connect(m_xdgShellPopup, &XdgShellPopupInterface::destroyed, this, &ShellClient::destroyClient); | 340 | connect(m_xdgShellPopup, &XdgShellPopupInterface::destroyed, this, &ShellClient::destroyClient); | ||
341 | } | 341 | } | ||
342 | 342 | | |||
343 | // set initial desktop | 343 | // set initial desktop | ||
344 | setDesktop(rules()->checkDesktop(m_internal ? int(NET::OnAllDesktops) : VirtualDesktopManager::self()->current(), true)); | 344 | setDesktop(rules()->checkDesktop(m_internal ? int(NET::OnAllDesktops) : VirtualDesktopManager::self()->current(), true)); | ||
345 | // TODO: merge in checks from Client::manage? | 345 | // TODO: merge in checks from Client::manage? | ||
346 | if (rules()->checkMinimize(false, true)) { | 346 | if (rules()->checkMinimize(false, true)) { | ||
347 | minimize(true); // No animation | 347 | minimize(true); // No animation | ||
Show All 21 Lines | |||||
369 | if (!m_internal) { | 369 | if (!m_internal) { | ||
370 | discardTemporaryRules(); | 370 | discardTemporaryRules(); | ||
371 | applyWindowRules(); // Just in case | 371 | applyWindowRules(); // Just in case | ||
372 | RuleBook::self()->discardUsed(this, false); // Remove ApplyNow rules | 372 | RuleBook::self()->discardUsed(this, false); // Remove ApplyNow rules | ||
373 | updateWindowRules(Rules::All); // Was blocked while !isManaged() | 373 | updateWindowRules(Rules::All); // Was blocked while !isManaged() | ||
374 | } | 374 | } | ||
375 | } | 375 | } | ||
376 | 376 | | |||
377 | void ShellClient::finishInit() { | ||||
378 | SurfaceInterface *s = surface(); | ||||
379 | disconnect(s, &SurfaceInterface::committed, this, &ShellClient::finishInit); | ||||
380 | | ||||
381 | if (m_xdgShellPopup) { | ||||
382 | QRect area = workspace()->clientArea(PlacementArea, Screens::self()->current(), desktop()); | ||||
383 | placeIn(area); | ||||
384 | } | ||||
385 | | ||||
386 | m_initialSetupBlocker.reset(); // triggering first configure event | ||||
387 | } | ||||
388 | | ||||
377 | void ShellClient::destroyClient() | 389 | void ShellClient::destroyClient() | ||
378 | { | 390 | { | ||
379 | m_closing = true; | 391 | m_closing = true; | ||
380 | Deleted *del = nullptr; | 392 | Deleted *del = nullptr; | ||
381 | if (workspace()) { | 393 | if (workspace()) { | ||
382 | del = Deleted::create(this); | 394 | del = Deleted::create(this); | ||
383 | } | 395 | } | ||
384 | emit windowClosed(this, del); | 396 | emit windowClosed(this, del); | ||
▲ Show 20 Lines • Show All 1596 Lines • Show Last 20 Lines |