Changeset View
Changeset View
Standalone View
Standalone View
plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp
Show First 20 Lines • Show All 202 Lines • ▼ Show 20 Line(s) | 202 | case DecorationRight: | |||
---|---|---|---|---|---|
203 | left = top = bottom = 0; | 203 | left = top = bottom = 0; | ||
204 | right = title; | 204 | right = title; | ||
205 | break; | 205 | break; | ||
206 | default: | 206 | default: | ||
207 | left = right = bottom = top = 0; | 207 | left = right = bottom = top = 0; | ||
208 | break; | 208 | break; | ||
209 | } | 209 | } | ||
210 | } else { | 210 | } else { | ||
211 | int minMargin; | ||||
212 | int maxMargin; | ||||
211 | switch (d->borderSize) { | 213 | switch (d->borderSize) { | ||
214 | case KDecoration2::BorderSize::NoSides: | ||||
212 | case KDecoration2::BorderSize::Tiny: | 215 | case KDecoration2::BorderSize::Tiny: | ||
213 | // TODO: this looks wrong | 216 | minMargin = 1; | ||
214 | if (isCompositingActive()) { | 217 | maxMargin = 4; | ||
215 | left = qMin(0, (int)left - d->themeConfig.borderLeft() - d->themeConfig.paddingLeft()); | 218 | break; | ||
216 | right = qMin(0, (int)right - d->themeConfig.borderRight() - d->themeConfig.paddingRight()); | 219 | case KDecoration2::BorderSize::Normal: | ||
217 | bottom = qMin(0, (int)bottom - d->themeConfig.borderBottom() - d->themeConfig.paddingBottom()); | 220 | minMargin = 4; | ||
218 | } else { | 221 | maxMargin = 6; | ||
219 | left = qMin(0, (int)left - d->themeConfig.borderLeft()); | | |||
220 | right = qMin(0, (int)right - d->themeConfig.borderRight()); | | |||
221 | bottom = qMin(0, (int)bottom - d->themeConfig.borderBottom()); | | |||
222 | } | | |||
223 | break; | 222 | break; | ||
224 | case KDecoration2::BorderSize::Large: | 223 | case KDecoration2::BorderSize::Large: | ||
225 | left = right = bottom = top = 4; | 224 | minMargin = 6; | ||
davidedmundson: can you explain where these numbers come from? | |||||
they're as arbitrary as before, tough they are a range now, so:
mart: they're as arbitrary as before, tough they are a range now, so:
* take the border size from the… | |||||
225 | maxMargin = 8; | ||||
226 | break; | 226 | break; | ||
227 | case KDecoration2::BorderSize::VeryLarge: | 227 | case KDecoration2::BorderSize::VeryLarge: | ||
228 | left = right = bottom = top = 8; | 228 | minMargin = 8; | ||
229 | maxMargin = 12; | ||||
229 | break; | 230 | break; | ||
230 | case KDecoration2::BorderSize::Huge: | 231 | case KDecoration2::BorderSize::Huge: | ||
231 | left = right = bottom = top = 12; | 232 | minMargin = 12; | ||
233 | maxMargin = 20; | ||||
232 | break; | 234 | break; | ||
233 | case KDecoration2::BorderSize::VeryHuge: | 235 | case KDecoration2::BorderSize::VeryHuge: | ||
234 | left = right = bottom = top = 23; | 236 | minMargin = 23; | ||
237 | maxMargin = 30; | ||||
235 | break; | 238 | break; | ||
236 | case KDecoration2::BorderSize::Oversized: | 239 | case KDecoration2::BorderSize::Oversized: | ||
237 | left = right = bottom = top = 36; | 240 | minMargin = 36; | ||
241 | maxMargin = 48; | ||||
238 | break; | 242 | break; | ||
239 | case KDecoration2::BorderSize::Normal: | | |||
240 | default: | 243 | default: | ||
241 | left = right = bottom = top = 0; | 244 | minMargin = 0; | ||
245 | maxMargin = 0; | ||||
246 | } | ||||
247 | | ||||
248 | left = qBound(minMargin, d->themeConfig.borderLeft(), maxMargin); | ||||
249 | right = qBound(minMargin, d->themeConfig.borderRight(), maxMargin); | ||||
250 | bottom = qBound(minMargin, d->themeConfig.borderBottom(), maxMargin); | ||||
251 | | ||||
252 | if (d->borderSize == KDecoration2::BorderSize::None) { | ||||
253 | left = 0; | ||||
254 | right = 0; | ||||
255 | bottom = 0; | ||||
256 | } else if (d->borderSize == KDecoration2::BorderSize::NoSides) { | ||||
257 | left = 0; | ||||
258 | right = 0; | ||||
242 | } | 259 | } | ||
260 | | ||||
243 | const qreal title = titleHeight + d->themeConfig.titleEdgeTop() + d->themeConfig.titleEdgeBottom(); | 261 | const qreal title = titleHeight + d->themeConfig.titleEdgeTop() + d->themeConfig.titleEdgeBottom(); | ||
244 | switch ((DecorationPosition)d->themeConfig.decorationPosition()) { | 262 | switch ((DecorationPosition)d->themeConfig.decorationPosition()) { | ||
245 | case DecorationTop: | 263 | case DecorationTop: | ||
246 | left += d->themeConfig.borderLeft(); | | |||
247 | right += d->themeConfig.borderRight(); | | |||
248 | bottom += d->themeConfig.borderBottom(); | | |||
249 | top = title; | 264 | top = title; | ||
250 | break; | 265 | break; | ||
251 | case DecorationBottom: | 266 | case DecorationBottom: | ||
252 | left += d->themeConfig.borderLeft(); | | |||
253 | right += d->themeConfig.borderRight(); | | |||
254 | bottom = title; | 267 | bottom = title; | ||
255 | top += d->themeConfig.borderTop(); | | |||
256 | break; | 268 | break; | ||
257 | case DecorationLeft: | 269 | case DecorationLeft: | ||
258 | left = title; | 270 | left = title; | ||
259 | right += d->themeConfig.borderRight(); | | |||
260 | bottom += d->themeConfig.borderBottom(); | | |||
261 | top += d->themeConfig.borderTop(); | | |||
262 | break; | 271 | break; | ||
263 | case DecorationRight: | 272 | case DecorationRight: | ||
264 | left += d->themeConfig.borderLeft(); | | |||
265 | right = title; | 273 | right = title; | ||
266 | bottom += d->themeConfig.borderBottom(); | | |||
267 | top += d->themeConfig.borderTop(); | | |||
268 | break; | 274 | break; | ||
269 | default: | 275 | default: | ||
270 | left = right = bottom = top = 0; | 276 | left = right = bottom = top = 0; | ||
271 | break; | 277 | break; | ||
272 | } | 278 | } | ||
273 | } | 279 | } | ||
274 | } | 280 | } | ||
275 | 281 | | |||
▲ Show 20 Lines • Show All 230 Lines • Show Last 20 Lines |
can you explain where these numbers come from?