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
This commit is contained in:
Marco Martin 2012-02-21 23:06:15 +01:00
parent 949eeedbc5
commit 63c4bf15d5
2 changed files with 17 additions and 3 deletions

View file

@ -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} )

View file

@ -43,6 +43,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KWin
#include "thumbnailitem.h"
#include <kwindowsystem.h>
#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)