25 #include "kdecoration_p.h"
27 #include <tdeconfig.h>
28 #include <tdeglobalsettings.h>
29 #include <tqpalette.h>
30 #include <tqapplication.h>
33 KDecorationOptionsPrivate::KDecorationOptionsPrivate()
35 for(
int i=0; i < NUM_COLORS*2; ++i)
39 KDecorationOptionsPrivate::~KDecorationOptionsPrivate()
42 for(i=0; i < NUM_COLORS*2; ++i)
52 void KDecorationOptionsPrivate::defaultKWinSettings()
54 title_buttons_left =
"MS";
55 title_buttons_right =
"HIAX";
56 custom_button_positions =
false;
58 border_size = BorderNormal;
59 cached_border_size = BordersCount;
60 move_resize_maximized_windows =
true;
61 OpMaxButtonRightClick = MaximizeOp;
62 OpMaxButtonMiddleClick = VMaximizeOp;
63 OpMaxButtonLeftClick = HMaximizeOp;
66 unsigned long KDecorationOptionsPrivate::updateKWinSettings( TDEConfig* config )
68 unsigned long changed = 0;
69 TQString old_group = config->group();
70 config->setGroup(
"WM" );
73 TQColor old_colors[NUM_COLORS*2];
77 old_colors[ i ] = colors[ i ];
79 TQPalette pal = TQApplication::palette();
81 colors[ColorFrame] = pal.active().background();
82 colors[ColorFrame] = config->readColorEntry(
"frame", &colors[ColorFrame]);
83 colors[ColorHandle] = colors[ColorFrame];
84 colors[ColorHandle] = config->readColorEntry(
"handle", &colors[ColorHandle]);
87 if(TQPixmap::defaultDepth() > 8)
88 colors[ColorButtonBg] = colors[ColorFrame].light(130);
90 colors[ColorButtonBg] = colors[ColorFrame];
91 colors[ColorButtonBg] = config->readColorEntry(
"activeTitleBtnBg",
93 colors[ColorTitleBar] = pal.active().highlight();
94 colors[ColorTitleBar] = config->readColorEntry(
"activeBackground",
95 &colors[ColorTitleBar]);
96 if(TQPixmap::defaultDepth() > 8)
97 colors[ColorTitleBlend] = colors[ ColorTitleBar ].dark(110);
99 colors[ColorTitleBlend] = colors[ ColorTitleBar ];
100 colors[ColorTitleBlend] = config->readColorEntry(
"activeBlend",
101 &colors[ColorTitleBlend]);
103 colors[ColorFont] = pal.active().highlightedText();
104 colors[ColorFont] = config->readColorEntry(
"activeForeground", &colors[ColorFont]);
107 colors[ColorFrame+NUM_COLORS] = config->readColorEntry(
"inactiveFrame",
108 &colors[ColorFrame]);
109 colors[ColorTitleBar+NUM_COLORS] = colors[ColorFrame];
110 colors[ColorTitleBar+NUM_COLORS] = config->
111 readColorEntry(
"inactiveBackground", &colors[ColorTitleBar+NUM_COLORS]);
113 if(TQPixmap::defaultDepth() > 8)
114 colors[ColorTitleBlend+NUM_COLORS] = colors[ ColorTitleBar+NUM_COLORS ].dark(110);
116 colors[ColorTitleBlend+NUM_COLORS] = colors[ ColorTitleBar+NUM_COLORS ];
117 colors[ColorTitleBlend+NUM_COLORS] =
118 config->readColorEntry(
"inactiveBlend", &colors[ColorTitleBlend+NUM_COLORS]);
121 if(TQPixmap::defaultDepth() > 8)
122 colors[ColorButtonBg+NUM_COLORS] = colors[ColorFrame+NUM_COLORS].light(130);
124 colors[ColorButtonBg+NUM_COLORS] = colors[ColorFrame+NUM_COLORS];
125 colors[ColorButtonBg+NUM_COLORS] =
126 config->readColorEntry(
"inactiveTitleBtnBg",
127 &colors[ColorButtonBg]);
129 colors[ColorHandle+NUM_COLORS] =
130 config->readColorEntry(
"inactiveHandle", &colors[ColorHandle]);
132 colors[ColorFont+NUM_COLORS] = colors[ColorFrame].dark();
133 colors[ColorFont+NUM_COLORS] = config->readColorEntry(
"inactiveForeground",
134 &colors[ColorFont+NUM_COLORS]);
139 if( old_colors[ i ] != colors[ i ] )
140 changed |= SettingColors;
143 TQFont old_activeFont = activeFont;
144 TQFont old_inactiveFont = inactiveFont;
145 TQFont old_activeFontSmall = activeFontSmall;
146 TQFont old_inactiveFontSmall = inactiveFontSmall;
148 TQFont activeFontGuess = TDEGlobalSettings::windowTitleFont();
150 activeFont = config->readFontEntry(
"activeFont", &activeFontGuess);
151 inactiveFont = config->readFontEntry(
"inactiveFont", &activeFont);
153 activeFontSmall = activeFont;
154 activeFontSmall.setPointSize(activeFont.pointSize() - 2);
155 activeFontSmall = config->readFontEntry(
"activeFontSmall", &activeFontSmall);
156 inactiveFontSmall = config->readFontEntry(
"inactiveFontSmall", &activeFontSmall);
158 if( old_activeFont != activeFont
159 || old_inactiveFont != inactiveFont
160 || old_activeFontSmall != activeFontSmall
161 || old_inactiveFontSmall != inactiveFontSmall )
162 changed |= SettingFont;
164 config->setGroup(
"Style" );
166 TQString old_title_buttons_left = title_buttons_left;
167 TQString old_title_buttons_right = title_buttons_right;
168 bool old_custom_button_positions = custom_button_positions;
169 custom_button_positions = config->readBoolEntry(
"CustomButtonPositions",
false);
170 if (custom_button_positions)
172 title_buttons_left = config->readEntry(
"ButtonsOnLeft",
"MS");
173 title_buttons_right = config->readEntry(
"ButtonsOnRight",
"HIAX");
177 title_buttons_left =
"MS";
178 title_buttons_right =
"HIAX";
180 if( old_custom_button_positions != custom_button_positions
181 || ( custom_button_positions &&
182 ( old_title_buttons_left != title_buttons_left
183 || old_title_buttons_right != title_buttons_right )))
184 changed |= SettingButtons;
187 bool old_show_tooltips = show_tooltips;
188 show_tooltips = config->readBoolEntry(
"ShowToolTips",
true);
189 if( old_show_tooltips != show_tooltips )
190 changed |= SettingTooltips;
194 BorderSize old_border_size = border_size;
195 int border_size_num = config->readNumEntry(
"BorderSize", BorderNormal );
196 if( border_size_num >= 0 && border_size_num < BordersCount )
197 border_size =
static_cast< BorderSize
>( border_size_num );
199 border_size = BorderNormal;
200 if( old_border_size != border_size )
201 changed |= SettingBorder;
202 cached_border_size = BordersCount;
204 config->setGroup(
"Windows" );
205 bool old_move_resize_maximized_windows = move_resize_maximized_windows;
206 move_resize_maximized_windows = config->readBoolEntry(
"MoveResizeMaximizedWindows",
false );
207 if( old_move_resize_maximized_windows != move_resize_maximized_windows )
208 changed |= SettingBorder;
212 for(i=0; i < NUM_COLORS*2; ++i)
221 config->setGroup( old_group );
227 TQValueList< BorderSize > sizes )
const
229 for( TQValueList< BorderSize >::ConstIterator it = sizes.begin();