From 63c4bf15d5c31a7bda2c009318d9b7da97c4207c Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 21 Feb 2012 23:06:15 +0100 Subject: [PATCH] use workspace signals to track geometry changes connecting to a kwindowsystem signal that causes instantiation of kwindowsystemprivate breaks window focus. this match makes it use internal kwin signals to track the embedding window geometry REVIEW:104039 --- kcmkwin/kwintabbox/CMakeLists.txt | 4 +++- tabbox/declarative.cpp | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/kcmkwin/kwintabbox/CMakeLists.txt b/kcmkwin/kwintabbox/CMakeLists.txt index 54c162a51e..42c0a009d1 100644 --- a/kcmkwin/kwintabbox/CMakeLists.txt +++ b/kcmkwin/kwintabbox/CMakeLists.txt @@ -2,6 +2,8 @@ include_directories( ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox ) ########### next target ############### +ADD_DEFINITIONS(-DTABBOX_KCM) + set(kcm_kwintabbox_PART_SRCS main.cpp layoutconfig.cpp @@ -17,7 +19,7 @@ kde4_add_ui_files( kcm_kwintabbox_PART_SRCS main.ui ) kde4_add_plugin(kcm_kwintabbox ${kcm_kwintabbox_PART_SRCS}) -target_link_libraries(kcm_kwintabbox ${KDE4_KDEUI_LIBS} ${KDE4_KCMUTILS_LIBS} ${KDE4_PLASMA_LIBS} ${X11_LIBRARIES} kephal ${QT_QTDECLARATIVE_LIBRARY} kdeclarative ) +target_link_libraries(kcm_kwintabbox ${KDE4_KDEUI_LIBS} ${KDE4_KCMUTILS_LIBS} ${KDE4_PLASMA_LIBS} ${X11_LIBRARIES} kephal ${QT_QTDECLARATIVE_LIBRARY} kdeclarative) install(TARGETS kcm_kwintabbox DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/tabbox/declarative.cpp b/tabbox/declarative.cpp index 528319fa3b..5f5a59d050 100644 --- a/tabbox/declarative.cpp +++ b/tabbox/declarative.cpp @@ -43,6 +43,8 @@ along with this program. If not, see . // KWin #include "thumbnailitem.h" #include +#include "../client.h" +#include "../workspace.h" namespace KWin { @@ -152,9 +154,14 @@ DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBox void DeclarativeView::showEvent(QShowEvent *event) { +#ifndef TABBOX_KCM if (tabBox->embedded()) { - connect(KWindowSystem::self(), SIGNAL(windowChanged(WId,uint)), SLOT(slotWindowChanged(WId, uint))); + Client *c = Workspace::self()->findClient(WindowMatchPredicate(tabBox->embedded())); + if (c) { + connect(c, SIGNAL(geometryChanged()), this, SLOT(slotUpdateGeometry())); + } } +#endif updateQmlSource(); m_currentScreenGeometry = Kephal::ScreenUtils::screenGeometry(tabBox->activeScreen()); rootObject()->setProperty("screenWidth", m_currentScreenGeometry.width()); @@ -193,9 +200,14 @@ void DeclarativeView::resizeEvent(QResizeEvent *event) void DeclarativeView::hideEvent(QHideEvent *event) { QWidget::hideEvent(event); +#ifndef TABBOX_KCM if (tabBox->embedded()) { - disconnect(KWindowSystem::self(), SIGNAL(windowChanged(WId,uint)), this, SLOT(slotWindowChanged(WId,uint))); + Client *c = Workspace::self()->findClient(WindowMatchPredicate(tabBox->embedded())); + if (c) { + disconnect(c, SIGNAL(geometryChanged()), this, SLOT(slotUpdateGeometry())); + } } +#endif } bool DeclarativeView::x11Event(XEvent *e)