From 3deaa52496fab731caa36da4669b58d39cf383a6 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Thu, 1 Feb 2001 01:13:44 +0000 Subject: [PATCH] cooperate with qt-2.2.4 (the deadkey popup fix) and qt-copy. Don't update the frame decoration if it didn't change, I don't want flicker when changing the focus policy. svn path=/trunk/kdebase/kwin/; revision=80891 --- client.cpp | 8 +++++--- plugins.cpp | 9 ++++++--- plugins.h | 2 +- workspace.cpp | 20 +++++++++++++------- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/client.cpp b/client.cpp index aa577b6acc..e6ebc576b2 100644 --- a/client.cpp +++ b/client.cpp @@ -375,7 +375,7 @@ bool WindowWrapper::x11Event( XEvent * e) && ( options->focusPolicy != Options::ClickToFocus && options->clickRaise && !mod1 ) ) { ((Client*)parentWidget())->autoRaise(); - ungrabButton( winId(), None ); + ungrabButton( winId(), None ); } Options::MouseCommand com = Options::MouseNothing; @@ -869,6 +869,8 @@ bool Client::windowEvent( XEvent * e) break; // we neither if ( e->xfocus.detail != NotifyNonlinear ) return TRUE; // hack for motif apps like netscape + if ( QApplication::activePopupWidget() ) + break; setActive( FALSE ); break; case ReparentNotify: @@ -2301,7 +2303,6 @@ void Client::takeFocus( bool force ) setActive( TRUE ); // Qt may delay the mapping which may cause XSetInputFocus to fail, force show window QApplication::sendPostedEvents( windowWrapper(), QEvent::ShowWindowRequest ); - XSetInputFocus( qt_xdisplay(), win, RevertToPointerRoot, kwin_time ); } if ( Ptakefocus ) @@ -2385,7 +2386,8 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo case Options::MouseOperationsMenu: if ( isActive() & ( options->focusPolicy != Options::ClickToFocus && options->clickRaise ) ) autoRaise(); - workspace()->clientPopup( this )->popup( globalPos ); + workspace()->clientPopup( this )->exec( globalPos ); + workspace()->requestFocus( this ); break; case Options::MouseToggleRaiseAndLower: if ( workspace()->topClientOnDesktop() == this ) diff --git a/plugins.cpp b/plugins.cpp index 82038f9848..f2df852d11 100644 --- a/plugins.cpp +++ b/plugins.cpp @@ -97,7 +97,7 @@ void PluginMenu::slotActivated(int id) QString newPlugin; if (id > 0) newPlugin = fileList[id-1]; - + KConfig *config = KGlobal::config(); config->setGroup("Style"); config->writeEntry("PluginLib", newPlugin); @@ -121,14 +121,17 @@ PluginMgr::~PluginMgr() lt_dlclose(handle); } -void +bool PluginMgr::updatePlugin() { KConfig *config = KGlobal::config(); config->setGroup("Style"); QString newPlugin = config->readEntry("PluginLib", "default"); - if (newPlugin != pluginStr) + if (newPlugin != pluginStr) { loadPlugin(newPlugin); + return true; + } + return false; } Client* PluginMgr::allocateClient(Workspace *ws, WId w, bool tool) diff --git a/plugins.h b/plugins.h index 5a2053c75d..444e9af34d 100644 --- a/plugins.h +++ b/plugins.h @@ -24,7 +24,7 @@ public: ~PluginMgr(); Client *allocateClient(Workspace *ws, WId w, bool tool); void loadPlugin(QString name); - void updatePlugin(); + bool updatePlugin(); QString currentPlugin() { return pluginStr; } signals: void resetAllClients(); diff --git a/workspace.cpp b/workspace.cpp index 05646ab246..5ab3b0bc6c 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -223,7 +223,7 @@ Workspace::Workspace( bool restore ) if ( restore ) loadSessionInfo(); - + loadFakeSessionInfo(); (void) QApplication::desktop(); // trigger creation of desktop widget @@ -324,7 +324,7 @@ void Workspace::init() XWindowAttributes attr; connect(&resetTimer, SIGNAL(timeout()), this, - SLOT(slotResetAllClients())); + SLOT(slotResetAllClients())); connect(&mgr, SIGNAL(resetAllClients()), this, SLOT(slotResetAllClients())); @@ -1102,7 +1102,7 @@ bool Workspace::hasCaption( const QString& caption ) */ void Workspace::requestFocus( Client* c, bool force ) { - if (!focusChangeEnabled()) + if (!focusChangeEnabled() && ( c != active_client) ) return; //TODO will be different for non-root clients. (subclassing?) @@ -1228,8 +1228,11 @@ void Workspace::showWindowMenuAt( unsigned long id, int x, int y ) if (!target) return; + Client* c = active_client; QPopupMenu* p = clientPopup( target ); - p->popup( QPoint( x, y ) ); + p->exec( QPoint( x, y ) ); + if ( hasClient( c ) ) + requestFocus( c ); } void Workspace::performWindowOperation( Client* c, Options::WindowOperation op ) { @@ -1597,9 +1600,9 @@ void Workspace::unclutterDesktop() */ void Workspace::reconfigure() { - slotResetAllClientsDelayed(); KGlobal::config()->reparseConfiguration(); - mgr.updatePlugin(); + if ( mgr.updatePlugin() ) + slotResetAllClientsDelayed(); options->reload(); keys->readSettings(); grabControlTab(options->useControlTab); @@ -2456,7 +2459,10 @@ void Workspace::slotWindowOperations() return; QPopupMenu* p = clientPopup( active_client ); - p->popup( active_client->mapToGlobal( active_client->windowWrapper()->geometry().topLeft() ) ); + Client* c = active_client; + p->exec( active_client->mapToGlobal( active_client->windowWrapper()->geometry().topLeft() ) ); + if ( hasClient( c ) ) + requestFocus( c ); }