kwin Library API Documentation

windows.cpp

00001 /* 00002 * windows.cpp 00003 * 00004 * Copyright (c) 1997 Patrick Dowler dowler@morgul.fsh.uvic.ca 00005 * Copyright (c) 2001 Waldo Bastian bastian@kde.org 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 * 00021 * 00022 */ 00023 00024 #include <config.h> 00025 00026 #include <qlayout.h> 00027 #include <qslider.h> 00028 #include <qwhatsthis.h> 00029 #include <qvbuttongroup.h> 00030 #include <qcheckbox.h> 00031 #include <qradiobutton.h> 00032 #include <qlabel.h> 00033 #include <qcombobox.h> 00034 00035 #include <klocale.h> 00036 #include <kconfig.h> 00037 #include <knuminput.h> 00038 #include <kapplication.h> 00039 #include <kdialog.h> 00040 #include <dcopclient.h> 00041 #include <kglobal.h> 00042 00043 #include <X11/X.h> 00044 #include <X11/Xlib.h> 00045 #include <X11/Xutil.h> 00046 00047 #include "windows.h" 00048 00049 00050 // kwin config keywords 00051 #define KWIN_FOCUS "FocusPolicy" 00052 #define KWIN_PLACEMENT "Placement" 00053 #define KWIN_MOVE "MoveMode" 00054 #define KWIN_MINIMIZE_ANIM "AnimateMinimize" 00055 #define KWIN_MINIMIZE_ANIM_SPEED "AnimateMinimizeSpeed" 00056 #define KWIN_RESIZE_OPAQUE "ResizeMode" 00057 #define KWIN_GEOMETRY "GeometryTip" 00058 #define KWIN_AUTORAISE_INTERVAL "AutoRaiseInterval" 00059 #define KWIN_AUTORAISE "AutoRaise" 00060 #define KWIN_CLICKRAISE "ClickRaise" 00061 #define KWIN_ANIMSHADE "AnimateShade" 00062 #define KWIN_MOVE_RESIZE_MAXIMIZED "MoveResizeMaximizedWindows" 00063 #define KWIN_ALTTABMODE "AltTabStyle" 00064 #define KWIN_TRAVERSE_ALL "TraverseAll" 00065 #define KWIN_SHOW_POPUP "ShowPopup" 00066 #define KWIN_ROLL_OVER_DESKTOPS "RollOverDesktops" 00067 #define KWIN_SHADEHOVER "ShadeHover" 00068 #define KWIN_SHADEHOVER_INTERVAL "ShadeHoverInterval" 00069 #define KWIN_FOCUS_STEALING "FocusStealingPreventionLevel" 00070 00071 // kwm config keywords 00072 #define KWM_ELECTRIC_BORDER "ElectricBorders" 00073 #define KWM_ELECTRIC_BORDER_DELAY "ElectricBorderDelay" 00074 00075 //CT 15mar 98 - magics 00076 #define KWM_BRDR_SNAP_ZONE "BorderSnapZone" 00077 #define KWM_BRDR_SNAP_ZONE_DEFAULT 10 00078 #define KWM_WNDW_SNAP_ZONE "WindowSnapZone" 00079 #define KWM_WNDW_SNAP_ZONE_DEFAULT 10 00080 00081 #define MAX_BRDR_SNAP 100 00082 #define MAX_WNDW_SNAP 100 00083 #define MAX_EDGE_RES 1000 00084 00085 00086 KFocusConfig::~KFocusConfig () 00087 { 00088 if (standAlone) 00089 delete config; 00090 } 00091 00092 // removed the LCD display over the slider - this is not good GUI design :) RNolden 051701 00093 KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, QWidget * parent, const char *) 00094 : KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone) 00095 { 00096 QString wtstr; 00097 QBoxLayout *lay = new QVBoxLayout (this, 0, KDialog::spacingHint()); 00098 00099 //iTLabel = new QLabel(i18n(" Allowed overlap:\n" 00100 // "(% of desktop space)"), 00101 // plcBox); 00102 //iTLabel->setAlignment(AlignTop|AlignHCenter); 00103 //pLay->addWidget(iTLabel,1,1); 00104 00105 //interactiveTrigger = new QSpinBox(0, 500, 1, plcBox); 00106 //pLay->addWidget(interactiveTrigger,1,2); 00107 00108 //pLay->addRowSpacing(2,KDialog::spacingHint()); 00109 00110 //lay->addWidget(plcBox); 00111 00112 // focus policy 00113 fcsBox = new QButtonGroup(i18n("Focus"),this); 00114 fcsBox->setColumnLayout( 0, Qt::Horizontal ); 00115 00116 QBoxLayout *fLay = new QVBoxLayout(fcsBox->layout(), 00117 KDialog::spacingHint()); 00118 00119 QBoxLayout *cLay = new QHBoxLayout(fLay); 00120 QLabel *fLabel = new QLabel(i18n("&Policy:"), fcsBox); 00121 cLay->addWidget(fLabel, 0); 00122 focusCombo = new QComboBox(false, fcsBox); 00123 focusCombo->insertItem(i18n("Click to Focus"), CLICK_TO_FOCUS); 00124 focusCombo->insertItem(i18n("Focus Follows Mouse"), FOCUS_FOLLOWS_MOUSE); 00125 focusCombo->insertItem(i18n("Focus Under Mouse"), FOCUS_UNDER_MOUSE); 00126 focusCombo->insertItem(i18n("Focus Strictly Under Mouse"), FOCUS_STRICTLY_UNDER_MOUSE); 00127 cLay->addWidget(focusCombo,1 ,Qt::AlignLeft); 00128 fLabel->setBuddy(focusCombo); 00129 00130 // FIXME, when more policies have been added to KWin 00131 wtstr = i18n("The focus policy is used to determine the active window, i.e." 00132 " the window you can work in. <ul>" 00133 " <li><em>Click to focus:</em> A window becomes active when you click into it. This is the behavior" 00134 " you might know from other operating systems.</li>" 00135 " <li><em>Focus follows mouse:</em> Moving the mouse pointer actively on to a" 00136 " normal window activates it. Very practical if you are using the mouse a lot.</li>" 00137 " <li><em>Focus under mouse:</em> The window that happens to be under the" 00138 " mouse pointer becomes active. If the mouse points nowhere, the last window" 00139 " that was under the mouse has focus. </li>" 00140 " <li><em>Focus strictly under mouse:</em> This is even worse than" 00141 " 'Focus under mouse'. Only the window under the mouse pointer is" 00142 " active. If the mouse points nowhere, nothing has focus." 00143 " </ul>" 00144 " Note that 'Focus under mouse' and 'Focus strictly under mouse' are not" 00145 " particularly useful. They are only provided for old-fashioned" 00146 " die-hard UNIX people ;-)" 00147 ); 00148 QWhatsThis::add( focusCombo, wtstr); 00149 QWhatsThis::add(fLabel, wtstr); 00150 00151 connect(focusCombo, SIGNAL(activated(int)), this, SLOT(setAutoRaiseEnabled()) ); 00152 00153 // autoraise delay 00154 autoRaiseOn = new QCheckBox(i18n("Auto &raise"), fcsBox); 00155 fLay->addWidget(autoRaiseOn); 00156 connect(autoRaiseOn,SIGNAL(toggled(bool)), this, SLOT(autoRaiseOnTog(bool))); 00157 00158 autoRaise = new KIntNumInput(500, fcsBox); 00159 autoRaise->setLabel(i18n("Dela&y:"), Qt::AlignVCenter|Qt::AlignLeft); 00160 autoRaise->setRange(0, 3000, 100, true); 00161 autoRaise->setSteps(100,100); 00162 autoRaise->setSuffix(i18n(" msec")); 00163 fLay->addWidget(autoRaise); 00164 00165 clickRaiseOn = new QCheckBox(i18n("C&lick raise active window"), fcsBox); 00166 connect(clickRaiseOn,SIGNAL(toggled(bool)), this, SLOT(clickRaiseOnTog(bool))); 00167 fLay->addWidget(clickRaiseOn); 00168 00169 // fLay->addColSpacing(0,QMAX(autoRaiseOn->sizeHint().width(), 00170 // clickRaiseOn->sizeHint().width()) + 15); 00171 00172 QWhatsThis::add( autoRaiseOn, i18n("When this option is enabled, a window in the background will automatically" 00173 " come to the front when the mouse pointer has been over it for some time.") ); 00174 wtstr = i18n("This is the delay after which the window that the mouse pointer is over will automatically" 00175 " come to the front."); 00176 QWhatsThis::add( autoRaise, wtstr ); 00177 00178 QWhatsThis::add( clickRaiseOn, i18n("When this option is enabled, the active window will be brought to the" 00179 " front when you click somewhere into the window contents. To change" 00180 " it for inactive windows, you need to change the settings" 00181 " in the Actions tab.") ); 00182 00183 lay->addWidget(fcsBox); 00184 00185 kbdBox = new QButtonGroup(i18n("Navigation"), this); 00186 kbdBox->setColumnLayout( 0, Qt::Horizontal ); 00187 QGridLayout *kLay = new QGridLayout(kbdBox->layout(), 4, 4, 00188 KDialog::spacingHint()); 00189 QLabel *altTabLabel = new QLabel( i18n("Walk through windows mode:"), kbdBox); 00190 kLay->addWidget(altTabLabel, 1, 0); 00191 kdeMode = new QRadioButton(i18n("&KDE"), kbdBox); 00192 kLay->addWidget(kdeMode, 1, 1); 00193 cdeMode = new QRadioButton(i18n("CD&E"), kbdBox); 00194 kLay->addWidget(cdeMode, 1, 2); 00195 00196 wtstr = i18n("Hold down the Alt key and press the Tab key repeatedly to walk" 00197 " through the windows on the current desktop (the Alt+Tab" 00198 " combination can be reconfigured). The two different modes mean:<ul>" 00199 "<li><b>KDE</b>: a nice widget is shown, displaying the icons of all windows to" 00200 " walk through and the title of the currently selected one;" 00201 "<li><b>CDE</b>: the focus is passed to a new window each time Tab is pressed." 00202 " No fancy widget.</li></ul>"); 00203 QWhatsThis::add( altTabLabel, wtstr ); 00204 QWhatsThis::add( kdeMode, wtstr ); 00205 QWhatsThis::add( cdeMode, wtstr ); 00206 00207 traverseAll = new QCheckBox( i18n( "&Traverse windows on all desktops" ), kbdBox ); 00208 kLay->addMultiCellWidget( traverseAll, 2, 2, 0, 2 ); 00209 00210 wtstr = i18n( "Leave this option disabled if you want to limit walking through" 00211 " windows to the current desktop." ); 00212 QWhatsThis::add( traverseAll, wtstr ); 00213 00214 rollOverDesktops = new QCheckBox( i18n("Desktop navi&gation wraps around"), kbdBox ); 00215 kLay->addMultiCellWidget(rollOverDesktops, 3, 3, 0, 2); 00216 00217 wtstr = i18n( "Enable this option if you want keyboard or active desktop border navigation beyond" 00218 " the edge of a desktop to take you to the opposite edge of the new desktop." ); 00219 QWhatsThis::add( rollOverDesktops, wtstr ); 00220 00221 showPopupinfo = new QCheckBox( i18n("Popup desktop name on desktop &switch"), kbdBox ); 00222 kLay->addMultiCellWidget(showPopupinfo, 4, 4, 0, 2); 00223 00224 wtstr = i18n( "Enable this option if you wish to see the current desktop" 00225 " name popup whenever the current desktop is changed." ); 00226 QWhatsThis::add( showPopupinfo, wtstr ); 00227 00228 lay->addWidget(kbdBox); 00229 00230 lay->addStretch(); 00231 00232 // Any changes goes to slotChanged() 00233 connect(focusCombo, SIGNAL(activated(int)), SLOT(changed())); 00234 connect(fcsBox, SIGNAL(clicked(int)), SLOT(changed())); 00235 connect(autoRaise, SIGNAL(valueChanged(int)), SLOT(changed())); 00236 connect(kdeMode, SIGNAL(clicked()), SLOT(changed())); 00237 connect(cdeMode, SIGNAL(clicked()), SLOT(changed())); 00238 connect(traverseAll, SIGNAL(clicked()), SLOT(changed())); 00239 connect(rollOverDesktops, SIGNAL(clicked()), SLOT(changed())); 00240 connect(showPopupinfo, SIGNAL(clicked()), SLOT(changed())); 00241 00242 load(); 00243 } 00244 00245 00246 int KFocusConfig::getFocus() 00247 { 00248 return focusCombo->currentItem(); 00249 } 00250 00251 void KFocusConfig::setFocus(int foc) 00252 { 00253 focusCombo->setCurrentItem(foc); 00254 00255 // this will disable/hide the auto raise delay widget if focus==click 00256 setAutoRaiseEnabled(); 00257 } 00258 00259 void KFocusConfig::setAutoRaiseInterval(int tb) 00260 { 00261 autoRaise->setValue(tb); 00262 } 00263 00264 int KFocusConfig::getAutoRaiseInterval() 00265 { 00266 return autoRaise->value(); 00267 } 00268 00269 void KFocusConfig::setAutoRaise(bool on) 00270 { 00271 autoRaiseOn->setChecked(on); 00272 } 00273 00274 void KFocusConfig::setClickRaise(bool on) 00275 { 00276 clickRaiseOn->setChecked(on); 00277 } 00278 00279 void KFocusConfig::setAutoRaiseEnabled() 00280 { 00281 // the auto raise related widgets are: autoRaise 00282 if ( focusCombo->currentItem() != CLICK_TO_FOCUS ) 00283 { 00284 autoRaiseOn->setEnabled(true); 00285 autoRaiseOnTog(autoRaiseOn->isChecked()); 00286 } 00287 else 00288 { 00289 autoRaiseOn->setEnabled(false); 00290 autoRaiseOnTog(false); 00291 } 00292 } 00293 00294 00295 void KFocusConfig::autoRaiseOnTog(bool a) { 00296 autoRaise->setEnabled(a); 00297 clickRaiseOn->setEnabled( !a ); 00298 } 00299 00300 void KFocusConfig::clickRaiseOnTog(bool ) { 00301 } 00302 00303 void KFocusConfig::setAltTabMode(bool a) { 00304 kdeMode->setChecked(a); 00305 cdeMode->setChecked(!a); 00306 } 00307 00308 void KFocusConfig::setTraverseAll(bool a) { 00309 traverseAll->setChecked(a); 00310 } 00311 00312 void KFocusConfig::setRollOverDesktops(bool a) { 00313 rollOverDesktops->setChecked(a); 00314 } 00315 00316 void KFocusConfig::setShowPopupinfo(bool a) { 00317 showPopupinfo->setChecked(a); 00318 } 00319 00320 void KFocusConfig::load( void ) 00321 { 00322 QString key; 00323 00324 config->setGroup( "Windows" ); 00325 00326 key = config->readEntry(KWIN_FOCUS); 00327 if( key == "ClickToFocus") 00328 setFocus(CLICK_TO_FOCUS); 00329 else if( key == "FocusFollowsMouse") 00330 setFocus(FOCUS_FOLLOWS_MOUSE); 00331 else if(key == "FocusUnderMouse") 00332 setFocus(FOCUS_UNDER_MOUSE); 00333 else if(key == "FocusStrictlyUnderMouse") 00334 setFocus(FOCUS_STRICTLY_UNDER_MOUSE); 00335 00336 int k = config->readNumEntry(KWIN_AUTORAISE_INTERVAL,750); 00337 setAutoRaiseInterval(k); 00338 00339 key = config->readEntry(KWIN_AUTORAISE); 00340 setAutoRaise(key == "on"); 00341 key = config->readEntry(KWIN_CLICKRAISE); 00342 setClickRaise(key != "off"); 00343 setAutoRaiseEnabled(); // this will disable/hide the auto raise delay widget if focus==click 00344 00345 key = config->readEntry(KWIN_ALTTABMODE, "KDE"); 00346 setAltTabMode(key == "KDE"); 00347 00348 setRollOverDesktops( config->readBoolEntry(KWIN_ROLL_OVER_DESKTOPS, true )); 00349 00350 config->setGroup( "PopupInfo" ); 00351 setShowPopupinfo( config->readBoolEntry(KWIN_SHOW_POPUP, false )); 00352 00353 config->setGroup( "TabBox" ); 00354 setTraverseAll( config->readBoolEntry(KWIN_TRAVERSE_ALL, false )); 00355 00356 config->setGroup("Desktops"); 00357 emit KCModule::changed(false); 00358 } 00359 00360 void KFocusConfig::save( void ) 00361 { 00362 int v; 00363 00364 config->setGroup( "Windows" ); 00365 00366 v = getFocus(); 00367 if (v == CLICK_TO_FOCUS) 00368 config->writeEntry(KWIN_FOCUS,"ClickToFocus"); 00369 else if (v == FOCUS_UNDER_MOUSE) 00370 config->writeEntry(KWIN_FOCUS,"FocusUnderMouse"); 00371 else if (v == FOCUS_STRICTLY_UNDER_MOUSE) 00372 config->writeEntry(KWIN_FOCUS,"FocusStrictlyUnderMouse"); 00373 else 00374 config->writeEntry(KWIN_FOCUS,"FocusFollowsMouse"); 00375 00376 v = getAutoRaiseInterval(); 00377 if (v <0) v = 0; 00378 config->writeEntry(KWIN_AUTORAISE_INTERVAL,v); 00379 00380 if (autoRaiseOn->isChecked()) 00381 config->writeEntry(KWIN_AUTORAISE, "on"); 00382 else 00383 config->writeEntry(KWIN_AUTORAISE, "off"); 00384 00385 if (clickRaiseOn->isChecked()) 00386 config->writeEntry(KWIN_CLICKRAISE, "on"); 00387 else 00388 config->writeEntry(KWIN_CLICKRAISE, "off"); 00389 00390 if (kdeMode->isChecked()) 00391 config->writeEntry(KWIN_ALTTABMODE, "KDE"); 00392 else 00393 config->writeEntry(KWIN_ALTTABMODE, "CDE"); 00394 00395 config->writeEntry( KWIN_ROLL_OVER_DESKTOPS, rollOverDesktops->isChecked()); 00396 00397 config->setGroup( "PopupInfo" ); 00398 config->writeEntry( KWIN_SHOW_POPUP, showPopupinfo->isChecked()); 00399 00400 config->setGroup( "TabBox" ); 00401 config->writeEntry( KWIN_TRAVERSE_ALL , traverseAll->isChecked()); 00402 00403 config->setGroup("Desktops"); 00404 00405 if (standAlone) 00406 { 00407 config->sync(); 00408 if ( !kapp->dcopClient()->isAttached() ) 00409 kapp->dcopClient()->attach(); 00410 kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); 00411 } 00412 emit KCModule::changed(false); 00413 } 00414 00415 void KFocusConfig::defaults() 00416 { 00417 setAutoRaiseInterval(0); 00418 setFocus(CLICK_TO_FOCUS); 00419 setAutoRaise(false); 00420 setClickRaise(true); 00421 setAltTabMode(true); 00422 setTraverseAll( false ); 00423 setRollOverDesktops(true); 00424 setShowPopupinfo(false); 00425 emit KCModule::changed(true); 00426 } 00427 00428 KAdvancedConfig::~KAdvancedConfig () 00429 { 00430 if (standAlone) 00431 delete config; 00432 } 00433 00434 KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, QWidget *parent, const char *) 00435 : KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone) 00436 { 00437 QString wtstr; 00438 QBoxLayout *lay = new QVBoxLayout (this, 0, KDialog::spacingHint()); 00439 00440 //iTLabel = new QLabel(i18n(" Allowed overlap:\n" 00441 // "(% of desktop space)"), 00442 // plcBox); 00443 //iTLabel->setAlignment(AlignTop|AlignHCenter); 00444 //pLay->addWidget(iTLabel,1,1); 00445 00446 //interactiveTrigger = new QSpinBox(0, 500, 1, plcBox); 00447 //pLay->addWidget(interactiveTrigger,1,2); 00448 00449 //pLay->addRowSpacing(2,KDialog::spacingHint()); 00450 00451 //lay->addWidget(plcBox); 00452 00453 shBox = new QVButtonGroup(i18n("Shading"), this); 00454 00455 animateShade = new QCheckBox(i18n("Anima&te"), shBox); 00456 QWhatsThis::add(animateShade, i18n("Animate the action of reducing the window to its titlebar (shading)" 00457 " as well as the expansion of a shaded window") ); 00458 00459 shadeHoverOn = new QCheckBox(i18n("&Enable hover"), shBox); 00460 00461 connect(shadeHoverOn, SIGNAL(toggled(bool)), this, SLOT(shadeHoverChanged(bool))); 00462 00463 shadeHover = new KIntNumInput(500, shBox); 00464 shadeHover->setLabel(i18n("Dela&y:"), Qt::AlignVCenter|Qt::AlignLeft); 00465 shadeHover->setRange(0, 3000, 100, true); 00466 shadeHover->setSteps(100, 100); 00467 shadeHover->setSuffix(i18n(" msec")); 00468 00469 QWhatsThis::add(shadeHoverOn, i18n("If Shade Hover is enabled, a shaded window will un-shade automatically " 00470 "when the mouse pointer has been over the title bar for some time.")); 00471 00472 wtstr = i18n("Sets the time in milliseconds before the window unshades " 00473 "when the mouse pointer goes over the shaded window."); 00474 QWhatsThis::add(shadeHover, wtstr); 00475 00476 lay->addWidget(shBox); 00477 00478 // Any changes goes to slotChanged() 00479 connect(animateShade, SIGNAL(toggled(bool)), SLOT(changed())); 00480 connect(shadeHoverOn, SIGNAL(toggled(bool)), SLOT(changed())); 00481 connect(shadeHover, SIGNAL(valueChanged(int)), SLOT(changed())); 00482 00483 electricBox = new QVButtonGroup(i18n("Active Desktop Borders"), this); 00484 electricBox->setMargin(15); 00485 00486 QWhatsThis::add( electricBox, i18n("If this option is enabled, moving the mouse to a screen border" 00487 " will change your desktop. This is e.g. useful if you want to drag windows from one desktop" 00488 " to the other.") ); 00489 active_disable = new QRadioButton(i18n("D&isabled"), electricBox); 00490 active_move = new QRadioButton(i18n("Only &when moving windows"), electricBox); 00491 active_always = new QRadioButton(i18n("A&lways enabled"), electricBox); 00492 00493 delays = new KIntNumInput(10, electricBox); 00494 delays->setRange(0, MAX_EDGE_RES, 50, true); 00495 delays->setSuffix(i18n(" msec")); 00496 delays->setLabel(i18n("Desktop &switch delay:")); 00497 QWhatsThis::add( delays, i18n("Here you can set a delay for switching desktops using the active" 00498 " borders feature. Desktops will be switched after the mouse has been pushed against a screen border" 00499 " for the specified number of milliseconds.") ); 00500 00501 connect( electricBox, SIGNAL(clicked(int)), this, SLOT(setEBorders())); 00502 00503 // Any changes goes to slotChanged() 00504 connect(electricBox, SIGNAL(clicked(int)), SLOT(changed())); 00505 connect(delays, SIGNAL(valueChanged(int)), SLOT(changed())); 00506 00507 lay->addWidget(electricBox); 00508 00509 QHBoxLayout* focusStealingLayout = new QHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint()); 00510 QLabel* focusStealingLabel = new QLabel( i18n( "Focus stealing prevention level:" ), this ); 00511 focusStealing = new QComboBox( this ); 00512 focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "None" )); 00513 focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "Low" )); 00514 focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "Normal" )); 00515 focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "High" )); 00516 focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "Extreme" )); 00517 focusStealingLabel->setBuddy( focusStealing ); 00518 focusStealingLayout->addWidget( focusStealingLabel ); 00519 focusStealingLayout->addWidget( focusStealing, AlignLeft ); 00520 wtstr = i18n( "This option specifies how much KWin will try to prevent unwanted focus stealing " 00521 "caused by unexpected activation of new windows.<ul>" 00522 "<li><em>None:</em> The standard old behavior - prevention is turned off " 00523 "and new windows always become activated.</li>" 00524 "<li><em>Low:</em> Prevention is enabled; when some window doesn't have support " 00525 "for the underlying mechanism and KWin cannot reliably decide whether to " 00526 "activate the window or not, it will be activated. This setting may have both " 00527 "worse and better results than normal level, depending on the applications.</li>" 00528 "<li><em>Normal:</em> Prevention is enabled; the default setting.</li>" 00529 "<li><em>High:</em> New windows get activated only if no window is currently active " 00530 "or if they belong to the currently active application. This setting is probably " 00531 "not really usable when not using mouse focus policy.</li>" 00532 "<li><em>Extreme:</em> All windows must be explicitly activated by the user.</li>" 00533 "</ul>" ); 00534 QWhatsThis::add( focusStealing, wtstr ); 00535 QWhatsThis::add( focusStealingLabel, wtstr ); 00536 00537 connect(focusStealing, SIGNAL(activated(int)), SLOT(changed())); 00538 00539 lay->addLayout( focusStealingLayout ); 00540 00541 lay->addStretch(); 00542 load(); 00543 00544 } 00545 00546 void KAdvancedConfig::setShadeHover(bool on) { 00547 shadeHoverOn->setChecked(on); 00548 shadeHover->setEnabled(on); 00549 } 00550 00551 void KAdvancedConfig::setShadeHoverInterval(int k) { 00552 shadeHover->setValue(k); 00553 } 00554 00555 int KAdvancedConfig::getShadeHoverInterval() { 00556 00557 return shadeHover->value(); 00558 } 00559 00560 void KAdvancedConfig::shadeHoverChanged(bool a) { 00561 shadeHover->setEnabled(a); 00562 } 00563 00564 void KAdvancedConfig::setAnimateShade(bool a) { 00565 animateShade->setChecked(a); 00566 } 00567 00568 void KAdvancedConfig::setFocusStealing(int l) { 00569 l = KMAX( 0, KMIN( 4, l )); 00570 focusStealing->setCurrentItem(l); 00571 } 00572 00573 void KAdvancedConfig::load( void ) 00574 { 00575 config->setGroup( "Windows" ); 00576 00577 setAnimateShade(config->readBoolEntry(KWIN_ANIMSHADE, true)); 00578 setShadeHover(config->readBoolEntry(KWIN_SHADEHOVER, false)); 00579 setShadeHoverInterval(config->readNumEntry(KWIN_SHADEHOVER_INTERVAL, 250)); 00580 00581 setElectricBorders(config->readNumEntry(KWM_ELECTRIC_BORDER, false)); 00582 setElectricBorderDelay(config->readNumEntry(KWM_ELECTRIC_BORDER_DELAY, 150)); 00583 00584 // setFocusStealing( config->readNumEntry(KWIN_FOCUS_STEALING, 2 )); 00585 // TODO default to low for now 00586 setFocusStealing( config->readNumEntry(KWIN_FOCUS_STEALING, 1 )); 00587 00588 emit KCModule::changed(false); 00589 } 00590 00591 void KAdvancedConfig::save( void ) 00592 { 00593 int v; 00594 00595 config->setGroup( "Windows" ); 00596 config->writeEntry(KWIN_ANIMSHADE, animateShade->isChecked()); 00597 if (shadeHoverOn->isChecked()) 00598 config->writeEntry(KWIN_SHADEHOVER, "on"); 00599 else 00600 config->writeEntry(KWIN_SHADEHOVER, "off"); 00601 00602 v = getShadeHoverInterval(); 00603 if (v<0) v = 0; 00604 config->writeEntry(KWIN_SHADEHOVER_INTERVAL, v); 00605 00606 config->writeEntry(KWM_ELECTRIC_BORDER, getElectricBorders()); 00607 config->writeEntry(KWM_ELECTRIC_BORDER_DELAY,getElectricBorderDelay()); 00608 00609 config->writeEntry(KWIN_FOCUS_STEALING, focusStealing->currentItem()); 00610 00611 if (standAlone) 00612 { 00613 config->sync(); 00614 if ( !kapp->dcopClient()->isAttached() ) 00615 kapp->dcopClient()->attach(); 00616 kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); 00617 } 00618 emit KCModule::changed(false); 00619 } 00620 00621 void KAdvancedConfig::defaults() 00622 { 00623 setAnimateShade(true); 00624 setShadeHover(false); 00625 setShadeHoverInterval(250); 00626 setElectricBorders(0); 00627 setElectricBorderDelay(150); 00628 // setFocusStealing(2); 00629 // TODO default to low for now 00630 setFocusStealing(1); 00631 emit KCModule::changed(true); 00632 } 00633 00634 void KAdvancedConfig::setEBorders() 00635 { 00636 delays->setEnabled(!active_disable->isChecked()); 00637 } 00638 00639 int KAdvancedConfig::getElectricBorders() 00640 { 00641 if (active_move->isChecked()) 00642 return 1; 00643 if (active_always->isChecked()) 00644 return 2; 00645 return 0; 00646 } 00647 00648 int KAdvancedConfig::getElectricBorderDelay() 00649 { 00650 return delays->value(); 00651 } 00652 00653 void KAdvancedConfig::setElectricBorders(int i){ 00654 switch(i) 00655 { 00656 case 1: active_move->setChecked(true); break; 00657 case 2: active_always->setChecked(true); break; 00658 default: active_disable->setChecked(true); break; 00659 } 00660 setEBorders(); 00661 } 00662 00663 void KAdvancedConfig::setElectricBorderDelay(int delay) 00664 { 00665 delays->setValue(delay); 00666 } 00667 00668 00669 KMovingConfig::~KMovingConfig () 00670 { 00671 if (standAlone) 00672 delete config; 00673 } 00674 00675 KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *parent, const char *) 00676 : KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone) 00677 { 00678 QString wtstr; 00679 QBoxLayout *lay = new QVBoxLayout (this, 0, KDialog::spacingHint()); 00680 00681 windowsBox = new QButtonGroup(i18n("Windows"), this); 00682 windowsBox->setColumnLayout( 0, Qt::Horizontal ); 00683 00684 QBoxLayout *wLay = new QVBoxLayout (windowsBox->layout(), KDialog::spacingHint()); 00685 00686 QBoxLayout *bLay = new QVBoxLayout; 00687 wLay->addLayout(bLay); 00688 00689 opaque = new QCheckBox(i18n("Di&splay content in moving windows"), windowsBox); 00690 bLay->addWidget(opaque); 00691 QWhatsThis::add( opaque, i18n("Enable this option if you want a window's content to be fully shown" 00692 " while moving it, instead of just showing a window 'skeleton'. The result may not be satisfying" 00693 " on slow machines without graphic acceleration.") ); 00694 00695 resizeOpaqueOn = new QCheckBox(i18n("Display content in &resizing windows"), windowsBox); 00696 bLay->addWidget(resizeOpaqueOn); 00697 QWhatsThis::add( resizeOpaqueOn, i18n("Enable this option if you want a window's content to be shown" 00698 " while resizing it, instead of just showing a window 'skeleton'. The result may not be satisfying" 00699 " on slow machines.") ); 00700 00701 geometryTipOn = new QCheckBox(i18n("Display window &geometry when moving or resizing"), windowsBox); 00702 bLay->addWidget(geometryTipOn); 00703 QWhatsThis::add(geometryTipOn, i18n("Enable this option if you want a window's geometry to be displayed" 00704 " while it is being moved or resized. The window position relative" 00705 " to the top-left corner of the screen is displayed together with" 00706 " its size.")); 00707 00708 QGridLayout *rLay = new QGridLayout(2,3); 00709 bLay->addLayout(rLay); 00710 rLay->setColStretch(0,0); 00711 rLay->setColStretch(1,1); 00712 00713 minimizeAnimOn = new QCheckBox(i18n("Animate minimi&ze and restore"), 00714 windowsBox); 00715 QWhatsThis::add( minimizeAnimOn, i18n("Enable this option if you want an animation shown when" 00716 " windows are minimized or restored." ) ); 00717 rLay->addWidget(minimizeAnimOn,0,0); 00718 00719 minimizeAnimSlider = new QSlider(0,10,10,0,QSlider::Horizontal, windowsBox); 00720 minimizeAnimSlider->setSteps(1, 1); 00721 // QSlider::Below clashes with a X11/X.h #define 00722 #undef Below 00723 minimizeAnimSlider->setTickmarks(QSlider::Below); 00724 rLay->addMultiCellWidget(minimizeAnimSlider,0,0,1,2); 00725 00726 connect(minimizeAnimOn, SIGNAL(toggled(bool)), this, SLOT(setMinimizeAnim(bool))); 00727 connect(minimizeAnimSlider, SIGNAL(valueChanged(int)), this, SLOT(setMinimizeAnimSpeed(int))); 00728 00729 minimizeAnimSlowLabel= new QLabel(i18n("Slow"),windowsBox); 00730 minimizeAnimSlowLabel->setAlignment(Qt::AlignTop|Qt::AlignLeft); 00731 rLay->addWidget(minimizeAnimSlowLabel,1,1); 00732 00733 minimizeAnimFastLabel= new QLabel(i18n("Fast"),windowsBox); 00734 minimizeAnimFastLabel->setAlignment(Qt::AlignTop|Qt::AlignRight); 00735 rLay->addWidget(minimizeAnimFastLabel,1,2); 00736 00737 wtstr = i18n("Here you can set the speed of the animation shown when windows are" 00738 " minimized and restored. "); 00739 QWhatsThis::add( minimizeAnimSlider, wtstr ); 00740 QWhatsThis::add( minimizeAnimSlowLabel, wtstr ); 00741 QWhatsThis::add( minimizeAnimFastLabel, wtstr ); 00742 00743 moveResizeMaximized = new QCheckBox( i18n("Allow moving and resizing o&f maximized windows"), windowsBox); 00744 bLay->addWidget(moveResizeMaximized); 00745 QWhatsThis::add(moveResizeMaximized, i18n("When enabled, this feature activates the border of maximized windows" 00746 " and allows you to move or resize them," 00747 " just like for normal windows")); 00748 00749 QBoxLayout *vLay = new QHBoxLayout(bLay); 00750 00751 QLabel *plcLabel = new QLabel(i18n("&Placement:"),windowsBox); 00752 00753 placementCombo = new QComboBox(false, windowsBox); 00754 placementCombo->insertItem(i18n("Smart"), SMART_PLACEMENT); 00755 placementCombo->insertItem(i18n("Cascade"), CASCADE_PLACEMENT); 00756 placementCombo->insertItem(i18n("Random"), RANDOM_PLACEMENT); 00757 placementCombo->insertItem(i18n("Centered"), CENTERED_PLACEMENT); 00758 placementCombo->insertItem(i18n("Zero-Cornered"), ZEROCORNERED_PLACEMENT); 00759 // CT: disabling is needed as long as functionality misses in kwin 00760 //placementCombo->insertItem(i18n("Interactive"), INTERACTIVE_PLACEMENT); 00761 //placementCombo->insertItem(i18n("Manual"), MANUAL_PLACEMENT); 00762 placementCombo->setCurrentItem(SMART_PLACEMENT); 00763 00764 // FIXME, when more policies have been added to KWin 00765 wtstr = i18n("The placement policy determines where a new window" 00766 " will appear on the desktop. For now, there are three different policies:" 00767 " <ul><li><em>Smart</em> will try to achieve a minimum overlap of windows</li>" 00768 " <li><em>Cascade</em> will cascade the windows</li>" 00769 " <li><em>Random</em> will use a random position</li></ul>") ; 00770 00771 QWhatsThis::add( plcLabel, wtstr); 00772 QWhatsThis::add( placementCombo, wtstr); 00773 00774 plcLabel->setBuddy(placementCombo); 00775 vLay->addWidget(plcLabel, 0); 00776 vLay->addWidget(placementCombo, 1, Qt::AlignLeft); 00777 00778 bLay->addSpacing(10); 00779 00780 lay->addWidget(windowsBox); 00781 00782 //iTLabel = new QLabel(i18n(" Allowed overlap:\n" 00783 // "(% of desktop space)"), 00784 // plcBox); 00785 //iTLabel->setAlignment(AlignTop|AlignHCenter); 00786 //pLay->addWidget(iTLabel,1,1); 00787 00788 //interactiveTrigger = new QSpinBox(0, 500, 1, plcBox); 00789 //pLay->addWidget(interactiveTrigger,1,2); 00790 00791 //pLay->addRowSpacing(2,KDialog::spacingHint()); 00792 00793 //lay->addWidget(plcBox); 00794 00795 00796 //CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config 00797 MagicBox = new QVButtonGroup(i18n("Snap Zones"), this); 00798 MagicBox->setMargin(15); 00799 00800 BrdrSnap = new KIntNumInput(10, MagicBox); 00801 BrdrSnap->setSpecialValueText( i18n("none") ); 00802 BrdrSnap->setRange( 0, MAX_BRDR_SNAP); 00803 BrdrSnap->setLabel(i18n("&Border snap zone:")); 00804 BrdrSnap->setSuffix(i18n(" pixels")); 00805 BrdrSnap->setSteps(1,10); 00806 QWhatsThis::add( BrdrSnap, i18n("Here you can set the snap zone for screen borders, i.e." 00807 " the 'strength' of the magnetic field which will make windows snap to the border when" 00808 " moved near it.") ); 00809 00810 WndwSnap = new KIntNumInput(10, MagicBox); 00811 WndwSnap->setSpecialValueText( i18n("none") ); 00812 WndwSnap->setRange( 0, MAX_WNDW_SNAP); 00813 WndwSnap->setLabel(i18n("&Window snap zone:")); 00814 WndwSnap->setSuffix( i18n(" pixels")); 00815 BrdrSnap->setSteps(1,10); 00816 QWhatsThis::add( WndwSnap, i18n("Here you can set the snap zone for windows, i.e." 00817 " the 'strength' of the magnetic field which will make windows snap to each other when" 00818 " they're moved near another window.") ); 00819 00820 OverlapSnap=new QCheckBox(i18n("Snap windows onl&y when overlapping"),MagicBox); 00821 QWhatsThis::add( OverlapSnap, i18n("Here you can set that windows will be only" 00822 " snapped if you try to overlap them, i.e. they won't be snapped if the windows" 00823 " comes only near another window or border.") ); 00824 00825 lay->addWidget(MagicBox); 00826 lay->addStretch(); 00827 00828 load(); 00829 00830 // Any changes goes to slotChanged() 00831 connect( opaque, SIGNAL(clicked()), SLOT(changed())); 00832 connect( resizeOpaqueOn, SIGNAL(clicked()), SLOT(changed())); 00833 connect( geometryTipOn, SIGNAL(clicked()), SLOT(changed())); 00834 connect( minimizeAnimOn, SIGNAL(clicked() ), SLOT(changed())); 00835 connect( minimizeAnimSlider, SIGNAL(valueChanged(int)), SLOT(changed())); 00836 connect( moveResizeMaximized, SIGNAL(toggled(bool)), SLOT(changed())); 00837 connect( placementCombo, SIGNAL(activated(int)), SLOT(changed())); 00838 connect( BrdrSnap, SIGNAL(valueChanged(int)), SLOT(changed())); 00839 connect( WndwSnap, SIGNAL(valueChanged(int)), SLOT(changed())); 00840 connect( OverlapSnap, SIGNAL(clicked()), SLOT(changed())); 00841 } 00842 00843 int KMovingConfig::getMove() 00844 { 00845 return (opaque->isChecked())? OPAQUE : TRANSPARENT; 00846 } 00847 00848 void KMovingConfig::setMove(int trans) 00849 { 00850 opaque->setChecked(trans == OPAQUE); 00851 } 00852 00853 void KMovingConfig::setGeometryTip(bool showGeometryTip) 00854 { 00855 geometryTipOn->setChecked(showGeometryTip); 00856 } 00857 00858 bool KMovingConfig::getGeometryTip() 00859 { 00860 return geometryTipOn->isChecked(); 00861 } 00862 00863 // placement policy --- CT 31jan98 --- 00864 int KMovingConfig::getPlacement() 00865 { 00866 return placementCombo->currentItem(); 00867 } 00868 00869 void KMovingConfig::setPlacement(int plac) 00870 { 00871 placementCombo->setCurrentItem(plac); 00872 } 00873 00874 bool KMovingConfig::getMinimizeAnim() 00875 { 00876 return minimizeAnimOn->isChecked(); 00877 } 00878 00879 int KMovingConfig::getMinimizeAnimSpeed() 00880 { 00881 return minimizeAnimSlider->value(); 00882 } 00883 00884 void KMovingConfig::setMinimizeAnim(bool anim) 00885 { 00886 minimizeAnimOn->setChecked( anim ); 00887 minimizeAnimSlider->setEnabled( anim ); 00888 minimizeAnimSlowLabel->setEnabled( anim ); 00889 minimizeAnimFastLabel->setEnabled( anim ); 00890 } 00891 00892 void KMovingConfig::setMinimizeAnimSpeed(int speed) 00893 { 00894 minimizeAnimSlider->setValue(speed); 00895 } 00896 00897 int KMovingConfig::getResizeOpaque() 00898 { 00899 return (resizeOpaqueOn->isChecked())? RESIZE_OPAQUE : RESIZE_TRANSPARENT; 00900 } 00901 00902 void KMovingConfig::setResizeOpaque(int opaque) 00903 { 00904 resizeOpaqueOn->setChecked(opaque == RESIZE_OPAQUE); 00905 } 00906 00907 void KMovingConfig::setMoveResizeMaximized(bool a) { 00908 moveResizeMaximized->setChecked(a); 00909 } 00910 00911 void KMovingConfig::load( void ) 00912 { 00913 QString key; 00914 00915 config->setGroup( "Windows" ); 00916 00917 key = config->readEntry(KWIN_MOVE, "Opaque"); 00918 if( key == "Transparent") 00919 setMove(TRANSPARENT); 00920 else if( key == "Opaque") 00921 setMove(OPAQUE); 00922 00923 //CT 17Jun1998 - variable animation speed from 0 (none!!) to 10 (max) 00924 bool anim = config->readBoolEntry(KWIN_MINIMIZE_ANIM, true ); 00925 int animSpeed = config->readNumEntry(KWIN_MINIMIZE_ANIM_SPEED, 5); 00926 if( animSpeed < 1 ) animSpeed = 0; 00927 if( animSpeed > 10 ) animSpeed = 10; 00928 setMinimizeAnim( anim ); 00929 setMinimizeAnimSpeed( animSpeed ); 00930 00931 // DF: please keep the default consistent with kwin (options.cpp line 145) 00932 key = config->readEntry(KWIN_RESIZE_OPAQUE, "Opaque"); 00933 if( key == "Opaque") 00934 setResizeOpaque(RESIZE_OPAQUE); 00935 else if ( key == "Transparent") 00936 setResizeOpaque(RESIZE_TRANSPARENT); 00937 00938 //KS 10Jan2003 - Geometry Tip during window move/resize 00939 bool showGeomTip = config->readBoolEntry(KWIN_GEOMETRY, false); 00940 setGeometryTip( showGeomTip ); 00941 00942 // placement policy --- CT 19jan98 --- 00943 key = config->readEntry(KWIN_PLACEMENT); 00944 //CT 13mar98 interactive placement 00945 // if( key.left(11) == "interactive") { 00946 // setPlacement(INTERACTIVE_PLACEMENT); 00947 // int comma_pos = key.find(','); 00948 // if (comma_pos < 0) 00949 // interactiveTrigger->setValue(0); 00950 // else 00951 // interactiveTrigger->setValue (key.right(key.length() 00952 // - comma_pos).toUInt(0)); 00953 // iTLabel->setEnabled(true); 00954 // interactiveTrigger->show(); 00955 // } 00956 // else { 00957 // interactiveTrigger->setValue(0); 00958 // iTLabel->setEnabled(false); 00959 // interactiveTrigger->hide(); 00960 if( key == "Random") 00961 setPlacement(RANDOM_PLACEMENT); 00962 else if( key == "Cascade") 00963 setPlacement(CASCADE_PLACEMENT); //CT 31jan98 00964 //CT 31mar98 manual placement 00965 else if( key == "manual") 00966 setPlacement(MANUAL_PLACEMENT); 00967 else if( key == "Centered") 00968 setPlacement(CENTERED_PLACEMENT); 00969 else if( key == "ZeroCornered") 00970 setPlacement(ZEROCORNERED_PLACEMENT); 00971 00972 else 00973 setPlacement(SMART_PLACEMENT); 00974 // } 00975 00976 setMoveResizeMaximized(config->readBoolEntry(KWIN_MOVE_RESIZE_MAXIMIZED, true)); 00977 00978 int v; 00979 00980 v = config->readNumEntry(KWM_BRDR_SNAP_ZONE, KWM_BRDR_SNAP_ZONE_DEFAULT); 00981 if (v > MAX_BRDR_SNAP) setBorderSnapZone(MAX_BRDR_SNAP); 00982 else if (v < 0) setBorderSnapZone (0); 00983 else setBorderSnapZone(v); 00984 00985 v = config->readNumEntry(KWM_WNDW_SNAP_ZONE, KWM_WNDW_SNAP_ZONE_DEFAULT); 00986 if (v > MAX_WNDW_SNAP) setWindowSnapZone(MAX_WNDW_SNAP); 00987 else if (v < 0) setWindowSnapZone (0); 00988 else setWindowSnapZone(v); 00989 00990 OverlapSnap->setChecked(config->readBoolEntry("SnapOnlyWhenOverlapping",false)); 00991 emit KCModule::changed(false); 00992 } 00993 00994 void KMovingConfig::save( void ) 00995 { 00996 int v; 00997 00998 config->setGroup( "Windows" ); 00999 01000 v = getMove(); 01001 if (v == TRANSPARENT) 01002 config->writeEntry(KWIN_MOVE,"Transparent"); 01003 else 01004 config->writeEntry(KWIN_MOVE,"Opaque"); 01005 01006 config->writeEntry(KWIN_GEOMETRY, getGeometryTip()); 01007 01008 // placement policy --- CT 31jan98 --- 01009 v =getPlacement(); 01010 if (v == RANDOM_PLACEMENT) 01011 config->writeEntry(KWIN_PLACEMENT, "Random"); 01012 else if (v == CASCADE_PLACEMENT) 01013 config->writeEntry(KWIN_PLACEMENT, "Cascade"); 01014 else if (v == CENTERED_PLACEMENT) 01015 config->writeEntry(KWIN_PLACEMENT, "Centered"); 01016 else if (v == ZEROCORNERED_PLACEMENT) 01017 config->writeEntry(KWIN_PLACEMENT, "ZeroCornered"); 01018 //CT 13mar98 manual and interactive placement 01019 // else if (v == MANUAL_PLACEMENT) 01020 // config->writeEntry(KWIN_PLACEMENT, "Manual"); 01021 // else if (v == INTERACTIVE_PLACEMENT) { 01022 // QString tmpstr = QString("Interactive,%1").arg(interactiveTrigger->value()); 01023 // config->writeEntry(KWIN_PLACEMENT, tmpstr); 01024 // } 01025 else 01026 config->writeEntry(KWIN_PLACEMENT, "Smart"); 01027 01028 config->writeEntry(KWIN_MINIMIZE_ANIM, getMinimizeAnim()); 01029 config->writeEntry(KWIN_MINIMIZE_ANIM_SPEED, getMinimizeAnimSpeed()); 01030 01031 v = getResizeOpaque(); 01032 if (v == RESIZE_OPAQUE) 01033 config->writeEntry(KWIN_RESIZE_OPAQUE, "Opaque"); 01034 else 01035 config->writeEntry(KWIN_RESIZE_OPAQUE, "Transparent"); 01036 01037 config->writeEntry(KWIN_MOVE_RESIZE_MAXIMIZED, moveResizeMaximized->isChecked()); 01038 01039 01040 config->writeEntry(KWM_BRDR_SNAP_ZONE,getBorderSnapZone()); 01041 config->writeEntry(KWM_WNDW_SNAP_ZONE,getWindowSnapZone()); 01042 config->writeEntry("SnapOnlyWhenOverlapping",OverlapSnap->isChecked()); 01043 01044 if (standAlone) 01045 { 01046 config->sync(); 01047 if ( !kapp->dcopClient()->isAttached() ) 01048 kapp->dcopClient()->attach(); 01049 kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); 01050 } 01051 emit KCModule::changed(false); 01052 } 01053 01054 void KMovingConfig::defaults() 01055 { 01056 setMove(OPAQUE); 01057 setResizeOpaque(RESIZE_TRANSPARENT); 01058 setGeometryTip(false); 01059 setPlacement(SMART_PLACEMENT); 01060 setMoveResizeMaximized(true); 01061 01062 //copied from kcontrol/konq/kwindesktop, aleXXX 01063 setWindowSnapZone(KWM_WNDW_SNAP_ZONE_DEFAULT); 01064 setBorderSnapZone(KWM_BRDR_SNAP_ZONE_DEFAULT); 01065 OverlapSnap->setChecked(false); 01066 01067 setMinimizeAnim( true ); 01068 setMinimizeAnimSpeed( 5 ); 01069 emit KCModule::changed(true); 01070 } 01071 01072 int KMovingConfig::getBorderSnapZone() { 01073 return BrdrSnap->value(); 01074 } 01075 01076 void KMovingConfig::setBorderSnapZone(int pxls) { 01077 BrdrSnap->setValue(pxls); 01078 } 01079 01080 int KMovingConfig::getWindowSnapZone() { 01081 return WndwSnap->value(); 01082 } 01083 01084 void KMovingConfig::setWindowSnapZone(int pxls) { 01085 WndwSnap->setValue(pxls); 01086 } 01087 01088 #include "windows.moc"
KDE Logo
This file is part of the documentation for kwin Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Aug 31 00:02:15 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003