re-enabled the nice feature that Alt-Tab and Ctrl-Tab won't do anything

if there are popup windows open (that is, if we cannot obtain a mouse pointer
grab). Avoids "hanging" Window or Desktop boxes.

This broke when the (otherwise very nice) transition to KGlobalAccel was
introduced.

svn path=/trunk/kdebase/kwin/; revision=89105
icc-effect-5.14.5
Matthias Ettrich 2001-03-28 12:44:31 +00:00
parent e2beba0abe
commit 9547820ecc
4 changed files with 67 additions and 64 deletions

View File

@ -1007,6 +1007,7 @@ bool Client::configureRequest( XConfigureRequestEvent& e )
if ( isShade() )
setShade( FALSE );
qDebug("configureRequest %s: %d %d %d %d", caption().latin1(), e.x, e.y, e.width, e.height );
/*
// compress configure requests
XEvent otherEvent;

View File

@ -215,14 +215,14 @@ int kdemain( int argc, char * argv[] )
break;
}
}
if (! restored) {
// we only do the multihead fork if we are not restored by the session
// manager, since the session manager will register multiple kwins,
// one for each screen...
QCString multiHead = getenv("KDE_MULTIHEAD");
if (multiHead.lower() == "true")
{
if (multiHead.lower() == "true") {
Display* dpy = XOpenDisplay( NULL );
if ( !dpy ) {
fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n",
@ -240,7 +240,7 @@ int kdemain( int argc, char * argv[] )
if ((pos = display_name.findRev('.')) != -1 )
display_name.remove(pos,10); // 10 is enough to be sure we removed ".s"
QCString envir;
QCString envir;
if (number_of_screens != 1) {
for (int i = 0; i < number_of_screens; i++ ) {
// if execution doesn't pass by here, then kwin
@ -256,7 +256,7 @@ int kdemain( int argc, char * argv[] )
// number. If it had it, it was removed at the "pos" check
envir.sprintf("DISPLAY=%s.%d", display_name.data(), kwin_screen_number);
if (putenv(strdup(envir.data()))) {
if (putenv( strdup(envir.data())) ) {
fprintf(stderr,
"%s: WARNING: unable to set DISPLAY environment variable\n",
argv[0]);

View File

@ -48,7 +48,7 @@ const int XIconicState = IconicState;
// Possible protoypes for select() were hidden as `kwin_hide_select.
// Undo the hiding definition and defines an acceptable prototype.
// This is how QT does this. It should work where QT works.
#ifdef HAVE_SYS_SELECT_H
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#undef select
@ -286,7 +286,7 @@ Workspace::Workspace( bool restore )
init();
if ( restore )
if ( restore )
restoreLegacySession(kapp->sessionConfig());
}
@ -684,8 +684,8 @@ void Workspace::freeKeyboard(bool pass){
/*!
Handles alt-tab / control-tab
*/
void Workspace::slotWalkThroughWindows()
{
if ( root != qt_xrootwin() )
@ -697,8 +697,8 @@ void Workspace::slotWalkThroughWindows()
CDEWalkThroughWindows( true );
else {
if(( keyToXMod( walkThroughWindowsKeycode ) & XMODMASK ) != 0 ) {
startKDEWalkThroughWindows();
KDEWalkThroughWindows( true );
if ( startKDEWalkThroughWindows() )
KDEWalkThroughWindows( true );
}
else
// if the shortcut has no modifiers, don't show the tabbox, but
@ -713,53 +713,53 @@ void Workspace::slotWalkThroughWindows()
}
void Workspace::slotWalkBackThroughWindows()
{
{
if ( root != qt_xrootwin() )
return;
return;
if( tab_grab || control_grab )
return;
if ( options->altTabStyle == Options::CDE || !options->focusPolicyIsReasonable() )
// CDE style raise / lower
CDEWalkThroughWindows( true );
else {
if(( keyToXMod( walkBackThroughWindowsKeycode ) & XMODMASK ) != 0 ) {
startKDEWalkThroughWindows();
KDEWalkThroughWindows( false );
}
else
KDEOneStepThroughWindows( false );
return;
if ( options->altTabStyle == Options::CDE || !options->focusPolicyIsReasonable() ) {
// CDE style raise / lower
CDEWalkThroughWindows( true );
} else {
if (( keyToXMod( walkBackThroughWindowsKeycode ) & XMODMASK ) != 0 ) {
if ( startKDEWalkThroughWindows() )
KDEWalkThroughWindows( false );
} else {
KDEOneStepThroughWindows( false );
}
}
}
void Workspace::slotWalkThroughDesktops()
{
{
if ( root != qt_xrootwin() )
return;
return;
if( tab_grab || control_grab )
return;
if(( keyToXMod( walkThroughDesktopsKeycode ) & XMODMASK ) != 0 ) {
startWalkThroughDesktops();
walkThroughDesktops( true );
return;
if (( keyToXMod( walkThroughDesktopsKeycode ) & XMODMASK ) != 0 ) {
if ( startWalkThroughDesktops() )
walkThroughDesktops( true );
} else {
oneStepThroughDesktops( true );
}
else
oneStepThroughDesktops( true );
}
void Workspace::slotWalkBackThroughDesktops()
{
{
if ( root != qt_xrootwin() )
return;
if( tab_grab || control_grab )
return;
if(( keyToXMod( walkBackThroughDesktopsKeycode ) & XMODMASK ) != 0 ) {
startWalkThroughDesktops();
walkThroughDesktops( false );
return;
if (( keyToXMod( walkBackThroughDesktopsKeycode ) & XMODMASK ) != 0 ) {
if ( startWalkThroughDesktops() )
walkThroughDesktops( false );
} else {
oneStepThroughDesktops( false );
}
else
oneStepThroughDesktops( false );
}
void Workspace::startKDEWalkThroughWindows()
bool Workspace::startKDEWalkThroughWindows()
{
if ( XGrabPointer( qt_xdisplay(), root, TRUE,
(uint)(ButtonPressMask | ButtonReleaseMask |
@ -768,7 +768,7 @@ void Workspace::startKDEWalkThroughWindows()
GrabModeSync, GrabModeAsync,
None, None, kwin_time ) != GrabSuccess ) {
freeKeyboard(FALSE);
return;
return FALSE;
}
XGrabKeyboard(qt_xdisplay(),
root, FALSE,
@ -778,9 +778,10 @@ void Workspace::startKDEWalkThroughWindows()
keys->setEnabled( FALSE );
tab_box->setMode( TabBox::WindowsMode );
tab_box->reset();
return TRUE;
}
void Workspace::startWalkThroughDesktops()
bool Workspace::startWalkThroughDesktops()
{
if ( XGrabPointer( qt_xdisplay(), root, TRUE,
(uint)(ButtonPressMask | ButtonReleaseMask |
@ -789,7 +790,7 @@ void Workspace::startWalkThroughDesktops()
GrabModeSync, GrabModeAsync,
None, None, kwin_time ) != GrabSuccess ) {
freeKeyboard(FALSE);
return;
return FALSE;
}
XGrabKeyboard(qt_xdisplay(),
root, FALSE,
@ -799,6 +800,7 @@ void Workspace::startWalkThroughDesktops()
keys->setEnabled( FALSE );
tab_box->setMode( TabBox::DesktopMode );
tab_box->reset();
return TRUE;
}
void Workspace::KDEWalkThroughWindows( bool forward )
@ -840,7 +842,7 @@ void Workspace::CDEWalkThroughWindows( bool forward )
}
freeKeyboard(FALSE);
}
void Workspace::KDEOneStepThroughWindows( bool forward )
{
tab_box->setMode( TabBox::WindowsMode );
@ -870,7 +872,7 @@ bool Workspace::keyPress(XKeyEvent key)
unsigned int kc = XKeycodeToKeysym(qt_xdisplay(), key.keycode, 0);
unsigned int km = key.state & XMODMASK;
if (!control_grab){
if( ( kc == keyToXSym( walkThroughWindowsKeycode )
&& km == keyToXMod( walkThroughWindowsKeycode ))
|| ( kc == keyToXSym( walkBackThroughWindowsKeycode )
@ -2274,7 +2276,7 @@ void Workspace::createKeybindings(){
keys->connectItem( "Walk back through desktops", this, SLOT( slotWalkBackThroughDesktops()));
keys->connectItem( "Walk through windows",this, SLOT( slotWalkThroughWindows()));
keys->connectItem( "Walk back through windows",this, SLOT( slotWalkBackThroughWindows()));
keys->connectItem( "Mouse emulation", this, SLOT( slotMouseEmulation() ) );
keys->connectItem( "Logout", this, SLOT( slotLogout() ) );
@ -2998,12 +3000,12 @@ void Workspace::slotResetAllClients()
}
/*
/*
* Legacy session management
*/
#ifndef NO_LEGACY_SESSION_MANAGEMENT
#define WM_SAVE_YOURSELF_TIMEOUT 4000
#define WM_SAVE_YOURSELF_TIMEOUT 4000
typedef QMap<WId,int> WindowMap;
#define HAS_ERROR 0
@ -3055,7 +3057,7 @@ void Workspace::storeLegacySession( KConfig* config )
Display *newdisplay = XOpenDisplay(DisplayString(qt_xdisplay()));
if (!newdisplay) return;
WId root = DefaultRootWindow(newdisplay);
XGrabKeyboard(newdisplay, root, False,
XGrabKeyboard(newdisplay, root, False,
GrabModeAsync, GrabModeAsync, CurrentTime);
XGrabPointer(newdisplay, root, False, Button1Mask|Button2Mask|Button3Mask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
@ -3185,7 +3187,7 @@ void Workspace::storeSession( KConfig* config )
// session managed applications (storeLegacySession) and the
// recollection of the window geometries (this function).
if ( wmCommand.isEmpty() )
#endif
#endif
continue;
count++;
QString n = QString::number(count);
@ -3318,7 +3320,7 @@ void Workspace::writeFakeSessionInfo()
This function is called when a new window is mapped and must be managed.
We try to find a matching entry in the session. We also try to find
a matching entry in the fakeSession to see if the user had seclected the
``store settings'' menu entry.
``store settings'' menu entry.
May return 0 if there's no session info for the client.
*/
@ -3332,39 +3334,39 @@ SessionInfo* Workspace::takeSessionInfo( Client* c )
QCString wmClientMachine = c->wmClientMachine();
QCString resourceName = c->resourceName();
QCString resourceClass = c->resourceClass();
// First search ``session''
if (! sessionId.isEmpty() ) {
// look for a real session managed client (algorithm suggested by ICCCM)
for (SessionInfo* info = session.first(); info && !realInfo; info = session.next() )
for (SessionInfo* info = session.first(); info && !realInfo; info = session.next() )
if ( info->sessionId == sessionId ) {
if ( ! windowRole.isEmpty() ) {
if ( info->windowRole == windowRole )
realInfo = session.take();
} else {
if ( info->windowRole.isEmpty() &&
info->resourceName == resourceName &&
if ( info->windowRole.isEmpty() &&
info->resourceName == resourceName &&
info->resourceClass == resourceClass )
realInfo = session.take();
}
}
} else {
// look for a sessioninfo with matching features.
for (SessionInfo* info = session.first(); info && !realInfo; info = session.next() )
if ( info->resourceName == resourceName &&
for (SessionInfo* info = session.first(); info && !realInfo; info = session.next() )
if ( info->resourceName == resourceName &&
info->resourceClass == resourceClass &&
info->wmClientMachine == wmClientMachine )
if ( wmCommand.isEmpty() || info->wmCommand == wmCommand )
realInfo = session.take();
}
// Now search ``fakeSession''
for (SessionInfo* info = fakeSession.first(); info && !fakeInfo; info = fakeSession.next() )
if ( info->resourceName == resourceName &&
if ( info->resourceName == resourceName &&
info->resourceClass == resourceClass &&
info->wmClientMachine == wmClientMachine )
info->wmClientMachine == wmClientMachine )
fakeInfo = fakeSession.take();
// Reconciliate
if (fakeInfo)
c->setStoreSettings( TRUE );

View File

@ -264,9 +264,9 @@ private:
void init();
void createKeybindings();
void freeKeyboard(bool pass);
void startKDEWalkThroughWindows();
void startWalkThroughDesktops();
bool startKDEWalkThroughWindows();
bool startWalkThroughDesktops();
void KDEWalkThroughWindows( bool forward );
void CDEWalkThroughWindows( bool forward );
void walkThroughDesktops( bool forward );