on xenial help sign in
focus
bcbc40dNick Dedekind
plugins/WindowManager/TopLevelWindowModel.cpp+20−4
@@ -258,7 +258,6 @@ void TopLevelWindowModel::connectWindow(Window *window)
258 // eg: Do focusedWindow=A to focusedWindow=B instead of
258 // eg: Do focusedWindow=A to focusedWindow=B instead of
259 // focusedWindow=A to focusedWindow=null to focusedWindow=B
259 // focusedWindow=A to focusedWindow=null to focusedWindow=B
260 if (focused) {
260 if (focused) {
261− Q_ASSERT(m_newlyFocusedWindow == nullptr);
262 m_focusedWindowChanged = true;
261 m_focusedWindowChanged = true;
263 m_newlyFocusedWindow = window;
262 m_newlyFocusedWindow = window;
264 } else if (m_focusedWindow == window) {
263 } else if (m_focusedWindow == window) {
@@ -502,6 +501,10 @@ void TopLevelWindowModel::removeAt(int index)
502 if (m_focusedWindow == window) {
501 if (m_focusedWindow == window) {
503 setFocusedWindow(nullptr);
502 setFocusedWindow(nullptr);
504 }
503 }
504+ if (m_newlyFocusedWindow == window) {
505+ m_focusedWindowChanged = false;
506+ m_newlyFocusedWindow = nullptr;
507+ }
505 delete window;
508 delete window;
506
509
507 INFO_MSG << " after " << toString();
510 INFO_MSG << " after " << toString();
@@ -792,9 +795,7 @@ void TopLevelWindowModel::activateTopMostWindowWithoutId(int forbiddenId)
792void TopLevelWindowModel::refreshWindows()
795void TopLevelWindowModel::refreshWindows()
793{
796{
794 DEBUG_MSG << "()";
797 DEBUG_MSG << "()";
795−
796− m_windowModel.clear();
797− m_allSurfaces.clear();
798+ clear();
798
799
799 if (!m_workspace || !m_applicationManager || !m_surfaceManager) return;
800 if (!m_workspace || !m_applicationManager || !m_surfaceManager) return;
800
801
@@ -827,3 +828,18 @@ void TopLevelWindowModel::refreshWindows()
827 }
828 }
828 });
829 });
829}
830}
831+
832+void TopLevelWindowModel::clear()
833+{
834+ DEBUG_MSG << "()";
835+
836+ while(m_windowModel.count() > 0) {
837+ ModelEntry entry = m_windowModel.takeAt(0);
838+ disconnect(entry.window, 0, this, 0);
839+ delete entry.window;
840+ }
841+ m_allSurfaces.clear();
842+ setFocusedWindow(nullptr);
843+ m_focusedWindowChanged = false;
844+ m_newlyFocusedWindow = nullptr;
845+}
plugins/WindowManager/TopLevelWindowModel.h+1
@@ -239,6 +239,7 @@ private:
239
239
240 void activateTopMostWindowWithoutId(int forbiddenId);
240 void activateTopMostWindowWithoutId(int forbiddenId);
241 void refreshWindows();
241 void refreshWindows();
242+ void clear();
242
243
243 Window *createWindow(unity::shell::application::MirSurfaceInterface *surface);
244 Window *createWindow(unity::shell::application::MirSurfaceInterface *surface);
244
245