Changeset View
Changeset View
Standalone View
Standalone View
shell_client.cpp
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | |||||
83 | ShellClient::ShellClient(XdgShellSurfaceInterface *surface) | 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 | m_requestGeometryBlockCounter++; | ||||
91 | init(); | 92 | init(); | ||
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()); | ||
104 | m_requestGeometryBlockCounter++; | ||||
102 | init(); | 105 | init(); | ||
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 198 Lines • ▼ Show 20 Line(s) | 312 | auto configure = [this] { | |||
309 | if (m_closing) { | 313 | if (m_closing) { | ||
310 | return; | 314 | return; | ||
311 | } | 315 | } | ||
312 | if (m_requestGeometryBlockCounter != 0 || areGeometryUpdatesBlocked()) { | 316 | if (m_requestGeometryBlockCounter != 0 || areGeometryUpdatesBlocked()) { | ||
313 | return; | 317 | return; | ||
314 | } | 318 | } | ||
315 | m_xdgShellSurface->configure(xdgSurfaceStates(), m_requestedClientSize); | 319 | m_xdgShellSurface->configure(xdgSurfaceStates(), m_requestedClientSize); | ||
316 | }; | 320 | }; | ||
317 | configure(); | | |||
318 | connect(this, &AbstractClient::activeChanged, this, configure); | 321 | connect(this, &AbstractClient::activeChanged, this, configure); | ||
319 | connect(this, &AbstractClient::clientStartUserMovedResized, this, configure); | 322 | connect(this, &AbstractClient::clientStartUserMovedResized, this, configure); | ||
320 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, configure); | 323 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, configure); | ||
321 | } else if (m_xdgShellPopup) { | 324 | } else if (m_xdgShellPopup) { | ||
322 | connect(m_xdgShellPopup, &XdgShellPopupInterface::grabRequested, this, [this](SeatInterface *seat, quint32 serial) { | 325 | connect(m_xdgShellPopup, &XdgShellPopupInterface::grabRequested, this, [this](SeatInterface *seat, quint32 serial) { | ||
323 | Q_UNUSED(seat) | 326 | Q_UNUSED(seat) | ||
324 | Q_UNUSED(serial) | 327 | Q_UNUSED(serial) | ||
325 | //TODO - should check the parent had focus | 328 | //TODO - should check the parent had focus | ||
326 | m_hasPopupGrab = true; | 329 | m_hasPopupGrab = true; | ||
327 | }); | 330 | }); | ||
328 | 331 | | |||
329 | connect(m_xdgShellPopup, &XdgShellPopupInterface::configureAcknowledged, this, [this](int serial) { | 332 | connect(m_xdgShellPopup, &XdgShellPopupInterface::configureAcknowledged, this, [this](int serial) { | ||
330 | m_lastAckedConfigureRequest = serial; | 333 | m_lastAckedConfigureRequest = serial; | ||
331 | }); | 334 | }); | ||
332 | 335 | | |||
333 | QRect position = QRect(m_xdgShellPopup->transientOffset(), m_xdgShellPopup->initialSize()); | | |||
334 | m_xdgShellPopup->configure(position); | | |||
335 | | ||||
336 | connect(m_xdgShellPopup, &XdgShellPopupInterface::destroyed, this, &ShellClient::destroyClient); | 336 | connect(m_xdgShellPopup, &XdgShellPopupInterface::destroyed, this, &ShellClient::destroyClient); | ||
337 | } | 337 | } | ||
338 | 338 | | |||
339 | // set initial desktop | 339 | // set initial desktop | ||
340 | setDesktop(rules()->checkDesktop(m_internal ? int(NET::OnAllDesktops) : VirtualDesktopManager::self()->current(), true)); | 340 | setDesktop(rules()->checkDesktop(m_internal ? int(NET::OnAllDesktops) : VirtualDesktopManager::self()->current(), true)); | ||
341 | // TODO: merge in checks from Client::manage? | 341 | // TODO: merge in checks from Client::manage? | ||
342 | if (rules()->checkMinimize(false, true)) { | 342 | if (rules()->checkMinimize(false, true)) { | ||
343 | minimize(true); // No animation | 343 | minimize(true); // No animation | ||
Show All 21 Lines | |||||
365 | if (!m_internal) { | 365 | if (!m_internal) { | ||
366 | discardTemporaryRules(); | 366 | discardTemporaryRules(); | ||
367 | applyWindowRules(); // Just in case | 367 | applyWindowRules(); // Just in case | ||
368 | RuleBook::self()->discardUsed(this, false); // Remove ApplyNow rules | 368 | RuleBook::self()->discardUsed(this, false); // Remove ApplyNow rules | ||
369 | updateWindowRules(Rules::All); // Was blocked while !isManaged() | 369 | updateWindowRules(Rules::All); // Was blocked while !isManaged() | ||
370 | } | 370 | } | ||
371 | } | 371 | } | ||
372 | 372 | | |||
373 | void ShellClient::finishInit() { | ||||
374 | SurfaceInterface *s = surface(); | ||||
375 | disconnect(s, &SurfaceInterface::committed, this, &ShellClient::finishInit); | ||||
376 | | ||||
377 | if (m_xdgShellPopup) { | ||||
378 | QRect area = workspace()->clientArea(PlacementArea, Screens::self()->current(), desktop()); | ||||
379 | placeIn(area); | ||||
380 | } | ||||
381 | | ||||
382 | m_requestGeometryBlockCounter--; | ||||
383 | if (m_requestGeometryBlockCounter == 0) { | ||||
384 | requestGeometry(m_blockedRequestGeometry); | ||||
385 | } | ||||
386 | } | ||||
387 | | ||||
373 | void ShellClient::destroyClient() | 388 | void ShellClient::destroyClient() | ||
374 | { | 389 | { | ||
375 | m_closing = true; | 390 | m_closing = true; | ||
376 | Deleted *del = nullptr; | 391 | Deleted *del = nullptr; | ||
377 | if (workspace()) { | 392 | if (workspace()) { | ||
378 | del = Deleted::create(this); | 393 | del = Deleted::create(this); | ||
379 | } | 394 | } | ||
380 | emit windowClosed(this, del); | 395 | emit windowClosed(this, del); | ||
▲ Show 20 Lines • Show All 1480 Lines • Show Last 20 Lines |