unsigned long Options::updateSettings() { KConfig *config = KGlobal::config(); unsigned long changed = 0; changed |= d->updateKWinSettings(config); // read decoration settings config->setGroup("Windows"); moveMode = stringToMoveResizeMode(config->readEntry("MoveMode", "Opaque")); resizeMode = stringToMoveResizeMode(config->readEntry("ResizeMode", "Opaque")); show_geometry_tip = config->readBoolEntry("GeometryTip", false); tabboxOutline = config->readBoolEntry("TabboxOutline", true); QString val; val = config->readEntry("FocusPolicy", "ClickToFocus"); focusPolicy = ClickToFocus; // what a default :-) if(val == "FocusFollowsMouse") focusPolicy = FocusFollowsMouse; else if(val == "FocusUnderMouse") focusPolicy = FocusUnderMouse; else if(val == "FocusStrictlyUnderMouse") focusPolicy = FocusStrictlyUnderMouse; val = config->readEntry("AltTabStyle", "KDE"); altTabStyle = KDE; // what a default :-) if(val == "CDE") altTabStyle = CDE; rollOverDesktops = config->readBoolEntry("RollOverDesktops", TRUE); // focusStealingPreventionLevel = config->readNumEntry( "FocusStealingPreventionLevel", 2 ); // TODO use low level for now focusStealingPreventionLevel = config->readNumEntry("FocusStealingPreventionLevel", 1); focusStealingPreventionLevel = KMAX(0, KMIN(4, focusStealingPreventionLevel)); if(!focusPolicyIsReasonable()) // #48786, comments #7 and later focusStealingPreventionLevel = 0; KConfig *gc = new KConfig("kdeglobals", false, false); gc->setGroup("Windows"); xineramaEnabled = gc->readBoolEntry("XineramaEnabled", true); xineramaPlacementEnabled = gc->readBoolEntry("XineramaPlacementEnabled", true); xineramaMovementEnabled = gc->readBoolEntry("XineramaMovementEnabled", true); xineramaMaximizeEnabled = gc->readBoolEntry("XineramaMaximizeEnabled", true); xineramaFullscreenEnabled = gc->readBoolEntry("XineramaFullscreenEnabled", true); delete gc; placement = Placement::policyFromString(config->readEntry("Placement"), true); animateShade = config->readBoolEntry("AnimateShade", TRUE); animateMinimize = config->readBoolEntry("AnimateMinimize", TRUE); animateMinimizeSpeed = config->readNumEntry("AnimateMinimizeSpeed", 5); if(focusPolicy == ClickToFocus) { autoRaise = false; autoRaiseInterval = 0; delayFocus = false; delayFocusInterval = 0; } else { autoRaise = config->readBoolEntry("AutoRaise", FALSE); autoRaiseInterval = config->readNumEntry("AutoRaiseInterval", 0); delayFocus = config->readBoolEntry("DelayFocus", FALSE); delayFocusInterval = config->readNumEntry("DelayFocusInterval", 0); } shadeHover = config->readBoolEntry("ShadeHover", FALSE); shadeHoverInterval = config->readNumEntry("ShadeHoverInterval", 250); // important: autoRaise implies ClickRaise clickRaise = autoRaise || config->readBoolEntry("ClickRaise", TRUE); borderSnapZone = config->readNumEntry("BorderSnapZone", 10); windowSnapZone = config->readNumEntry("WindowSnapZone", 10); snapOnlyWhenOverlapping = config->readBoolEntry("SnapOnlyWhenOverlapping", FALSE); electric_borders = config->readNumEntry("ElectricBorders", 0); electric_border_delay = config->readNumEntry("ElectricBorderDelay", 150); OpTitlebarDblClick = windowOperation(config->readEntry("TitlebarDoubleClickCommand", "Shade"), true); d->OpMaxButtonLeftClick = windowOperation(config->readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true); d->OpMaxButtonMiddleClick = windowOperation(config->readEntry("MaximizeButtonMiddleClickCommand", "Maximize (vertical only)"), true); d->OpMaxButtonRightClick = windowOperation(config->readEntry("MaximizeButtonRightClickCommand", "Maximize (horizontal only)"), true); ignorePositionClasses = config->readListEntry("IgnorePositionClasses"); ignoreFocusStealingClasses = config->readListEntry("IgnoreFocusStealingClasses"); // Qt3.2 and older had resource class all lowercase, but Qt3.3 has it capitalized // therefore Client::resourceClass() forces lowercase, force here lowercase as well for(QStringList::Iterator it = ignorePositionClasses.begin(); it != ignorePositionClasses.end(); ++it) (*it) = (*it).lower(); for(QStringList::Iterator it = ignoreFocusStealingClasses.begin(); it != ignoreFocusStealingClasses.end(); ++it) (*it) = (*it).lower(); killPingTimeout = config->readNumEntry("KillPingTimeout", 5000); hideUtilityWindowsForInactive = config->readBoolEntry("HideUtilityWindowsForInactive", true); showDesktopIsMinimizeAll = config->readBoolEntry("ShowDesktopIsMinimizeAll", false); // Mouse bindings config->setGroup("MouseBindings"); CmdActiveTitlebar1 = mouseCommand(config->readEntry("CommandActiveTitlebar1", "Raise"), true); CmdActiveTitlebar2 = mouseCommand(config->readEntry("CommandActiveTitlebar2", "Lower"), true); CmdActiveTitlebar3 = mouseCommand(config->readEntry("CommandActiveTitlebar3", "Operations menu"), true); CmdInactiveTitlebar1 = mouseCommand(config->readEntry("CommandInactiveTitlebar1", "Activate and raise"), true); CmdInactiveTitlebar2 = mouseCommand(config->readEntry("CommandInactiveTitlebar2", "Activate and lower"), true); CmdInactiveTitlebar3 = mouseCommand(config->readEntry("CommandInactiveTitlebar3", "Operations menu"), true); CmdTitlebarWheel = mouseWheelCommand(config->readEntry("CommandTitlebarWheel", "Nothing")); CmdWindow1 = mouseCommand(config->readEntry("CommandWindow1", "Activate, raise and pass click"), false); CmdWindow2 = mouseCommand(config->readEntry("CommandWindow2", "Activate and pass click"), false); CmdWindow3 = mouseCommand(config->readEntry("CommandWindow3", "Activate and pass click"), false); CmdAllModKey = (config->readEntry("CommandAllKey", "Alt") == "Meta") ? Qt::Key_Meta : Qt::Key_Alt; CmdAll1 = mouseCommand(config->readEntry("CommandAll1", "Move"), false); CmdAll2 = mouseCommand(config->readEntry("CommandAll2", "Toggle raise and lower"), false); CmdAll3 = mouseCommand(config->readEntry("CommandAll3", "Resize"), false); CmdAllWheel = mouseWheelCommand(config->readEntry("CommandAllWheel", "Nothing")); // translucency settings config->setGroup("Notification Messages"); useTranslucency = config->readBoolEntry("UseTranslucency", false); config->setGroup("Translucency"); translucentActiveWindows = config->readBoolEntry("TranslucentActiveWindows", false); activeWindowOpacity = uint((config->readNumEntry("ActiveWindowOpacity", 100) / 100.0) * 0xFFFFFFFF); translucentInactiveWindows = config->readBoolEntry("TranslucentInactiveWindows", false); inactiveWindowOpacity = uint((config->readNumEntry("InactiveWindowOpacity", 75) / 100.0) * 0xFFFFFFFF); translucentMovingWindows = config->readBoolEntry("TranslucentMovingWindows", false); movingWindowOpacity = uint((config->readNumEntry("MovingWindowOpacity", 50) / 100.0) * 0xFFFFFFFF); translucentDocks = config->readBoolEntry("TranslucentDocks", false); dockOpacity = uint((config->readNumEntry("DockOpacity", 80) / 100.0) * 0xFFFFFFFF); keepAboveAsActive = config->readBoolEntry("TreatKeepAboveAsActive", true); // TODO: remove this variable useTitleMenuSlider = true; activeWindowShadowSize = config->readNumEntry("ActiveWindowShadowSize", 200); inactiveWindowShadowSize = config->readNumEntry("InactiveWindowShadowSize", 100); dockShadowSize = config->readNumEntry("DockShadowSize", 80); removeShadowsOnMove = config->readBoolEntry("RemoveShadowsOnMove", true); removeShadowsOnResize = config->readBoolEntry("RemoveShadowsOnResize", true); onlyDecoTranslucent = config->readBoolEntry("OnlyDecoTranslucent", false); resetKompmgr = config->readBoolEntry("ResetKompmgr", false); if(resetKompmgr) config->writeEntry("ResetKompmgr", FALSE); // Read button tooltip animation effect from kdeglobals // Since we want to allow users to enable window decoration tooltips // and not kstyle tooltips and vise-versa, we don't read the // "EffectNoTooltip" setting from kdeglobals. KConfig globalConfig("kdeglobals"); globalConfig.setGroup("KDE"); topmenus = globalConfig.readBoolEntry("macStyle", false); KConfig kdesktopcfg("kdesktoprc", true); kdesktopcfg.setGroup("Menubar"); desktop_topmenu = kdesktopcfg.readBoolEntry("ShowMenubar", false); if(desktop_topmenu) topmenus = true; QToolTip::setGloballyEnabled(d->show_tooltips); return changed; }
unsigned long Options::updateSettings() { KSharedConfig::Ptr _config = KGlobal::config(); unsigned long changed = 0; changed |= KDecorationOptions::updateSettings( _config.data() ); // read decoration settings KConfigGroup config( _config, "Windows" ); moveMode = stringToMoveResizeMode( config.readEntry("MoveMode", "Opaque" )); resizeMode = stringToMoveResizeMode( config.readEntry("ResizeMode", "Opaque" )); show_geometry_tip = config.readEntry("GeometryTip", false); QString val; val = config.readEntry ("FocusPolicy", "ClickToFocus"); focusPolicy = ClickToFocus; // what a default :-) if ( val == "FocusFollowsMouse" ) focusPolicy = FocusFollowsMouse; else if ( val == "FocusUnderMouse" ) focusPolicy = FocusUnderMouse; else if ( val == "FocusStrictlyUnderMouse" ) focusPolicy = FocusStrictlyUnderMouse; val = config.readEntry ("AltTabStyle", "KDE"); altTabStyle = KDE; // what a default :-) if ( val == "CDE" ) altTabStyle = CDE; separateScreenFocus = config.readEntry( "SeparateScreenFocus", false ); activeMouseScreen = config.readEntry( "ActiveMouseScreen", focusPolicy != ClickToFocus ); rollOverDesktops = config.readEntry("RollOverDesktops", true); // focusStealingPreventionLevel = config.readEntry( "FocusStealingPreventionLevel", 2 ); // TODO use low level for now focusStealingPreventionLevel = config.readEntry( "FocusStealingPreventionLevel", 1 ); focusStealingPreventionLevel = qMax( 0, qMin( 4, focusStealingPreventionLevel )); if( !focusPolicyIsReasonable()) // #48786, comments #7 and later focusStealingPreventionLevel = 0; xineramaEnabled = config.readEntry ("XineramaEnabled", true); xineramaPlacementEnabled = config.readEntry ("XineramaPlacementEnabled", true); xineramaMovementEnabled = config.readEntry ("XineramaMovementEnabled", true); xineramaMaximizeEnabled = config.readEntry ("XineramaMaximizeEnabled", true); xineramaFullscreenEnabled = config.readEntry ("XineramaFullscreenEnabled", true); placement = Placement::policyFromString( config.readEntry("Placement"), true ); xineramaPlacementScreen = qBound( -1, config.readEntry( "XineramaPlacementScreen", -1 ), Kephal::ScreenUtils::numScreens() - 1 ); if( focusPolicy == ClickToFocus ) { autoRaise = false; autoRaiseInterval = 0; delayFocus = false; delayFocusInterval = 0; } else { autoRaise = config.readEntry("AutoRaise", false); autoRaiseInterval = config.readEntry("AutoRaiseInterval", 0 ); delayFocus = config.readEntry("DelayFocus", false); delayFocusInterval = config.readEntry("DelayFocusInterval", 0 ); } shadeHover = config.readEntry("ShadeHover", false); shadeHoverInterval = config.readEntry("ShadeHoverInterval", 250 ); // important: autoRaise implies ClickRaise clickRaise = autoRaise || config.readEntry("ClickRaise", true); borderSnapZone = config.readEntry("BorderSnapZone", 10); windowSnapZone = config.readEntry("WindowSnapZone", 10); centerSnapZone = config.readEntry("CenterSnapZone", 0); snapOnlyWhenOverlapping = config.readEntry("SnapOnlyWhenOverlapping", false); // Electric borders KConfigGroup borderConfig( _config, "ElectricBorders" ); electric_border_top = electricBorderAction( borderConfig.readEntry( "Top", "None" )); electric_border_top_right = electricBorderAction( borderConfig.readEntry( "TopRight", "None" )); electric_border_right = electricBorderAction( borderConfig.readEntry( "Right", "None" )); electric_border_bottom_right = electricBorderAction( borderConfig.readEntry( "BottomRight", "None" )); electric_border_bottom = electricBorderAction( borderConfig.readEntry( "Bottom", "None" )); electric_border_bottom_left = electricBorderAction( borderConfig.readEntry( "BottomLeft", "None" )); electric_border_left = electricBorderAction( borderConfig.readEntry( "Left", "None" )); electric_border_top_left = electricBorderAction( borderConfig.readEntry( "TopLeft", "None" )); electric_borders = config.readEntry("ElectricBorders", 0); electric_border_delay = config.readEntry("ElectricBorderDelay", 150); electric_border_cooldown = config.readEntry("ElectricBorderCooldown", 350); OpTitlebarDblClick = windowOperation( config.readEntry("TitlebarDoubleClickCommand", "Maximize"), true ); setOpMaxButtonLeftClick( windowOperation( config.readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true )); setOpMaxButtonMiddleClick( windowOperation( config.readEntry("MaximizeButtonMiddleClickCommand", "Maximize (vertical only)"), true )); setOpMaxButtonRightClick( windowOperation( config.readEntry("MaximizeButtonRightClickCommand", "Maximize (horizontal only)"), true )); ignorePositionClasses = config.readEntry("IgnorePositionClasses",QStringList()); ignoreFocusStealingClasses = config.readEntry("IgnoreFocusStealingClasses",QStringList()); // Qt3.2 and older had resource class all lowercase, but Qt3.3 has it capitalized // therefore Client::resourceClass() forces lowercase, force here lowercase as well for( QStringList::Iterator it = ignorePositionClasses.begin(); it != ignorePositionClasses.end(); ++it ) (*it) = (*it).toLower(); for( QStringList::Iterator it = ignoreFocusStealingClasses.begin(); it != ignoreFocusStealingClasses.end(); ++it ) (*it) = (*it).toLower(); killPingTimeout = config.readEntry( "KillPingTimeout", 5000 ); hideUtilityWindowsForInactive = config.readEntry( "HideUtilityWindowsForInactive", true); showDesktopIsMinimizeAll = config.readEntry( "ShowDesktopIsMinimizeAll", false ); // Mouse bindings config = KConfigGroup( _config, "MouseBindings" ); CmdActiveTitlebar1 = mouseCommand(config.readEntry("CommandActiveTitlebar1","Raise"), true ); CmdActiveTitlebar2 = mouseCommand(config.readEntry("CommandActiveTitlebar2","Lower"), true ); CmdActiveTitlebar3 = mouseCommand(config.readEntry("CommandActiveTitlebar3","Operations menu"), true ); CmdInactiveTitlebar1 = mouseCommand(config.readEntry("CommandInactiveTitlebar1","Activate and raise"), true ); CmdInactiveTitlebar2 = mouseCommand(config.readEntry("CommandInactiveTitlebar2","Activate and lower"), true ); CmdInactiveTitlebar3 = mouseCommand(config.readEntry("CommandInactiveTitlebar3","Operations menu"), true ); CmdTitlebarWheel = mouseWheelCommand(config.readEntry("CommandTitlebarWheel","Nothing")); CmdWindow1 = mouseCommand(config.readEntry("CommandWindow1","Activate, raise and pass click"), false ); CmdWindow2 = mouseCommand(config.readEntry("CommandWindow2","Activate and pass click"), false ); CmdWindow3 = mouseCommand(config.readEntry("CommandWindow3","Activate and pass click"), false ); CmdAllModKey = (config.readEntry("CommandAllKey","Alt") == "Meta") ? Qt::Key_Meta : Qt::Key_Alt; CmdAll1 = mouseCommand(config.readEntry("CommandAll1","Move"), false ); CmdAll2 = mouseCommand(config.readEntry("CommandAll2","Toggle raise and lower"), false ); CmdAll3 = mouseCommand(config.readEntry("CommandAll3","Resize"), false ); CmdAllWheel = mouseWheelCommand(config.readEntry("CommandAllWheel","Nothing")); config=KConfigGroup(_config,"Compositing"); refreshRate = config.readEntry( "RefreshRate", 0 ); // Read button tooltip animation effect from kdeglobals // Since we want to allow users to enable window decoration tooltips // and not kstyle tooltips and vise-versa, we don't read the // "EffectNoTooltip" setting from kdeglobals. #if 0 FIXME: we have no mac style menu implementation in kwin anymore, so this just breaks things for people! KConfig _globalConfig("kdeglobals"); KConfigGroup globalConfig(&_globalConfig, "KDE"); topmenus = globalConfig.readEntry("macStyle", false); #else topmenus = false; #endif // QToolTip::setGloballyEnabled( d->show_tooltips ); // KDE4 this probably needs to be done manually in clients // Driver-specific config detection CompositingPrefs prefs; prefs.detect(); reloadCompositingSettings( prefs ); return changed; }