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 if ( a ) 00299 { 00300 clickRaiseOn->setChecked( TRUE ); 00301 if(getAutoRaiseInterval() == 0) 00302 setAutoRaiseInterval(750); 00303 } 00304 00305 } 00306 00307 void KFocusConfig::clickRaiseOnTog(bool ) { 00308 } 00309 00310 void KFocusConfig::setAltTabMode(bool a) { 00311 kdeMode->setChecked(a); 00312 cdeMode->setChecked(!a); 00313 } 00314 00315 void KFocusConfig::setTraverseAll(bool a) { 00316 traverseAll->setChecked(a); 00317 } 00318 00319 void KFocusConfig::setRollOverDesktops(bool a) { 00320 rollOverDesktops->setChecked(a); 00321 } 00322 00323 void KFocusConfig::setShowPopupinfo(bool a) { 00324 showPopupinfo->setChecked(a); 00325 } 00326 00327 void KFocusConfig::load( void ) 00328 { 00329 QString key; 00330 00331 config->setGroup( "Windows" ); 00332 00333 key = config->readEntry(KWIN_FOCUS); 00334 if( key == "ClickToFocus") 00335 setFocus(CLICK_TO_FOCUS); 00336 else if( key == "FocusFollowsMouse") 00337 setFocus(FOCUS_FOLLOWS_MOUSE); 00338 else if(key == "FocusUnderMouse") 00339 setFocus(FOCUS_UNDER_MOUSE); 00340 else if(key == "FocusStrictlyUnderMouse") 00341 setFocus(FOCUS_STRICTLY_UNDER_MOUSE); 00342 00343 int k = config->readNumEntry(KWIN_AUTORAISE_INTERVAL,0); 00344 setAutoRaiseInterval(k); 00345 00346 key = config->readEntry(KWIN_AUTORAISE); 00347 setAutoRaise(key == "on"); 00348 key = config->readEntry(KWIN_CLICKRAISE); 00349 setClickRaise(key != "off"); 00350 setAutoRaiseEnabled(); // this will disable/hide the auto raise delay widget if focus==click 00351 00352 key = config->readEntry(KWIN_ALTTABMODE, "KDE"); 00353 setAltTabMode(key == "KDE"); 00354 00355 setRollOverDesktops( config->readBoolEntry(KWIN_ROLL_OVER_DESKTOPS, true )); 00356 00357 config->setGroup( "PopupInfo" ); 00358 setShowPopupinfo( config->readBoolEntry(KWIN_SHOW_POPUP, false )); 00359 00360 config->setGroup( "TabBox" ); 00361 setTraverseAll( config->readBoolEntry(KWIN_TRAVERSE_ALL, false )); 00362 00363 config->setGroup("Desktops"); 00364 emit KCModule::changed(false); 00365 } 00366 00367 void KFocusConfig::save( void ) 00368 { 00369 int v; 00370 00371 config->setGroup( "Windows" ); 00372 00373 v = getFocus(); 00374 if (v == CLICK_TO_FOCUS) 00375 config->writeEntry(KWIN_FOCUS,"ClickToFocus"); 00376 else if (v == FOCUS_UNDER_MOUSE) 00377 config->writeEntry(KWIN_FOCUS,"FocusUnderMouse"); 00378 else if (v == FOCUS_STRICTLY_UNDER_MOUSE) 00379 config->writeEntry(KWIN_FOCUS,"FocusStrictlyUnderMouse"); 00380 else 00381 config->writeEntry(KWIN_FOCUS,"FocusFollowsMouse"); 00382 00383 v = getAutoRaiseInterval(); 00384 if (v <0) v = 0; 00385 config->writeEntry(KWIN_AUTORAISE_INTERVAL,v); 00386 00387 if (autoRaiseOn->isChecked()) 00388 config->writeEntry(KWIN_AUTORAISE, "on"); 00389 else 00390 config->writeEntry(KWIN_AUTORAISE, "off"); 00391 00392 if (clickRaiseOn->isChecked()) 00393 config->writeEntry(KWIN_CLICKRAISE, "on"); 00394 else 00395 config->writeEntry(KWIN_CLICKRAISE, "off"); 00396 00397 if (kdeMode->isChecked()) 00398 config->writeEntry(KWIN_ALTTABMODE, "KDE"); 00399 else 00400 config->writeEntry(KWIN_ALTTABMODE, "CDE"); 00401 00402 config->writeEntry( KWIN_ROLL_OVER_DESKTOPS, rollOverDesktops->isChecked()); 00403 00404 config->setGroup( "PopupInfo" ); 00405 config->writeEntry( KWIN_SHOW_POPUP, showPopupinfo->isChecked()); 00406 00407 config->setGroup( "TabBox" ); 00408 config->writeEntry( KWIN_TRAVERSE_ALL , traverseAll->isChecked()); 00409 00410 config->setGroup("Desktops"); 00411 00412 if (standAlone) 00413 { 00414 config->sync(); 00415 if ( !kapp->dcopClient()->isAttached() ) 00416 kapp->dcopClient()->attach(); 00417 kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); 00418 } 00419 emit KCModule::changed(false); 00420 } 00421 00422 void KFocusConfig::defaults() 00423 { 00424 setAutoRaiseInterval(0); 00425 setFocus(CLICK_TO_FOCUS); 00426 setAutoRaise(false); 00427 setClickRaise(true); 00428 setAltTabMode(true); 00429 setTraverseAll( false ); 00430 setRollOverDesktops(true); 00431 setShowPopupinfo(false); 00432 emit KCModule::changed(true); 00433 } 00434 00435 KAdvancedConfig::~KAdvancedConfig () 00436 { 00437 if (standAlone) 00438 delete config; 00439 } 00440 00441 KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, QWidget *parent, const char *) 00442 : KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone) 00443 { 00444 QString wtstr; 00445 QBoxLayout *lay = new QVBoxLayout (this, 0, KDialog::spacingHint()); 00446 00447 //iTLabel = new QLabel(i18n(" Allowed overlap:\n" 00448 // "(% of desktop space)"), 00449 // plcBox); 00450 //iTLabel->setAlignment(AlignTop|AlignHCenter); 00451 //pLay->addWidget(iTLabel,1,1); 00452 00453 //interactiveTrigger = new QSpinBox(0, 500, 1, plcBox); 00454 //pLay->addWidget(interactiveTrigger,1,2); 00455 00456 //pLay->addRowSpacing(2,KDialog::spacingHint()); 00457 00458 //lay->addWidget(plcBox); 00459 00460 shBox = new QVButtonGroup(i18n("Shading"), this); 00461 00462 animateShade = new QCheckBox(i18n("Anima&te"), shBox); 00463 QWhatsThis::add(animateShade, i18n("Animate the action of reducing the window to its titlebar (shading)" 00464 " as well as the expansion of a shaded window") ); 00465 00466 shadeHoverOn = new QCheckBox(i18n("&Enable hover"), shBox); 00467 00468 connect(shadeHoverOn, SIGNAL(toggled(bool)), this, SLOT(shadeHoverChanged(bool))); 00469 00470 shadeHover = new KIntNumInput(500, shBox); 00471 shadeHover->setLabel(i18n("Dela&y:"), Qt::AlignVCenter|Qt::AlignLeft); 00472 shadeHover->setRange(0, 3000, 100, true); 00473 shadeHover->setSteps(100, 100); 00474 shadeHover->setSuffix(i18n(" msec")); 00475 00476 QWhatsThis::add(shadeHoverOn, i18n("If Shade Hover is enabled, a shaded window will un-shade automatically " 00477 "when the mouse pointer has been over the title bar for some time.")); 00478 00479 wtstr = i18n("Sets the time in milliseconds before the window unshades " 00480 "when the mouse pointer goes over the shaded window."); 00481 QWhatsThis::add(shadeHover, wtstr); 00482 00483 lay->addWidget(shBox); 00484 00485 // Any changes goes to slotChanged() 00486 connect(animateShade, SIGNAL(toggled(bool)), SLOT(changed())); 00487 connect(shadeHoverOn, SIGNAL(toggled(bool)), SLOT(changed())); 00488 connect(shadeHover, SIGNAL(valueChanged(int)), SLOT(changed())); 00489 00490 electricBox = new QVButtonGroup(i18n("Active Desktop Borders"), this); 00491 electricBox->setMargin(15); 00492 00493 QWhatsThis::add( electricBox, i18n("If this option is enabled, moving the mouse to a screen border" 00494 " will change your desktop. This is e.g. useful if you want to drag windows from one desktop" 00495 " to the other.") ); 00496 active_disable = new QRadioButton(i18n("D&isabled"), electricBox); 00497 active_move = new QRadioButton(i18n("Only &when moving windows"), electricBox); 00498 active_always = new QRadioButton(i18n("A&lways enabled"), electricBox); 00499 00500 delays = new KIntNumInput(10, electricBox); 00501 delays->setRange(0, MAX_EDGE_RES, 50, true); 00502 delays->setSuffix(i18n(" msec")); 00503 delays->setLabel(i18n("Desktop &switch delay:")); 00504 QWhatsThis::add( delays, i18n("Here you can set a delay for switching desktops using the active" 00505 " borders feature. Desktops will be switched after the mouse has been pushed against a screen border" 00506 " for the specified number of milliseconds.") ); 00507 00508 connect( electricBox, SIGNAL(clicked(int)), this, SLOT(setEBorders())); 00509 00510 // Any changes goes to slotChanged() 00511 connect(electricBox, SIGNAL(clicked(int)), SLOT(changed())); 00512 connect(delays, SIGNAL(valueChanged(int)), SLOT(changed())); 00513 00514 lay->addWidget(electricBox); 00515 00516 QHBoxLayout* focusStealingLayout = new QHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint()); 00517 QLabel* focusStealingLabel = new QLabel( i18n( "Focus stealing prevention level:" ), this ); 00518 focusStealing = new QComboBox( this ); 00519 focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "None" )); 00520 focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "Low" )); 00521 focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "Normal" )); 00522 focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "High" )); 00523 focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "Extreme" )); 00524 focusStealingLabel->setBuddy( focusStealing ); 00525 focusStealingLayout->addWidget( focusStealingLabel ); 00526 focusStealingLayout->addWidget( focusStealing, AlignLeft ); 00527 wtstr = i18n( "This option specifies how much KWin will try to prevent unwanted focus stealing " 00528 "caused by unexpected activation of new windows.<ul>" 00529 "<li><em>None:</em> The standard old behavior - prevention is turned off " 00530 "and new windows always become activated.</li>" 00531 "<li><em>Low:</em> Prevention is enabled; when some window doesn't have support " 00532 "for the underlying mechanism and KWin cannot reliably decide whether to " 00533 "activate the window or not, it will be activated. This setting may have both " 00534 "worse and better results than normal level, depending on the applications.</li>" 00535 "<li><em>Normal:</em> Prevention is enabled; the default setting.</li>" 00536 "<li><em>High:</em> New windows get activated only if no window is currently active " 00537 "or if they belong to the currently active application. This setting is probably " 00538 "not really usable when not using mouse focus policy.</li>" 00539 "<li><em>Extreme:</em> All windows must be explicitly activated by the user.</li>" 00540 "</ul>" ); 00541 QWhatsThis::add( focusStealing, wtstr ); 00542 QWhatsThis::add( focusStealingLabel, wtstr ); 00543 00544 connect(focusStealing, SIGNAL(activated(int)), SLOT(changed())); 00545 00546 lay->addLayout( focusStealingLayout ); 00547 00548 lay->addStretch(); 00549 load(); 00550 00551 } 00552 00553 void KAdvancedConfig::setShadeHover(bool on) { 00554 shadeHoverOn->setChecked(on); 00555 shadeHover->setEnabled(on); 00556 } 00557 00558 void KAdvancedConfig::setShadeHoverInterval(int k) { 00559 shadeHover->setValue(k); 00560 } 00561 00562 int KAdvancedConfig::getShadeHoverInterval() { 00563 00564 return shadeHover->value(); 00565 } 00566 00567 void KAdvancedConfig::shadeHoverChanged(bool a) { 00568 shadeHover->setEnabled(a); 00569 } 00570 00571 void KAdvancedConfig::setAnimateShade(bool a) { 00572 animateShade->setChecked(a); 00573 } 00574 00575 void KAdvancedConfig::setFocusStealing(int l) { 00576 l = KMAX( 0, KMIN( 4, l )); 00577 focusStealing->setCurrentItem(l); 00578 } 00579 00580 void KAdvancedConfig::load( void ) 00581 { 00582 config->setGroup( "Windows" ); 00583 00584 setAnimateShade(config->readBoolEntry(KWIN_ANIMSHADE, true)); 00585 setShadeHover(config->readBoolEntry(KWIN_SHADEHOVER, false)); 00586 setShadeHoverInterval(config->readNumEntry(KWIN_SHADEHOVER_INTERVAL, 250)); 00587 00588 setElectricBorders(config->readNumEntry(KWM_ELECTRIC_BORDER, false)); 00589 setElectricBorderDelay(config->readNumEntry(KWM_ELECTRIC_BORDER_DELAY, 150)); 00590 00591 // setFocusStealing( config->readNumEntry(KWIN_FOCUS_STEALING, 2 )); 00592 // TODO default to low for now 00593 setFocusStealing( config->readNumEntry(KWIN_FOCUS_STEALING, 1 )); 00594 00595 emit KCModule::changed(false); 00596 } 00597 00598 void KAdvancedConfig::save( void ) 00599 { 00600 int v; 00601 00602 config->setGroup( "Windows" ); 00603 config->writeEntry(KWIN_ANIMSHADE, animateShade->isChecked()); 00604 if (shadeHoverOn->isChecked()) 00605 config->writeEntry(KWIN_SHADEHOVER, "on"); 00606 else 00607 config->writeEntry(KWIN_SHADEHOVER, "off"); 00608 00609 v = getShadeHoverInterval(); 00610 if (v<0) v = 0; 00611 config->writeEntry(KWIN_SHADEHOVER_INTERVAL, v); 00612 00613 config->writeEntry(KWM_ELECTRIC_BORDER, getElectricBorders()); 00614 config->writeEntry(KWM_ELECTRIC_BORDER_DELAY,getElectricBorderDelay()); 00615 00616 config->writeEntry(KWIN_FOCUS_STEALING, focusStealing->currentItem()); 00617 00618 if (standAlone) 00619 { 00620 config->sync(); 00621 if ( !kapp->dcopClient()->isAttached() ) 00622 kapp->dcopClient()->attach(); 00623 kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); 00624 } 00625 emit KCModule::changed(false); 00626 } 00627 00628 void KAdvancedConfig::defaults() 00629 { 00630 setAnimateShade(true); 00631 setShadeHover(false); 00632 setShadeHoverInterval(250); 00633 setElectricBorders(0); 00634 setElectricBorderDelay(150); 00635 // setFocusStealing(2); 00636 // TODO default to low for now 00637 setFocusStealing(1); 00638 emit KCModule::changed(true); 00639 } 00640 00641 void KAdvancedConfig::setEBorders() 00642 { 00643 delays->setEnabled(!active_disable->isChecked()); 00644 } 00645 00646 int KAdvancedConfig::getElectricBorders() 00647 { 00648 if (active_move->isChecked()) 00649 return 1; 00650 if (active_always->isChecked()) 00651 return 2; 00652 return 0; 00653 } 00654 00655 int KAdvancedConfig::getElectricBorderDelay() 00656 { 00657 return delays->value(); 00658 } 00659 00660 void KAdvancedConfig::setElectricBorders(int i){ 00661 switch(i) 00662 { 00663 case 1: active_move->setChecked(true); break; 00664 case 2: active_always->setChecked(true); break; 00665 default: active_disable->setChecked(true); break; 00666 } 00667 setEBorders(); 00668 } 00669 00670 void KAdvancedConfig::setElectricBorderDelay(int delay) 00671 { 00672 delays->setValue(delay); 00673 } 00674 00675 00676 KMovingConfig::~KMovingConfig () 00677 { 00678 if (standAlone) 00679 delete config; 00680 } 00681 00682 KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *parent, const char *) 00683 : KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone) 00684 { 00685 QString wtstr; 00686 QBoxLayout *lay = new QVBoxLayout (this, 0, KDialog::spacingHint()); 00687 00688 windowsBox = new QButtonGroup(i18n("Windows"), this); 00689 windowsBox->setColumnLayout( 0, Qt::Horizontal ); 00690 00691 QBoxLayout *wLay = new QVBoxLayout (windowsBox->layout(), KDialog::spacingHint()); 00692 00693 QBoxLayout *bLay = new QVBoxLayout; 00694 wLay->addLayout(bLay); 00695 00696 opaque = new QCheckBox(i18n("Di&splay content in moving windows"), windowsBox); 00697 bLay->addWidget(opaque); 00698 QWhatsThis::add( opaque, i18n("Enable this option if you want a window's content to be fully shown" 00699 " while moving it, instead of just showing a window 'skeleton'. The result may not be satisfying" 00700 " on slow machines without graphic acceleration.") ); 00701 00702 resizeOpaqueOn = new QCheckBox(i18n("Display content in &resizing windows"), windowsBox); 00703 bLay->addWidget(resizeOpaqueOn); 00704 QWhatsThis::add( resizeOpaqueOn, i18n("Enable this option if you want a window's content to be shown" 00705 " while resizing it, instead of just showing a window 'skeleton'. The result may not be satisfying" 00706 " on slow machines.") ); 00707 00708 geometryTipOn = new QCheckBox(i18n("Display window &geometry when moving or resizing"), windowsBox); 00709 bLay->addWidget(geometryTipOn); 00710 QWhatsThis::add(geometryTipOn, i18n("Enable this option if you want a window's geometry to be displayed" 00711 " while it is being moved or resized. The window position relative" 00712 " to the top-left corner of the screen is displayed together with" 00713 " its size.")); 00714 00715 QGridLayout *rLay = new QGridLayout(2,3); 00716 bLay->addLayout(rLay); 00717 rLay->setColStretch(0,0); 00718 rLay->setColStretch(1,1); 00719 00720 minimizeAnimOn = new QCheckBox(i18n("Animate minimi&ze and restore"), 00721 windowsBox); 00722 QWhatsThis::add( minimizeAnimOn, i18n("Enable this option if you want an animation shown when" 00723 " windows are minimized or restored." ) ); 00724 rLay->addWidget(minimizeAnimOn,0,0); 00725 00726 minimizeAnimSlider = new QSlider(0,10,10,0,QSlider::Horizontal, windowsBox); 00727 minimizeAnimSlider->setSteps(1, 1); 00728 // QSlider::Below clashes with a X11/X.h #define 00729 #undef Below 00730 minimizeAnimSlider->setTickmarks(QSlider::Below); 00731 rLay->addMultiCellWidget(minimizeAnimSlider,0,0,1,2); 00732 00733 connect(minimizeAnimOn, SIGNAL(toggled(bool)), this, SLOT(setMinimizeAnim(bool))); 00734 connect(minimizeAnimSlider, SIGNAL(valueChanged(int)), this, SLOT(setMinimizeAnimSpeed(int))); 00735 00736 minimizeAnimSlowLabel= new QLabel(i18n("Slow"),windowsBox); 00737 minimizeAnimSlowLabel->setAlignment(Qt::AlignTop|Qt::AlignLeft); 00738 rLay->addWidget(minimizeAnimSlowLabel,1,1); 00739 00740 minimizeAnimFastLabel= new QLabel(i18n("Fast"),windowsBox); 00741 minimizeAnimFastLabel->setAlignment(Qt::AlignTop|Qt::AlignRight); 00742 rLay->addWidget(minimizeAnimFastLabel,1,2); 00743 00744 wtstr = i18n("Here you can set the speed of the animation shown when windows are" 00745 " minimized and restored. "); 00746 QWhatsThis::add( minimizeAnimSlider, wtstr ); 00747 QWhatsThis::add( minimizeAnimSlowLabel, wtstr ); 00748 QWhatsThis::add( minimizeAnimFastLabel, wtstr ); 00749 00750 moveResizeMaximized = new QCheckBox( i18n("Allow moving and resizing o&f maximized windows"), windowsBox); 00751 bLay->addWidget(moveResizeMaximized); 00752 QWhatsThis::add(moveResizeMaximized, i18n("When enabled, this feature activates the border of maximized windows" 00753 " and allows you to move or resize them," 00754 " just like for normal windows")); 00755 00756 QBoxLayout *vLay = new QHBoxLayout(bLay); 00757 00758 QLabel *plcLabel = new QLabel(i18n("&Placement:"),windowsBox); 00759 00760 placementCombo = new QComboBox(false, windowsBox); 00761 placementCombo->insertItem(i18n("Smart"), SMART_PLACEMENT); 00762 placementCombo->insertItem(i18n("Cascade"), CASCADE_PLACEMENT); 00763 placementCombo->insertItem(i18n("Random"), RANDOM_PLACEMENT); 00764 placementCombo->insertItem(i18n("Centered"), CENTERED_PLACEMENT); 00765 placementCombo->insertItem(i18n("Zero-Cornered"), ZEROCORNERED_PLACEMENT); 00766 // CT: disabling is needed as long as functionality misses in kwin 00767 //placementCombo->insertItem(i18n("Interactive"), INTERACTIVE_PLACEMENT); 00768 //placementCombo->insertItem(i18n("Manual"), MANUAL_PLACEMENT); 00769 placementCombo->setCurrentItem(SMART_PLACEMENT); 00770 00771 // FIXME, when more policies have been added to KWin 00772 wtstr = i18n("The placement policy determines where a new window" 00773 " will appear on the desktop. For now, there are three different policies:" 00774 " <ul><li><em>Smart</em> will try to achieve a minimum overlap of windows</li>" 00775 " <li><em>Cascade</em> will cascade the windows</li>" 00776 " <li><em>Random</em> will use a random position</li></ul>") ; 00777 00778 QWhatsThis::add( plcLabel, wtstr); 00779 QWhatsThis::add( placementCombo, wtstr); 00780 00781 plcLabel->setBuddy(placementCombo); 00782 vLay->addWidget(plcLabel, 0); 00783 vLay->addWidget(placementCombo, 1, Qt::AlignLeft); 00784 00785 bLay->addSpacing(10); 00786 00787 lay->addWidget(windowsBox); 00788 00789 //iTLabel = new QLabel(i18n(" Allowed overlap:\n" 00790 // "(% of desktop space)"), 00791 // plcBox); 00792 //iTLabel->setAlignment(AlignTop|AlignHCenter); 00793 //pLay->addWidget(iTLabel,1,1); 00794 00795 //interactiveTrigger = new QSpinBox(0, 500, 1, plcBox); 00796 //pLay->addWidget(interactiveTrigger,1,2); 00797 00798 //pLay->addRowSpacing(2,KDialog::spacingHint()); 00799 00800 //lay->addWidget(plcBox); 00801 00802 00803 //CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config 00804 MagicBox = new QVButtonGroup(i18n("Snap Zones"), this); 00805 MagicBox->setMargin(15); 00806 00807 BrdrSnap = new KIntNumInput(10, MagicBox); 00808 BrdrSnap->setSpecialValueText( i18n("none") ); 00809 BrdrSnap->setRange( 0, MAX_BRDR_SNAP); 00810 BrdrSnap->setLabel(i18n("&Border snap zone:")); 00811 BrdrSnap->setSuffix(i18n(" pixels")); 00812 BrdrSnap->setSteps(1,10); 00813 QWhatsThis::add( BrdrSnap, i18n("Here you can set the snap zone for screen borders, i.e." 00814 " the 'strength' of the magnetic field which will make windows snap to the border when" 00815 " moved near it.") ); 00816 00817 WndwSnap = new KIntNumInput(10, MagicBox); 00818 WndwSnap->setSpecialValueText( i18n("none") ); 00819 WndwSnap->setRange( 0, MAX_WNDW_SNAP); 00820 WndwSnap->setLabel(i18n("&Window snap zone:")); 00821 WndwSnap->setSuffix( i18n(" pixels")); 00822 BrdrSnap->setSteps(1,10); 00823 QWhatsThis::add( WndwSnap, i18n("Here you can set the snap zone for windows, i.e." 00824 " the 'strength' of the magnetic field which will make windows snap to each other when" 00825 " they're moved near another window.") ); 00826 00827 OverlapSnap=new QCheckBox(i18n("Snap windows onl&y when overlapping"),MagicBox); 00828 QWhatsThis::add( OverlapSnap, i18n("Here you can set that windows will be only" 00829 " snapped if you try to overlap them, i.e. they won't be snapped if the windows" 00830 " comes only near another window or border.") ); 00831 00832 lay->addWidget(MagicBox); 00833 lay->addStretch(); 00834 00835 load(); 00836 00837 // Any changes goes to slotChanged() 00838 connect( opaque, SIGNAL(clicked()), SLOT(changed())); 00839 connect( resizeOpaqueOn, SIGNAL(clicked()), SLOT(changed())); 00840 connect( geometryTipOn, SIGNAL(clicked()), SLOT(changed())); 00841 connect( minimizeAnimOn, SIGNAL(clicked() ), SLOT(changed())); 00842 connect( minimizeAnimSlider, SIGNAL(valueChanged(int)), SLOT(changed())); 00843 connect( moveResizeMaximized, SIGNAL(toggled(bool)), SLOT(changed())); 00844 connect( placementCombo, SIGNAL(activated(int)), SLOT(changed())); 00845 connect( BrdrSnap, SIGNAL(valueChanged(int)), SLOT(changed())); 00846 connect( WndwSnap, SIGNAL(valueChanged(int)), SLOT(changed())); 00847 connect( OverlapSnap, SIGNAL(clicked()), SLOT(changed())); 00848 } 00849 00850 int KMovingConfig::getMove() 00851 { 00852 return (opaque->isChecked())? OPAQUE : TRANSPARENT; 00853 } 00854 00855 void KMovingConfig::setMove(int trans) 00856 { 00857 opaque->setChecked(trans == OPAQUE); 00858 } 00859 00860 void KMovingConfig::setGeometryTip(bool showGeometryTip) 00861 { 00862 geometryTipOn->setChecked(showGeometryTip); 00863 } 00864 00865 bool KMovingConfig::getGeometryTip() 00866 { 00867 return geometryTipOn->isChecked(); 00868 } 00869 00870 // placement policy --- CT 31jan98 --- 00871 int KMovingConfig::getPlacement() 00872 { 00873 return placementCombo->currentItem(); 00874 } 00875 00876 void KMovingConfig::setPlacement(int plac) 00877 { 00878 placementCombo->setCurrentItem(plac); 00879 } 00880 00881 bool KMovingConfig::getMinimizeAnim() 00882 { 00883 return minimizeAnimOn->isChecked(); 00884 } 00885 00886 int KMovingConfig::getMinimizeAnimSpeed() 00887 { 00888 return minimizeAnimSlider->value(); 00889 } 00890 00891 void KMovingConfig::setMinimizeAnim(bool anim) 00892 { 00893 minimizeAnimOn->setChecked( anim ); 00894 minimizeAnimSlider->setEnabled( anim ); 00895 minimizeAnimSlowLabel->setEnabled( anim ); 00896 minimizeAnimFastLabel->setEnabled( anim ); 00897 } 00898 00899 void KMovingConfig::setMinimizeAnimSpeed(int speed) 00900 { 00901 minimizeAnimSlider->setValue(speed); 00902 } 00903 00904 int KMovingConfig::getResizeOpaque() 00905 { 00906 return (resizeOpaqueOn->isChecked())? RESIZE_OPAQUE : RESIZE_TRANSPARENT; 00907 } 00908 00909 void KMovingConfig::setResizeOpaque(int opaque) 00910 { 00911 resizeOpaqueOn->setChecked(opaque == RESIZE_OPAQUE); 00912 } 00913 00914 void KMovingConfig::setMoveResizeMaximized(bool a) { 00915 moveResizeMaximized->setChecked(a); 00916 } 00917 00918 void KMovingConfig::load( void ) 00919 { 00920 QString key; 00921 00922 config->setGroup( "Windows" ); 00923 00924 key = config->readEntry(KWIN_MOVE, "Opaque"); 00925 if( key == "Transparent") 00926 setMove(TRANSPARENT); 00927 else if( key == "Opaque") 00928 setMove(OPAQUE); 00929 00930 //CT 17Jun1998 - variable animation speed from 0 (none!!) to 10 (max) 00931 bool anim = config->readBoolEntry(KWIN_MINIMIZE_ANIM, true ); 00932 int animSpeed = config->readNumEntry(KWIN_MINIMIZE_ANIM_SPEED, 5); 00933 if( animSpeed < 1 ) animSpeed = 0; 00934 if( animSpeed > 10 ) animSpeed = 10; 00935 setMinimizeAnim( anim ); 00936 setMinimizeAnimSpeed( animSpeed ); 00937 00938 // DF: please keep the default consistent with kwin (options.cpp line 145) 00939 key = config->readEntry(KWIN_RESIZE_OPAQUE, "Opaque"); 00940 if( key == "Opaque") 00941 setResizeOpaque(RESIZE_OPAQUE); 00942 else if ( key == "Transparent") 00943 setResizeOpaque(RESIZE_TRANSPARENT); 00944 00945 //KS 10Jan2003 - Geometry Tip during window move/resize 00946 bool showGeomTip = config->readBoolEntry(KWIN_GEOMETRY, false); 00947 setGeometryTip( showGeomTip ); 00948 00949 // placement policy --- CT 19jan98 --- 00950 key = config->readEntry(KWIN_PLACEMENT); 00951 //CT 13mar98 interactive placement 00952 // if( key.left(11) == "interactive") { 00953 // setPlacement(INTERACTIVE_PLACEMENT); 00954 // int comma_pos = key.find(','); 00955 // if (comma_pos < 0) 00956 // interactiveTrigger->setValue(0); 00957 // else 00958 // interactiveTrigger->setValue (key.right(key.length() 00959 // - comma_pos).toUInt(0)); 00960 // iTLabel->setEnabled(true); 00961 // interactiveTrigger->show(); 00962 // } 00963 // else { 00964 // interactiveTrigger->setValue(0); 00965 // iTLabel->setEnabled(false); 00966 // interactiveTrigger->hide(); 00967 if( key == "Random") 00968 setPlacement(RANDOM_PLACEMENT); 00969 else if( key == "Cascade") 00970 setPlacement(CASCADE_PLACEMENT); //CT 31jan98 00971 //CT 31mar98 manual placement 00972 else if( key == "manual") 00973 setPlacement(MANUAL_PLACEMENT); 00974 else if( key == "Centered") 00975 setPlacement(CENTERED_PLACEMENT); 00976 else if( key == "ZeroCornered") 00977 setPlacement(ZEROCORNERED_PLACEMENT); 00978 00979 else 00980 setPlacement(SMART_PLACEMENT); 00981 // } 00982 00983 setMoveResizeMaximized(config->readBoolEntry(KWIN_MOVE_RESIZE_MAXIMIZED, true)); 00984 00985 int v; 00986 00987 v = config->readNumEntry(KWM_BRDR_SNAP_ZONE, KWM_BRDR_SNAP_ZONE_DEFAULT); 00988 if (v > MAX_BRDR_SNAP) setBorderSnapZone(MAX_BRDR_SNAP); 00989 else if (v < 0) setBorderSnapZone (0); 00990 else setBorderSnapZone(v); 00991 00992 v = config->readNumEntry(KWM_WNDW_SNAP_ZONE, KWM_WNDW_SNAP_ZONE_DEFAULT); 00993 if (v > MAX_WNDW_SNAP) setWindowSnapZone(MAX_WNDW_SNAP); 00994 else if (v < 0) setWindowSnapZone (0); 00995 else setWindowSnapZone(v); 00996 00997 OverlapSnap->setChecked(config->readBoolEntry("SnapOnlyWhenOverlapping",false)); 00998 emit KCModule::changed(false); 00999 } 01000 01001 void KMovingConfig::save( void ) 01002 { 01003 int v; 01004 01005 config->setGroup( "Windows" ); 01006 01007 v = getMove(); 01008 if (v == TRANSPARENT) 01009 config->writeEntry(KWIN_MOVE,"Transparent"); 01010 else 01011 config->writeEntry(KWIN_MOVE,"Opaque"); 01012 01013 config->writeEntry(KWIN_GEOMETRY, getGeometryTip()); 01014 01015 // placement policy --- CT 31jan98 --- 01016 v =getPlacement(); 01017 if (v == RANDOM_PLACEMENT) 01018 config->writeEntry(KWIN_PLACEMENT, "Random"); 01019 else if (v == CASCADE_PLACEMENT) 01020 config->writeEntry(KWIN_PLACEMENT, "Cascade"); 01021 else if (v == CENTERED_PLACEMENT) 01022 config->writeEntry(KWIN_PLACEMENT, "Centered"); 01023 else if (v == ZEROCORNERED_PLACEMENT) 01024 config->writeEntry(KWIN_PLACEMENT, "ZeroCornered"); 01025 //CT 13mar98 manual and interactive placement 01026 // else if (v == MANUAL_PLACEMENT) 01027 // config->writeEntry(KWIN_PLACEMENT, "Manual"); 01028 // else if (v == INTERACTIVE_PLACEMENT) { 01029 // QString tmpstr = QString("Interactive,%1").arg(interactiveTrigger->value()); 01030 // config->writeEntry(KWIN_PLACEMENT, tmpstr); 01031 // } 01032 else 01033 config->writeEntry(KWIN_PLACEMENT, "Smart"); 01034 01035 config->writeEntry(KWIN_MINIMIZE_ANIM, getMinimizeAnim()); 01036 config->writeEntry(KWIN_MINIMIZE_ANIM_SPEED, getMinimizeAnimSpeed()); 01037 01038 v = getResizeOpaque(); 01039 if (v == RESIZE_OPAQUE) 01040 config->writeEntry(KWIN_RESIZE_OPAQUE, "Opaque"); 01041 else 01042 config->writeEntry(KWIN_RESIZE_OPAQUE, "Transparent"); 01043 01044 config->writeEntry(KWIN_MOVE_RESIZE_MAXIMIZED, moveResizeMaximized->isChecked()); 01045 01046 01047 config->writeEntry(KWM_BRDR_SNAP_ZONE,getBorderSnapZone()); 01048 config->writeEntry(KWM_WNDW_SNAP_ZONE,getWindowSnapZone()); 01049 config->writeEntry("SnapOnlyWhenOverlapping",OverlapSnap->isChecked()); 01050 01051 if (standAlone) 01052 { 01053 config->sync(); 01054 if ( !kapp->dcopClient()->isAttached() ) 01055 kapp->dcopClient()->attach(); 01056 kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); 01057 } 01058 emit KCModule::changed(false); 01059 } 01060 01061 void KMovingConfig::defaults() 01062 { 01063 setMove(OPAQUE); 01064 setResizeOpaque(RESIZE_TRANSPARENT); 01065 setGeometryTip(false); 01066 setPlacement(SMART_PLACEMENT); 01067 setMoveResizeMaximized(true); 01068 01069 //copied from kcontrol/konq/kwindesktop, aleXXX 01070 setWindowSnapZone(KWM_WNDW_SNAP_ZONE_DEFAULT); 01071 setBorderSnapZone(KWM_BRDR_SNAP_ZONE_DEFAULT); 01072 OverlapSnap->setChecked(false); 01073 01074 setMinimizeAnim( true ); 01075 setMinimizeAnimSpeed( 5 ); 01076 emit KCModule::changed(true); 01077 } 01078 01079 int KMovingConfig::getBorderSnapZone() { 01080 return BrdrSnap->value(); 01081 } 01082 01083 void KMovingConfig::setBorderSnapZone(int pxls) { 01084 BrdrSnap->setValue(pxls); 01085 } 01086 01087 int KMovingConfig::getWindowSnapZone() { 01088 return WndwSnap->value(); 01089 } 01090 01091 void KMovingConfig::setWindowSnapZone(int pxls) { 01092 WndwSnap->setValue(pxls); 01093 } 01094 01095 #include "windows.moc"
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