kwin Library API Documentation

useractions.cpp

00001 /***************************************************************** 00002 KWin - the KDE window manager 00003 This file is part of the KDE project. 00004 00005 Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org> 00006 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> 00007 00008 You can Freely distribute this program under the GNU General Public 00009 License. See the file "COPYING" for the exact licensing terms. 00010 ******************************************************************/ 00011 00012 /* 00013 00014 This file contains things relevant to direct user actions, such as 00015 responses to global keyboard shortcuts, or selecting actions 00016 from the window operations menu. 00017 00018 */ 00019 00020 #include "client.h" 00021 #include "workspace.h" 00022 00023 #include <qpopupmenu.h> 00024 #include <kglobalsettings.h> 00025 #include <kiconloader.h> 00026 #include <klocale.h> 00027 #include <kconfig.h> 00028 #include <kglobalaccel.h> 00029 #include <kapplication.h> 00030 00031 #include "popupinfo.h" 00032 #include "killwindow.h" 00033 #include "tabbox.h" 00034 00035 namespace KWinInternal 00036 { 00037 00038 //**************************************** 00039 // Workspace 00040 //**************************************** 00041 00042 QPopupMenu* Workspace::clientPopup() 00043 { 00044 if ( !popup ) 00045 { 00046 popup = new QPopupMenu; 00047 popup->setCheckable( TRUE ); 00048 popup->setFont(KGlobalSettings::menuFont()); 00049 connect( popup, SIGNAL( aboutToShow() ), this, SLOT( clientPopupAboutToShow() ) ); 00050 connect( popup, SIGNAL( activated(int) ), this, SLOT( clientPopupActivated(int) ) ); 00051 00052 advanced_popup = new QPopupMenu( popup ); 00053 advanced_popup->setCheckable( TRUE ); 00054 advanced_popup->setFont(KGlobalSettings::menuFont()); 00055 connect( advanced_popup, SIGNAL( activated(int) ), this, SLOT( clientPopupActivated(int) ) ); 00056 advanced_popup->insertItem( SmallIconSet( "up" ), i18n("Keep &Above Others"), Options::KeepAboveOp ); 00057 advanced_popup->insertItem( SmallIconSet( "down" ), i18n("Keep &Below Others"), Options::KeepBelowOp ); 00058 advanced_popup->insertItem( SmallIconSet( "window_fullscreen" ), i18n("&Fullscreen"), Options::FullScreenOp ); 00059 advanced_popup->insertItem( i18n("&No Border"), Options::NoBorderOp ); 00060 advanced_popup->insertItem( SmallIconSet( "filesave" ), i18n("Sto&re Window Settings"), Options::ToggleStoreSettingsOp ); 00061 00062 popup->insertItem(i18n("Ad&vanced"), advanced_popup ); 00063 desk_popup_index = popup->count(); 00064 popup->insertItem( SmallIconSet( "move" ), i18n("&Move")+'\t'+keys->shortcut("Window Move").seq(0).toString(), Options::MoveOp ); 00065 popup->insertItem( i18n("Re&size")+'\t'+keys->shortcut("Window Resize").seq(0).toString(), Options::ResizeOp ); 00066 popup->insertItem( i18n("Mi&nimize")+'\t'+keys->shortcut("Window Minimize").seq(0).toString(), Options::MinimizeOp ); 00067 popup->insertItem( i18n("Ma&ximize")+'\t'+keys->shortcut("Window Maximize").seq(0).toString(), Options::MaximizeOp ); 00068 popup->insertItem( i18n("Sh&ade")+'\t'+keys->shortcut("Window Shade").seq(0).toString(), Options::ShadeOp ); 00069 00070 popup->insertSeparator(); 00071 00072 if (!KGlobal::config()->isImmutable() && 00073 !kapp->authorizeControlModules(Workspace::configModules(true)).isEmpty()) 00074 { 00075 popup->insertItem(SmallIconSet( "configure" ), i18n("Configur&e Window Behavior..."), this, SLOT( configureWM() )); 00076 popup->insertSeparator(); 00077 } 00078 00079 popup->insertItem( SmallIconSet( "fileclose" ), i18n("&Close")+'\t'+keys->shortcut("Window Close").seq(0).toString(), Options::CloseOp ); 00080 } 00081 return popup; 00082 } 00083 00089 void Workspace::clientPopupAboutToShow() 00090 { 00091 if ( !popup_client || !popup ) 00092 return; 00093 00094 if ( numberOfDesktops() == 1 ) 00095 { 00096 delete desk_popup; 00097 desk_popup = 0; 00098 } 00099 else 00100 { 00101 initDesktopPopup(); 00102 } 00103 00104 popup->setItemEnabled( Options::ResizeOp, popup_client->isResizable() ); 00105 popup->setItemEnabled( Options::MoveOp, popup_client->isMovable() ); 00106 popup->setItemEnabled( Options::MaximizeOp, popup_client->isMaximizable() ); 00107 popup->setItemChecked( Options::MaximizeOp, popup_client->maximizeMode() == Client::MaximizeFull ); 00108 // This should be checked also when hover unshaded 00109 popup->setItemChecked( Options::ShadeOp, popup_client->shadeMode() != Client::ShadeNone ); 00110 popup->setItemEnabled( Options::ShadeOp, popup_client->isShadeable()); 00111 advanced_popup->setItemChecked( Options::KeepAboveOp, popup_client->keepAbove() ); 00112 advanced_popup->setItemChecked( Options::KeepBelowOp, popup_client->keepBelow() ); 00113 advanced_popup->setItemChecked( Options::FullScreenOp, popup_client->isFullScreen() ); 00114 advanced_popup->setItemEnabled( Options::FullScreenOp, popup_client->userCanSetFullScreen() ); 00115 advanced_popup->setItemChecked( Options::NoBorderOp, popup_client->noBorder() ); 00116 advanced_popup->setItemEnabled( Options::NoBorderOp, popup_client->userCanSetNoBorder() ); 00117 popup->setItemEnabled( Options::MinimizeOp, popup_client->isMinimizable() ); 00118 advanced_popup->setItemChecked( Options::ToggleStoreSettingsOp, popup_client->storeSettings() ); 00119 popup->setItemEnabled( Options::CloseOp, popup_client->isCloseable() ); 00120 } 00121 00122 00123 void Workspace::initDesktopPopup() 00124 { 00125 if (desk_popup) 00126 return; 00127 00128 desk_popup = new QPopupMenu( popup ); 00129 desk_popup->setCheckable( TRUE ); 00130 desk_popup->setFont(KGlobalSettings::menuFont()); 00131 connect( desk_popup, SIGNAL( activated(int) ), 00132 this, SLOT( sendToDesktop(int) ) ); 00133 connect( desk_popup, SIGNAL( aboutToShow() ), 00134 this, SLOT( desktopPopupAboutToShow() ) ); 00135 00136 popup->insertItem(i18n("To &Desktop"), desk_popup, -1, desk_popup_index ); 00137 } 00138 00143 void Workspace::desktopPopupAboutToShow() 00144 { 00145 if ( !desk_popup ) 00146 return; 00147 00148 desk_popup->clear(); 00149 desk_popup->insertItem( i18n("&All Desktops"), 0 ); 00150 if ( active_client && active_client->isOnAllDesktops() ) 00151 desk_popup->setItemChecked( 0, TRUE ); 00152 desk_popup->insertSeparator( -1 ); 00153 int id; 00154 const int BASE = 10; 00155 for ( int i = 1; i <= numberOfDesktops(); i++ ) 00156 { 00157 QString basic_name("%1 %2"); 00158 if (i<BASE) 00159 { 00160 basic_name.prepend('&'); 00161 } 00162 id = desk_popup->insertItem( 00163 basic_name 00164 .arg(i) 00165 .arg( desktopName(i).replace( '&', "&&" )), 00166 i ); 00167 if ( active_client && 00168 !active_client->isOnAllDesktops() && active_client->desktop() == i ) 00169 desk_popup->setItemChecked( id, TRUE ); 00170 } 00171 } 00172 00173 00174 00178 void Workspace::initShortcuts() 00179 { 00180 keys = new KGlobalAccel( this ); 00181 #include "kwinbindings.cpp" 00182 readShortcuts(); 00183 } 00184 00185 void Workspace::readShortcuts() 00186 { 00187 keys->readSettings(); 00188 00189 cutWalkThroughDesktops = keys->shortcut("Walk Through Desktops"); 00190 cutWalkThroughDesktopsReverse = keys->shortcut("Walk Through Desktops (Reverse)"); 00191 cutWalkThroughDesktopList = keys->shortcut("Walk Through Desktop List"); 00192 cutWalkThroughDesktopListReverse = keys->shortcut("Walk Through Desktop List (Reverse)"); 00193 cutWalkThroughWindows = keys->shortcut("Walk Through Windows"); 00194 cutWalkThroughWindowsReverse = keys->shortcut("Walk Through Windows (Reverse)"); 00195 00196 keys->updateConnections(); 00197 } 00198 00199 00200 void Workspace::clientPopupActivated( int id ) 00201 { 00202 WindowOperation op = static_cast< WindowOperation >( id ); 00203 Client* c = popup_client ? popup_client : active_client; 00204 QString type; 00205 switch( op ) 00206 { 00207 case FullScreenOp: 00208 if( !c->isFullScreen() && c->userCanSetFullScreen()) 00209 type = "fullscreenaltf3"; 00210 break; 00211 case NoBorderOp: 00212 if( !c->noBorder() && c->userCanSetNoBorder()) 00213 type = "noborderaltf3"; 00214 break; 00215 default: 00216 break; 00217 }; 00218 if( !type.isEmpty()) 00219 helperDialog( type, c ); 00220 performWindowOperation( c, op ); 00221 } 00222 00223 00224 void Workspace::performWindowOperation( Client* c, Options::WindowOperation op ) 00225 { 00226 if ( !c ) 00227 return; 00228 00229 if (op == Options::MoveOp || op == Options::UnrestrictedMoveOp ) 00230 QCursor::setPos( c->geometry().center() ); 00231 if (op == Options::ResizeOp || op == Options::UnrestrictedResizeOp ) 00232 QCursor::setPos( c->geometry().bottomRight()); 00233 switch ( op ) 00234 { 00235 case Options::MoveOp: 00236 c->performMouseCommand( Options::MouseMove, QCursor::pos() ); 00237 break; 00238 case Options::UnrestrictedMoveOp: 00239 c->performMouseCommand( Options::MouseUnrestrictedMove, QCursor::pos() ); 00240 break; 00241 case Options::ResizeOp: 00242 c->performMouseCommand( Options::MouseResize, QCursor::pos() ); 00243 break; 00244 case Options::UnrestrictedResizeOp: 00245 c->performMouseCommand( Options::MouseUnrestrictedResize, QCursor::pos() ); 00246 break; 00247 case Options::CloseOp: 00248 c->closeWindow(); 00249 break; 00250 case Options::MaximizeOp: 00251 c->maximize( c->maximizeMode() == Client::MaximizeFull 00252 ? Client::MaximizeRestore : Client::MaximizeFull ); 00253 break; 00254 case Options::HMaximizeOp: 00255 c->maximize( c->maximizeMode() ^ Client::MaximizeHorizontal ); 00256 break; 00257 case Options::VMaximizeOp: 00258 c->maximize( c->maximizeMode() ^ Client::MaximizeVertical ); 00259 break; 00260 case Options::MinimizeOp: 00261 c->minimize(); 00262 break; 00263 case Options::ShadeOp: 00264 c->toggleShade(); 00265 break; 00266 case Options::OnAllDesktopsOp: 00267 c->setOnAllDesktops( !c->isOnAllDesktops() ); 00268 break; 00269 case Options::FullScreenOp: 00270 c->setFullScreen( !c->isFullScreen(), true ); 00271 break; 00272 case Options::NoBorderOp: 00273 c->setUserNoBorder( !c->isUserNoBorder()); 00274 break; 00275 case Options::KeepAboveOp: 00276 c->setKeepAbove( !c->keepAbove() ); 00277 break; 00278 case Options::KeepBelowOp: 00279 c->setKeepBelow( !c->keepBelow() ); 00280 break; 00281 case Options::ToggleStoreSettingsOp: 00282 c->setStoreSettings( !c->storeSettings() ); 00283 break; 00284 case Options::LowerOp: 00285 lowerClient(c); 00286 break; 00287 default: 00288 break; 00289 } 00290 } 00291 00295 bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPos) 00296 { 00297 bool replay = FALSE; 00298 switch (command) 00299 { 00300 case Options::MouseRaise: 00301 workspace()->raiseClient( this ); 00302 break; 00303 case Options::MouseLower: 00304 workspace()->lowerClient( this ); 00305 break; 00306 case Options::MouseShade : 00307 toggleShade(); 00308 break; 00309 case Options::MouseOperationsMenu: 00310 if ( isActive() & options->clickRaise ) 00311 autoRaise(); 00312 workspace()->showWindowMenu( globalPos, this ); 00313 break; 00314 case Options::MouseToggleRaiseAndLower: 00315 workspace()->raiseOrLowerClient( this ); 00316 break; 00317 case Options::MouseActivateAndRaise: 00318 replay = isActive(); // for clickraise mode 00319 workspace()->requestFocus( this ); 00320 workspace()->raiseClient( this ); 00321 break; 00322 case Options::MouseActivateAndLower: 00323 workspace()->requestFocus( this ); 00324 workspace()->lowerClient( this ); 00325 break; 00326 case Options::MouseActivate: 00327 replay = isActive(); // for clickraise mode 00328 workspace()->requestFocus( this ); 00329 break; 00330 case Options::MouseActivateRaiseAndPassClick: 00331 workspace()->requestFocus( this ); 00332 workspace()->raiseClient( this ); 00333 replay = TRUE; 00334 break; 00335 case Options::MouseActivateAndPassClick: 00336 workspace()->requestFocus( this ); 00337 replay = TRUE; 00338 break; 00339 case Options::MouseActivateRaiseAndMove: 00340 case Options::MouseActivateRaiseAndUnrestrictedMove: 00341 workspace()->raiseClient( this ); 00342 workspace()->requestFocus( this ); 00343 if( options->moveMode == Options::Transparent && isMovable()) 00344 move_faked_activity = workspace()->fakeRequestedActivity( this ); 00345 // fallthrough 00346 case Options::MouseMove: 00347 case Options::MouseUnrestrictedMove: 00348 { 00349 if (!isMovable()) 00350 break; 00351 if( moveResizeMode ) 00352 finishMoveResize( false ); 00353 mode = PositionCenter; 00354 buttonDown = TRUE; 00355 moveOffset = QPoint( globalPos.x() - x(), globalPos.y() - y()); // map from global 00356 invertedMoveOffset = rect().bottomRight() - moveOffset; 00357 unrestrictedMoveResize = ( command == Options::MouseActivateRaiseAndUnrestrictedMove 00358 || command == Options::MouseUnrestrictedMove ); 00359 setCursor( mode ); 00360 if( !startMoveResize()) 00361 { 00362 buttonDown = false; 00363 setCursor( mode ); 00364 } 00365 break; 00366 } 00367 case Options::MouseResize: 00368 case Options::MouseUnrestrictedResize: 00369 { 00370 if (!isResizable() || isShade()) // SHADE 00371 break; 00372 if( moveResizeMode ) 00373 finishMoveResize( false ); 00374 buttonDown = TRUE; 00375 moveOffset = QPoint( globalPos.x() - x(), globalPos.y() - y()); // map from global 00376 int x = moveOffset.x(), y = moveOffset.y(); 00377 bool left = x < width() / 3; 00378 bool right = x >= 2 * width() / 3; 00379 bool top = y < height() / 3; 00380 bool bot = y >= 2 * height() / 3; 00381 if (top) 00382 mode = left ? PositionTopLeft : (right ? PositionTopRight : PositionTop); 00383 else if (bot) 00384 mode = left ? PositionBottomLeft : (right ? PositionBottomRight : PositionBottom); 00385 else 00386 mode = (x < width() / 2) ? PositionLeft : PositionRight; 00387 invertedMoveOffset = rect().bottomRight() - moveOffset; 00388 unrestrictedMoveResize = ( command == Options::MouseUnrestrictedResize ); 00389 setCursor( mode ); 00390 if( !startMoveResize()) 00391 { 00392 buttonDown = false; 00393 setCursor( mode ); 00394 } 00395 break; 00396 } 00397 case Options::MouseMinimize: 00398 minimize(); 00399 break; 00400 case Options::MouseNothing: 00401 // fall through 00402 default: 00403 replay = TRUE; 00404 break; 00405 } 00406 return replay; 00407 } 00408 00409 // KDE4 remove me 00410 void Workspace::showWindowMenuAt( unsigned long, int, int ) 00411 { 00412 slotWindowOperations(); 00413 } 00414 00415 void Workspace::slotActivateAttentionWindow() 00416 { 00417 if( attention_chain.count() > 0 ) 00418 activateClient( attention_chain.first()); 00419 } 00420 00421 void Workspace::slotSwitchDesktopNext() 00422 { 00423 int d = currentDesktop() + 1; 00424 if ( d > numberOfDesktops() ) 00425 { 00426 if ( options->rollOverDesktops ) 00427 { 00428 d = 1; 00429 } 00430 else 00431 { 00432 return; 00433 } 00434 } 00435 setCurrentDesktop(d); 00436 popupinfo->showInfo( desktopName(currentDesktop()) ); 00437 } 00438 00439 void Workspace::slotSwitchDesktopPrevious() 00440 { 00441 int d = currentDesktop() - 1; 00442 if ( d <= 0 ) 00443 { 00444 if ( options->rollOverDesktops ) 00445 d = numberOfDesktops(); 00446 else 00447 return; 00448 } 00449 setCurrentDesktop(d); 00450 popupinfo->showInfo( desktopName(currentDesktop()) ); 00451 } 00452 00453 void Workspace::slotSwitchDesktopRight() 00454 { 00455 int x,y; 00456 calcDesktopLayout(x,y); 00457 int dt = currentDesktop()-1; 00458 if (layoutOrientation == Qt::Vertical) 00459 { 00460 dt += y; 00461 if ( dt >= numberOfDesktops() ) 00462 { 00463 if ( options->rollOverDesktops ) 00464 dt -= numberOfDesktops(); 00465 else 00466 return; 00467 } 00468 } 00469 else 00470 { 00471 int d = (dt % x) + 1; 00472 if ( d >= x ) 00473 { 00474 if ( options->rollOverDesktops ) 00475 d -= x; 00476 else 00477 return; 00478 } 00479 dt = dt - (dt % x) + d; 00480 } 00481 setCurrentDesktop(dt+1); 00482 popupinfo->showInfo( desktopName(currentDesktop()) ); 00483 } 00484 00485 void Workspace::slotSwitchDesktopLeft() 00486 { 00487 int x,y; 00488 calcDesktopLayout(x,y); 00489 int dt = currentDesktop()-1; 00490 if (layoutOrientation == Qt::Vertical) 00491 { 00492 dt -= y; 00493 if ( dt < 0 ) 00494 { 00495 if ( options->rollOverDesktops ) 00496 dt += numberOfDesktops(); 00497 else 00498 return; 00499 } 00500 } 00501 else 00502 { 00503 int d = (dt % x) - 1; 00504 if ( d < 0 ) 00505 { 00506 if ( options->rollOverDesktops ) 00507 d += x; 00508 else 00509 return; 00510 } 00511 dt = dt - (dt % x) + d; 00512 } 00513 setCurrentDesktop(dt+1); 00514 popupinfo->showInfo( desktopName(currentDesktop()) ); 00515 } 00516 00517 void Workspace::slotSwitchDesktopUp() 00518 { 00519 int x,y; 00520 calcDesktopLayout(x,y); 00521 int dt = currentDesktop()-1; 00522 if (layoutOrientation == Qt::Horizontal) 00523 { 00524 dt -= x; 00525 if ( dt < 0 ) 00526 { 00527 if ( options->rollOverDesktops ) 00528 dt += numberOfDesktops(); 00529 else 00530 return; 00531 } 00532 } 00533 else 00534 { 00535 int d = (dt % y) - 1; 00536 if ( d < 0 ) 00537 { 00538 if ( options->rollOverDesktops ) 00539 d += y; 00540 else 00541 return; 00542 } 00543 dt = dt - (dt % y) + d; 00544 } 00545 setCurrentDesktop(dt+1); 00546 popupinfo->showInfo( desktopName(currentDesktop()) ); 00547 } 00548 00549 void Workspace::slotSwitchDesktopDown() 00550 { 00551 int x,y; 00552 calcDesktopLayout(x,y); 00553 int dt = currentDesktop()-1; 00554 if (layoutOrientation == Qt::Horizontal) 00555 { 00556 dt += x; 00557 if ( dt >= numberOfDesktops() ) 00558 { 00559 if ( options->rollOverDesktops ) 00560 dt -= numberOfDesktops(); 00561 else 00562 return; 00563 } 00564 } 00565 else 00566 { 00567 int d = (dt % y) + 1; 00568 if ( d >= y ) 00569 { 00570 if ( options->rollOverDesktops ) 00571 d -= y; 00572 else 00573 return; 00574 } 00575 dt = dt - (dt % y) + d; 00576 } 00577 setCurrentDesktop(dt+1); 00578 popupinfo->showInfo( desktopName(currentDesktop()) ); 00579 } 00580 00581 void Workspace::slotSwitchToDesktop( int i ) 00582 { 00583 setCurrentDesktop( i ); 00584 popupinfo->showInfo( desktopName(currentDesktop()) ); 00585 } 00586 00587 00588 void Workspace::slotWindowToDesktop( int i ) 00589 { 00590 if( i >= 1 && i <= numberOfDesktops() && active_client 00591 && !active_client->isDesktop() 00592 && !active_client->isDock() 00593 && !active_client->isTopMenu()) 00594 sendClientToDesktop( active_client, i, true ); 00595 } 00596 00600 void Workspace::slotWindowMaximize() 00601 { 00602 if ( active_client ) 00603 performWindowOperation( active_client, Options::MaximizeOp ); 00604 } 00605 00609 void Workspace::slotWindowMaximizeVertical() 00610 { 00611 if ( active_client ) 00612 performWindowOperation( active_client, Options::VMaximizeOp ); 00613 } 00614 00618 void Workspace::slotWindowMaximizeHorizontal() 00619 { 00620 if ( active_client ) 00621 performWindowOperation( active_client, Options::HMaximizeOp ); 00622 } 00623 00624 00628 void Workspace::slotWindowMinimize() 00629 { 00630 performWindowOperation( active_client, Options::MinimizeOp ); 00631 } 00632 00636 void Workspace::slotWindowShade() 00637 { 00638 performWindowOperation( active_client, Options::ShadeOp ); 00639 } 00640 00644 void Workspace::slotWindowRaise() 00645 { 00646 if ( active_client ) 00647 raiseClient( active_client ); 00648 } 00649 00653 void Workspace::slotWindowLower() 00654 { 00655 if ( active_client ) 00656 lowerClient( active_client ); 00657 } 00658 00662 void Workspace::slotWindowRaiseOrLower() 00663 { 00664 if ( active_client ) 00665 raiseOrLowerClient( active_client ); 00666 } 00667 00668 void Workspace::slotWindowOnAllDesktops() 00669 { 00670 if( active_client ) 00671 active_client->toggleOnAllDesktops(); 00672 } 00673 00674 void Workspace::slotWindowFullScreen() 00675 { 00676 if( active_client ) 00677 performWindowOperation( active_client, Options::FullScreenOp ); 00678 } 00679 00680 void Workspace::slotWindowNoBorder() 00681 { 00682 if( active_client ) 00683 performWindowOperation( active_client, Options::NoBorderOp ); 00684 } 00685 00686 void Workspace::slotWindowAbove() 00687 { 00688 if( active_client ) 00689 performWindowOperation( active_client, Options::KeepAboveOp ); 00690 } 00691 00692 void Workspace::slotWindowBelow() 00693 { 00694 if( active_client ) 00695 performWindowOperation( active_client, Options::KeepBelowOp ); 00696 } 00697 00701 void Workspace::slotWindowToNextDesktop() 00702 { 00703 int d = currentDesktop() + 1; 00704 if ( d > numberOfDesktops() ) 00705 d = 1; 00706 if (active_client && !active_client->isDesktop() 00707 && !active_client->isDock() && !active_client->isTopMenu()) 00708 sendClientToDesktop(active_client,d,true); 00709 setCurrentDesktop(d); 00710 popupinfo->showInfo( desktopName(currentDesktop()) ); 00711 } 00712 00716 void Workspace::slotWindowToPreviousDesktop() 00717 { 00718 int d = currentDesktop() - 1; 00719 if ( d <= 0 ) 00720 d = numberOfDesktops(); 00721 if (active_client && !active_client->isDesktop() 00722 && !active_client->isDock() && !active_client->isTopMenu()) 00723 sendClientToDesktop(active_client,d,true); 00724 setCurrentDesktop(d); 00725 popupinfo->showInfo( desktopName(currentDesktop()) ); 00726 } 00727 00731 void Workspace::slotKillWindow() 00732 { 00733 KillWindow kill( this ); 00734 kill.start(); 00735 } 00736 00742 void Workspace::sendToDesktop( int desk ) 00743 { 00744 if ( !popup_client ) 00745 return; 00746 if ( desk == 0 ) 00747 { // the 'on_all_desktops' menu entry 00748 popup_client->setOnAllDesktops( !popup_client->isOnAllDesktops()); 00749 return; 00750 } 00751 00752 sendClientToDesktop( popup_client, desk, false ); 00753 00754 } 00755 00759 void Workspace::slotWindowOperations() 00760 { 00761 if ( !active_client ) 00762 return; 00763 QPoint pos = active_client->pos() + active_client->clientPos(); 00764 showWindowMenu( pos.x(), pos.y(), active_client ); 00765 } 00766 00767 void Workspace::showWindowMenu( int x, int y, Client* cl ) 00768 { 00769 if (!kapp->authorizeKAction("kwin_rmb")) 00770 return; 00771 if( !cl ) 00772 return; 00773 if( popup_client != NULL ) // recursion 00774 return; 00775 if ( cl->isDesktop() 00776 || cl->isDock() 00777 || cl->isTopMenu()) 00778 return; 00779 00780 popup_client = cl; 00781 QPopupMenu* p = clientPopup(); 00782 p->exec( QPoint( x, y ) ); 00783 popup_client = 0; 00784 } 00785 00789 void Workspace::slotWindowClose() 00790 { 00791 if ( tab_box->isVisible() || popupinfo->isVisible() ) 00792 return; 00793 performWindowOperation( active_client, Options::CloseOp ); 00794 } 00795 00799 void Workspace::slotWindowMove() 00800 { 00801 performWindowOperation( active_client, Options::UnrestrictedMoveOp ); 00802 } 00803 00807 void Workspace::slotWindowResize() 00808 { 00809 performWindowOperation( active_client, Options::UnrestrictedResizeOp ); 00810 } 00811 00812 } // namespace
KDE Logo
This file is part of the documentation for kwin Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Dec 16 19:08:42 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003