Merge lp:~unity-team/compiz/x-sru6 into lp:compiz/0.9.13
- x-sru6
- Merge into 0.9.13
| Status: | Superseded |
|---|---|
| Proposed branch: | lp:~unity-team/compiz/x-sru6 |
| Merge into: | lp:compiz/0.9.13 |
| Diff against target: |
1727 lines (+1673/-1) (has conflicts) 5 files modified
VERSION (+4/-0) debian/changelog (+108/-0) gtk/window-decorator/decorator.c (+2/-0) gtk/window-decorator/metacity.c.OTHER (+1555/-0) src/region/src/region.cpp (+4/-1) Text conflict in VERSION Text conflict in debian/changelog Contents conflict in gtk/window-decorator/metacity.c |
| To merge this branch: | bzr merge lp:~unity-team/compiz/x-sru6 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Compiz Maintainers | Pending | ||
|
Review via email:
|
|||
This proposal has been superseded by a proposal from 2018-02-20.
Commit message
Releasing Xenial Compiz SRU6
Description of the change
- 4021. By Marco Trevisan (Treviño)
-
Region: define static const functions returning infinite and empty regions
Unmerged revisions
- 4021. By Marco Trevisan (Treviño)
-
Region: define static const functions returning infinite and empty regions
- 4020. By CI Train Bot Account
-
Releasing 1:0.9.12.
3+16.04. 20171116- 0ubuntu1 - 4019. By CI Train Bot Account
-
* Added option to disable blend in grid plugin (LP: #1700859)
* Move: add options for showing only the window shape (filled or not)
(LP: #1700859)
* Ensure that surfaces used by metacity theme have device scale set to
1 . (LP: #1530277) (LP: #1530277)
* Use AnyPropertyType when getting _MOTIF_WM_HINTS property. (LP:
#1702297)
* mate: Avoid artefacts of Windows Thumbnail Previews (LP: #1606369)
* move: damage all the border area in outline mode and ignore
transparent colors (LP: #1700859)
* grid: ignore alpha in colors when not blending, and fix animations
(LP: #1700859)
* resize: add support for disabling transparency and avoid over-
damaging in outline mode (LP: #1700859)
* Screen: add averageColor to get the current desktop average color
* unity-lowgfx.ini: remove unsupported unity option - 4018. By CI Train Bot Account
-
Releasing 1:0.9.12.
2+16.04. 20160823- 0ubuntu1 - 4017. By CI Train Bot Account
-
[expo] limit scroll to workarea. (LP: #913880)
- 4016. By CI Train Bot Account
-
Releasing 1:0.9.12.
2+16.04. 20160801. 3-0ubuntu1 - 4015. By CI Train Bot Account
-
* Don't activate expo if not needed (1x1 setup) (LP: #1606254)
* Don't crash if gsettings key is not found. Default value will be
used. (LP: #1044662)
* focusDefaultWindow: focus Most Recently Used (MRU) window and
fallback to the top window in case MRU list is not available. (LP:
#1073488, LP: #1459671)
* Unity MigrationScript: sync gsettings on exit, and only use dconf on
failure (LP: #1605011) - 4014. By CI Train Bot Account
-
Releasing 1:0.9.12.
2+16.04. 20160714- 0ubuntu1 - 4013. By CI Train Bot Account
-
* Added options for no animation in expo and scale plugins. They skip
the intermediate fading steps that force several redraws.
* Added a new option in show desktop plugin that skips the fade
animation: useful when performance is more important than eyecandy.
* debian: add unity-lowgfx profile to compizconfig (LP: #1598770)
* Composite: use C++ goodness for managing damaging rectangles
* ccsGSettingsBackend: don't try to update setting if wrapper is not
found
* migration scripts: remove unsupported plugins for all the unity
profiles - 4012. By CI Train Bot Account
-
Releasing 1:0.9.12.
2+16.04. 20160526- 0ubuntu1
Preview Diff
| 1 | === modified file 'VERSION' | |||
| 2 | --- VERSION 2016-11-11 16:21:01 +0000 | |||
| 3 | +++ VERSION 2018-02-20 17:39:33 +0000 | |||
| 4 | @@ -1,1 +1,5 @@ | |||
| 5 | 1 | <<<<<<< TREE | ||
| 6 | 1 | 0.9.13.1 | 2 | 0.9.13.1 |
| 7 | 3 | ======= | ||
| 8 | 4 | 0.9.12.3 | ||
| 9 | 5 | >>>>>>> MERGE-SOURCE | ||
| 10 | 2 | 6 | ||
| 11 | === modified file 'debian/changelog' | |||
| 12 | --- debian/changelog 2017-11-16 03:25:55 +0000 | |||
| 13 | +++ debian/changelog 2018-02-20 17:39:33 +0000 | |||
| 14 | @@ -1,3 +1,4 @@ | |||
| 15 | 1 | <<<<<<< TREE | ||
| 16 | 1 | compiz (1:0.9.13.1+18.04.20171116-0ubuntu1) bionic; urgency=medium | 2 | compiz (1:0.9.13.1+18.04.20171116-0ubuntu1) bionic; urgency=medium |
| 17 | 2 | 3 | ||
| 18 | 3 | [ Marco Trevisan (Treviño) ] | 4 | [ Marco Trevisan (Treviño) ] |
| 19 | @@ -379,6 +380,113 @@ | |||
| 20 | 379 | 380 | ||
| 21 | 380 | -- Matthias Klose <doko@ubuntu.com> Sat, 23 Apr 2016 00:01:37 +0000 | 381 | -- Matthias Klose <doko@ubuntu.com> Sat, 23 Apr 2016 00:01:37 +0000 |
| 22 | 381 | 382 | ||
| 23 | 383 | ======= | ||
| 24 | 384 | compiz (1:0.9.12.3+16.04.20171116-0ubuntu2) UNRELEASED; urgency=medium | ||
| 25 | 385 | |||
| 26 | 386 | * Region: nullify the priv XRegion after destroying it (LP: #1750619) | ||
| 27 | 387 | |||
| 28 | 388 | -- Marco Trevisan (Treviño) <mail@3v1n0.net> Tue, 20 Feb 2018 18:38:26 +0100 | ||
| 29 | 389 | |||
| 30 | 390 | compiz (1:0.9.12.3+16.04.20171116-0ubuntu1) xenial; urgency=medium | ||
| 31 | 391 | |||
| 32 | 392 | [ Eleni Maria Stea ] | ||
| 33 | 393 | * Added option to disable blend in grid plugin (LP: #1700859) | ||
| 34 | 394 | * Move: add options for showing only the window shape (filled or not) | ||
| 35 | 395 | (LP: #1700859) | ||
| 36 | 396 | |||
| 37 | 397 | [ Alberts Muktupāvels ] | ||
| 38 | 398 | * Ensure that surfaces used by metacity theme have device scale set to | ||
| 39 | 399 | 1 . (LP: #1530277) (LP: #1530277) | ||
| 40 | 400 | * Use AnyPropertyType when getting _MOTIF_WM_HINTS property. (LP: | ||
| 41 | 401 | #1702297) | ||
| 42 | 402 | |||
| 43 | 403 | [ Martin Wimpress ] | ||
| 44 | 404 | * mate: Avoid artefacts of Windows Thumbnail Previews (LP: #1606369) | ||
| 45 | 405 | |||
| 46 | 406 | [ Marco Trevisan (Treviño) ] | ||
| 47 | 407 | * move: damage all the border area in outline mode and ignore | ||
| 48 | 408 | transparent colors (LP: #1700859) | ||
| 49 | 409 | * grid: ignore alpha in colors when not blending, and fix animations | ||
| 50 | 410 | (LP: #1700859) | ||
| 51 | 411 | * resize: add support for disabling transparency and avoid over- | ||
| 52 | 412 | damaging in outline mode (LP: #1700859) | ||
| 53 | 413 | * Screen: add averageColor to get the current desktop average color | ||
| 54 | 414 | * unity-lowgfx.ini: remove unsupported unity option | ||
| 55 | 415 | |||
| 56 | 416 | -- Marco Trevisan (Treviño) <mail@3v1n0.net> Thu, 16 Nov 2017 23:00:54 +0000 | ||
| 57 | 417 | |||
| 58 | 418 | compiz (1:0.9.12.2+16.04.20160823-0ubuntu1) xenial; urgency=medium | ||
| 59 | 419 | |||
| 60 | 420 | [ Andrea Azzarone ] | ||
| 61 | 421 | * [expo] limit scroll to workarea. (LP: #913880) | ||
| 62 | 422 | |||
| 63 | 423 | -- Marco Trevisan (Treviño) <mail@3v1n0.net> Tue, 23 Aug 2016 16:06:02 +0000 | ||
| 64 | 424 | |||
| 65 | 425 | compiz (1:0.9.12.2+16.04.20160801.3-0ubuntu1) xenial; urgency=medium | ||
| 66 | 426 | |||
| 67 | 427 | [ Andrea Azzarone ] | ||
| 68 | 428 | * Don't activate expo if not needed (1x1 setup) (LP: #1606254) | ||
| 69 | 429 | * Don't crash if gsettings key is not found. Default value will be | ||
| 70 | 430 | used. (LP: #1044662) | ||
| 71 | 431 | * focusDefaultWindow: focus Most Recently Used (MRU) window and | ||
| 72 | 432 | fallback to the top window in case MRU list is not available. (LP: | ||
| 73 | 433 | #1073488, LP: #1459671) | ||
| 74 | 434 | |||
| 75 | 435 | [ Marco Trevisan (Treviño) ] | ||
| 76 | 436 | * Unity MigrationScript: sync gsettings on exit, and only use dconf on | ||
| 77 | 437 | failure (LP: #1605011) | ||
| 78 | 438 | |||
| 79 | 439 | -- Marco Trevisan (Treviño) <mail@3v1n0.net> Mon, 01 Aug 2016 13:41:42 +0000 | ||
| 80 | 440 | |||
| 81 | 441 | compiz (1:0.9.12.2+16.04.20160714-0ubuntu1) xenial; urgency=medium | ||
| 82 | 442 | |||
| 83 | 443 | [ Eleni Maria Stea ] | ||
| 84 | 444 | * Added options for no animation in expo and scale plugins. They skip | ||
| 85 | 445 | the intermediate fading steps that force several redraws. | ||
| 86 | 446 | * Added a new option in show desktop plugin that skips the fade | ||
| 87 | 447 | animation: useful when performance is more important than eyecandy. | ||
| 88 | 448 | |||
| 89 | 449 | [ Marco Trevisan (Treviño) ] | ||
| 90 | 450 | * debian: add unity-lowgfx profile to compizconfig (LP: #1598770) | ||
| 91 | 451 | * Composite: use C++ goodness for managing damaging rectangles | ||
| 92 | 452 | * ccsGSettingsBackend: don't try to update setting if wrapper is not | ||
| 93 | 453 | found | ||
| 94 | 454 | * migration scripts: remove unsupported plugins for all the unity | ||
| 95 | 455 | profiles | ||
| 96 | 456 | |||
| 97 | 457 | -- Marco Trevisan (Treviño) <mail@3v1n0.net> Thu, 14 Jul 2016 16:00:57 +0000 | ||
| 98 | 458 | |||
| 99 | 459 | compiz (1:0.9.12.2+16.04.20160526-0ubuntu1) xenial; urgency=medium | ||
| 100 | 460 | |||
| 101 | 461 | [ Andrea Azzarone ] | ||
| 102 | 462 | * Add an option to notify that a key press is actually an "auto | ||
| 103 | 463 | repeat" one. (LP: #1572241) | ||
| 104 | 464 | |||
| 105 | 465 | [ Alberts Muktupāvels ] | ||
| 106 | 466 | * OpenGL: use the number of Opaque windows around to decide whether | ||
| 107 | 467 | paint the bg or not (LP: #1574866) | ||
| 108 | 468 | |||
| 109 | 469 | [ Marco Trevisan (Treviño) ] | ||
| 110 | 470 | * Scale: use the selectedWindow as starting point when focusing a | ||
| 111 | 471 | window (LP: #1575168) | ||
| 112 | 472 | * Scale: allow to iterate through windows using Tab key | ||
| 113 | 473 | * Window: call stateChangeNotify when compiz state changed but before | ||
| 114 | 474 | changing the WM state (LP: #1521302) | ||
| 115 | 475 | |||
| 116 | 476 | [ Eleni Maria Stea ] | ||
| 117 | 477 | * Expo, Scale: add support for bottom offsets (LP: #1562346, LP: | ||
| 118 | 478 | #1573897) | ||
| 119 | 479 | |||
| 120 | 480 | [ handsome_feng ] | ||
| 121 | 481 | * Add a YBottomOffset value when stretch maximized windows。 (LP: | ||
| 122 | 482 | #1562348) | ||
| 123 | 483 | |||
| 124 | 484 | [ CI Train Bot ] | ||
| 125 | 485 | * No-change rebuild. | ||
| 126 | 486 | |||
| 127 | 487 | -- Marco Trevisan (Treviño) <mail@3v1n0.net> Thu, 26 May 2016 00:12:16 +0000 | ||
| 128 | 488 | |||
| 129 | 489 | >>>>>>> MERGE-SOURCE | ||
| 130 | 382 | compiz (1:0.9.12.2+16.04.20160415-0ubuntu1) xenial; urgency=medium | 490 | compiz (1:0.9.12.2+16.04.20160415-0ubuntu1) xenial; urgency=medium |
| 131 | 383 | 491 | ||
| 132 | 384 | [ Martin Wimpress ] | 492 | [ Martin Wimpress ] |
| 133 | 385 | 493 | ||
| 134 | === modified file 'debian/mate.ini' | |||
| 135 | === modified file 'gtk/window-decorator/decorator.c' | |||
| 136 | --- gtk/window-decorator/decorator.c 2017-04-02 17:32:10 +0000 | |||
| 137 | +++ gtk/window-decorator/decorator.c 2018-02-20 17:39:33 +0000 | |||
| 138 | @@ -553,6 +553,8 @@ | |||
| 139 | 553 | } | 553 | } |
| 140 | 554 | #endif | 554 | #endif |
| 141 | 555 | 555 | ||
| 142 | 556 | // FIXME: this should match the current monitor scaling! | ||
| 143 | 557 | cairo_surface_set_device_scale (buffer_surface, 1, 1); | ||
| 144 | 556 | gdk_flush (); | 558 | gdk_flush (); |
| 145 | 557 | 559 | ||
| 146 | 558 | /* Handle failure */ | 560 | /* Handle failure */ |
| 147 | 559 | 561 | ||
| 148 | === added file 'gtk/window-decorator/metacity.c.OTHER' | |||
| 149 | --- gtk/window-decorator/metacity.c.OTHER 1970-01-01 00:00:00 +0000 | |||
| 150 | +++ gtk/window-decorator/metacity.c.OTHER 2018-02-20 17:39:33 +0000 | |||
| 151 | @@ -0,0 +1,1555 @@ | |||
| 152 | 1 | /* | ||
| 153 | 2 | * Copyright © 2006 Novell, Inc. | ||
| 154 | 3 | * | ||
| 155 | 4 | * This library is free software; you can redistribute it and/or | ||
| 156 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
| 157 | 6 | * License as published by the Free Software Foundation; either | ||
| 158 | 7 | * version 2 of the License, or (at your option) any later version. | ||
| 159 | 8 | * | ||
| 160 | 9 | * This library is distributed in the hope that it will be useful, | ||
| 161 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 162 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 163 | 12 | * Lesser General Public License for more details. | ||
| 164 | 13 | * | ||
| 165 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
| 166 | 15 | * License along with this library; if not, write to the | ||
| 167 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 168 | 17 | * Boston, MA 02111-1307, USA. | ||
| 169 | 18 | * | ||
| 170 | 19 | * Author: David Reveman <davidr@novell.com> | ||
| 171 | 20 | * | ||
| 172 | 21 | * 2D Mode: Copyright © 2010 Sam Spilsbury <smspillaz@gmail.com> | ||
| 173 | 22 | * Frames Management: Copright © 2011 Canonical Ltd. | ||
| 174 | 23 | * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> | ||
| 175 | 24 | */ | ||
| 176 | 25 | |||
| 177 | 26 | #include "gtk-window-decorator.h" | ||
| 178 | 27 | |||
| 179 | 28 | #ifdef USE_METACITY | ||
| 180 | 29 | |||
| 181 | 30 | MetaButtonLayout meta_button_layout; | ||
| 182 | 31 | |||
| 183 | 32 | static gboolean | ||
| 184 | 33 | meta_button_present (MetaButtonLayout *button_layout, | ||
| 185 | 34 | MetaButtonFunction function) | ||
| 186 | 35 | { | ||
| 187 | 36 | int i; | ||
| 188 | 37 | |||
| 189 | 38 | for (i = 0; i < MAX_BUTTONS_PER_CORNER; ++i) | ||
| 190 | 39 | if (button_layout->left_buttons[i] == function) | ||
| 191 | 40 | return TRUE; | ||
| 192 | 41 | |||
| 193 | 42 | for (i = 0; i < MAX_BUTTONS_PER_CORNER; ++i) | ||
| 194 | 43 | if (button_layout->right_buttons[i] == function) | ||
| 195 | 44 | return TRUE; | ||
| 196 | 45 | |||
| 197 | 46 | return FALSE; | ||
| 198 | 47 | } | ||
| 199 | 48 | |||
| 200 | 49 | static void | ||
| 201 | 50 | decor_update_meta_window_property (decor_t *d, | ||
| 202 | 51 | MetaTheme *theme, | ||
| 203 | 52 | MetaFrameFlags flags, | ||
| 204 | 53 | MetaFrameType type, | ||
| 205 | 54 | Region top, | ||
| 206 | 55 | Region bottom, | ||
| 207 | 56 | Region left, | ||
| 208 | 57 | Region right) | ||
| 209 | 58 | { | ||
| 210 | 59 | long *data; | ||
| 211 | 60 | GdkDisplay *display; | ||
| 212 | 61 | Display *xdisplay; | ||
| 213 | 62 | gint nQuad; | ||
| 214 | 63 | decor_extents_t win_extents; | ||
| 215 | 64 | decor_extents_t frame_win_extents; | ||
| 216 | 65 | decor_extents_t max_win_extents; | ||
| 217 | 66 | decor_extents_t frame_max_win_extents; | ||
| 218 | 67 | decor_quad_t quads[N_QUADS_MAX]; | ||
| 219 | 68 | unsigned int nOffset; | ||
| 220 | 69 | unsigned int frame_type; | ||
| 221 | 70 | unsigned int frame_state; | ||
| 222 | 71 | unsigned int frame_actions; | ||
| 223 | 72 | gint w; | ||
| 224 | 73 | gint lh; | ||
| 225 | 74 | gint rh; | ||
| 226 | 75 | gint top_stretch_offset; | ||
| 227 | 76 | gint bottom_stretch_offset; | ||
| 228 | 77 | gint left_stretch_offset; | ||
| 229 | 78 | gint right_stretch_offset; | ||
| 230 | 79 | |||
| 231 | 80 | display = gdk_display_get_default (); | ||
| 232 | 81 | xdisplay = gdk_x11_display_get_xdisplay (display); | ||
| 233 | 82 | |||
| 234 | 83 | nOffset = 1; | ||
| 235 | 84 | |||
| 236 | 85 | frame_type = populate_frame_type (d); | ||
| 237 | 86 | frame_state = populate_frame_state (d); | ||
| 238 | 87 | frame_actions = populate_frame_actions (d); | ||
| 239 | 88 | |||
| 240 | 89 | win_extents = frame_win_extents = d->frame->win_extents; | ||
| 241 | 90 | max_win_extents = frame_max_win_extents = d->frame->max_win_extents; | ||
| 242 | 91 | |||
| 243 | 92 | /* Add the invisible grab area padding, but only for | ||
| 244 | 93 | * pixmap type decorations */ | ||
| 245 | 94 | if (!d->frame_window) | ||
| 246 | 95 | { | ||
| 247 | 96 | GdkScreen *screen; | ||
| 248 | 97 | MetaStyleInfo *style_info; | ||
| 249 | 98 | MetaFrameBorders borders; | ||
| 250 | 99 | |||
| 251 | 100 | screen = gtk_widget_get_screen (d->frame->style_window_rgba); | ||
| 252 | 101 | style_info = meta_theme_create_style_info (screen, d->gtk_theme_variant); | ||
| 253 | 102 | |||
| 254 | 103 | meta_theme_get_frame_borders (theme, style_info, type, | ||
| 255 | 104 | d->frame->text_height, | ||
| 256 | 105 | flags, &borders); | ||
| 257 | 106 | |||
| 258 | 107 | if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) | ||
| 259 | 108 | { | ||
| 260 | 109 | frame_win_extents.left += borders.invisible.left; | ||
| 261 | 110 | frame_win_extents.right += borders.invisible.right; | ||
| 262 | 111 | frame_max_win_extents.left += borders.invisible.left; | ||
| 263 | 112 | frame_max_win_extents.right += borders.invisible.right; | ||
| 264 | 113 | } | ||
| 265 | 114 | |||
| 266 | 115 | if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) | ||
| 267 | 116 | { | ||
| 268 | 117 | frame_win_extents.bottom += borders.invisible.bottom; | ||
| 269 | 118 | frame_win_extents.top += borders.invisible.top; | ||
| 270 | 119 | frame_max_win_extents.bottom += borders.invisible.bottom; | ||
| 271 | 120 | frame_max_win_extents.top += borders.invisible.top; | ||
| 272 | 121 | } | ||
| 273 | 122 | |||
| 274 | 123 | meta_style_info_unref (style_info); | ||
| 275 | 124 | } | ||
| 276 | 125 | |||
| 277 | 126 | w = d->border_layout.top.x2 - d->border_layout.top.x1 - | ||
| 278 | 127 | d->context->left_space - d->context->right_space; | ||
| 279 | 128 | |||
| 280 | 129 | if (d->border_layout.rotation) | ||
| 281 | 130 | lh = d->border_layout.left.x2 - d->border_layout.left.x1; | ||
| 282 | 131 | else | ||
| 283 | 132 | lh = d->border_layout.left.y2 - d->border_layout.left.y1; | ||
| 284 | 133 | |||
| 285 | 134 | if (d->border_layout.rotation) | ||
| 286 | 135 | rh = d->border_layout.right.x2 - d->border_layout.right.x1; | ||
| 287 | 136 | else | ||
| 288 | 137 | rh = d->border_layout.right.y2 - d->border_layout.right.y1; | ||
| 289 | 138 | |||
| 290 | 139 | left_stretch_offset = lh / 2; | ||
| 291 | 140 | right_stretch_offset = rh / 2; | ||
| 292 | 141 | top_stretch_offset = w - d->button_width - 1; | ||
| 293 | 142 | bottom_stretch_offset = (d->border_layout.bottom.x2 - d->border_layout.bottom.x1 - | ||
| 294 | 143 | d->context->left_space - d->context->right_space) / 2; | ||
| 295 | 144 | |||
| 296 | 145 | nQuad = decor_set_lXrXtXbX_window_quads (quads, d->context, &d->border_layout, | ||
| 297 | 146 | left_stretch_offset, right_stretch_offset, | ||
| 298 | 147 | top_stretch_offset, bottom_stretch_offset); | ||
| 299 | 148 | |||
| 300 | 149 | win_extents.top += d->frame->titlebar_height; | ||
| 301 | 150 | frame_win_extents.top += d->frame->titlebar_height; | ||
| 302 | 151 | max_win_extents.top += d->frame->max_titlebar_height; | ||
| 303 | 152 | frame_max_win_extents.top += d->frame->max_titlebar_height; | ||
| 304 | 153 | |||
| 305 | 154 | if (d->frame_window) | ||
| 306 | 155 | { | ||
| 307 | 156 | data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_WINDOW); | ||
| 308 | 157 | decor_gen_window_property (data, nOffset - 1, &win_extents, &max_win_extents, | ||
| 309 | 158 | 20, 20, frame_type, frame_state, frame_actions); | ||
| 310 | 159 | } | ||
| 311 | 160 | else | ||
| 312 | 161 | { | ||
| 313 | 162 | data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP); | ||
| 314 | 163 | decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface), | ||
| 315 | 164 | &frame_win_extents, &win_extents, | ||
| 316 | 165 | &frame_max_win_extents, &max_win_extents, | ||
| 317 | 166 | ICON_SPACE + d->button_width, | ||
| 318 | 167 | 0, quads, nQuad, frame_type, frame_state, frame_actions); | ||
| 319 | 168 | } | ||
| 320 | 169 | |||
| 321 | 170 | gdk_error_trap_push (); | ||
| 322 | 171 | |||
| 323 | 172 | XChangeProperty (xdisplay, d->prop_xid, win_decor_atom, XA_INTEGER, | ||
| 324 | 173 | 32, PropModeReplace, (guchar *) data, | ||
| 325 | 174 | PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX); | ||
| 326 | 175 | gdk_display_sync (display); | ||
| 327 | 176 | |||
| 328 | 177 | gdk_error_trap_pop_ignored (); | ||
| 329 | 178 | |||
| 330 | 179 | free (data); | ||
| 331 | 180 | |||
| 332 | 181 | decor_update_blur_property (d, w, lh, | ||
| 333 | 182 | top, top_stretch_offset, | ||
| 334 | 183 | bottom, bottom_stretch_offset, | ||
| 335 | 184 | left, left_stretch_offset, | ||
| 336 | 185 | right, right_stretch_offset); | ||
| 337 | 186 | } | ||
| 338 | 187 | |||
| 339 | 188 | static void | ||
| 340 | 189 | meta_get_corner_radius (const MetaFrameGeometry *fgeom, | ||
| 341 | 190 | int *top_left_radius, | ||
| 342 | 191 | int *top_right_radius, | ||
| 343 | 192 | int *bottom_left_radius, | ||
| 344 | 193 | int *bottom_right_radius) | ||
| 345 | 194 | { | ||
| 346 | 195 | *top_left_radius = fgeom->top_left_corner_rounded_radius; | ||
| 347 | 196 | *top_right_radius = fgeom->top_right_corner_rounded_radius; | ||
| 348 | 197 | *bottom_left_radius = fgeom->bottom_left_corner_rounded_radius; | ||
| 349 | 198 | *bottom_right_radius = fgeom->bottom_right_corner_rounded_radius; | ||
| 350 | 199 | } | ||
| 351 | 200 | |||
| 352 | 201 | static int | ||
| 353 | 202 | radius_to_width (int radius, | ||
| 354 | 203 | int i) | ||
| 355 | 204 | { | ||
| 356 | 205 | float r1 = sqrt (radius) + radius; | ||
| 357 | 206 | float r2 = r1 * r1 - (r1 - (i + 0.5)) * (r1 - (i + 0.5)); | ||
| 358 | 207 | |||
| 359 | 208 | return floor (0.5f + r1 - sqrt (r2)); | ||
| 360 | 209 | } | ||
| 361 | 210 | |||
| 362 | 211 | static Region | ||
| 363 | 212 | meta_get_top_border_region (const MetaFrameGeometry *fgeom, | ||
| 364 | 213 | int width) | ||
| 365 | 214 | { | ||
| 366 | 215 | Region corners_xregion; | ||
| 367 | 216 | Region border_xregion; | ||
| 368 | 217 | XRectangle xrect; | ||
| 369 | 218 | int top_left_radius; | ||
| 370 | 219 | int top_right_radius; | ||
| 371 | 220 | int bottom_left_radius; | ||
| 372 | 221 | int bottom_right_radius; | ||
| 373 | 222 | int w; | ||
| 374 | 223 | int i; | ||
| 375 | 224 | int height; | ||
| 376 | 225 | |||
| 377 | 226 | corners_xregion = XCreateRegion (); | ||
| 378 | 227 | |||
| 379 | 228 | meta_get_corner_radius (fgeom, &top_left_radius, &top_right_radius, | ||
| 380 | 229 | &bottom_left_radius, &bottom_right_radius); | ||
| 381 | 230 | |||
| 382 | 231 | width = width - fgeom->borders.invisible.left - fgeom->borders.invisible.right; | ||
| 383 | 232 | height = fgeom->borders.visible.top; | ||
| 384 | 233 | |||
| 385 | 234 | if (top_left_radius) | ||
| 386 | 235 | { | ||
| 387 | 236 | for (i = 0; i < top_left_radius; ++i) | ||
| 388 | 237 | { | ||
| 389 | 238 | w = radius_to_width (top_left_radius, i); | ||
| 390 | 239 | |||
| 391 | 240 | xrect.x = 0; | ||
| 392 | 241 | xrect.y = i; | ||
| 393 | 242 | xrect.width = w; | ||
| 394 | 243 | xrect.height = 1; | ||
| 395 | 244 | |||
| 396 | 245 | XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); | ||
| 397 | 246 | } | ||
| 398 | 247 | } | ||
| 399 | 248 | |||
| 400 | 249 | if (top_right_radius) | ||
| 401 | 250 | { | ||
| 402 | 251 | for (i = 0; i < top_right_radius; ++i) | ||
| 403 | 252 | { | ||
| 404 | 253 | w = radius_to_width (top_right_radius, i); | ||
| 405 | 254 | |||
| 406 | 255 | xrect.x = width - w; | ||
| 407 | 256 | xrect.y = i; | ||
| 408 | 257 | xrect.width = w; | ||
| 409 | 258 | xrect.height = 1; | ||
| 410 | 259 | |||
| 411 | 260 | XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); | ||
| 412 | 261 | } | ||
| 413 | 262 | } | ||
| 414 | 263 | |||
| 415 | 264 | border_xregion = XCreateRegion (); | ||
| 416 | 265 | |||
| 417 | 266 | xrect.x = 0; | ||
| 418 | 267 | xrect.y = 0; | ||
| 419 | 268 | xrect.width = width; | ||
| 420 | 269 | xrect.height = height; | ||
| 421 | 270 | |||
| 422 | 271 | XUnionRectWithRegion (&xrect, border_xregion, border_xregion); | ||
| 423 | 272 | |||
| 424 | 273 | XSubtractRegion (border_xregion, corners_xregion, border_xregion); | ||
| 425 | 274 | |||
| 426 | 275 | XDestroyRegion (corners_xregion); | ||
| 427 | 276 | |||
| 428 | 277 | return border_xregion; | ||
| 429 | 278 | } | ||
| 430 | 279 | |||
| 431 | 280 | static Region | ||
| 432 | 281 | meta_get_bottom_border_region (const MetaFrameGeometry *fgeom, | ||
| 433 | 282 | int width) | ||
| 434 | 283 | { | ||
| 435 | 284 | Region corners_xregion; | ||
| 436 | 285 | Region border_xregion; | ||
| 437 | 286 | XRectangle xrect; | ||
| 438 | 287 | int top_left_radius; | ||
| 439 | 288 | int top_right_radius; | ||
| 440 | 289 | int bottom_left_radius; | ||
| 441 | 290 | int bottom_right_radius; | ||
| 442 | 291 | int w; | ||
| 443 | 292 | int i; | ||
| 444 | 293 | int height; | ||
| 445 | 294 | |||
| 446 | 295 | corners_xregion = XCreateRegion (); | ||
| 447 | 296 | |||
| 448 | 297 | meta_get_corner_radius (fgeom, &top_left_radius, &top_right_radius, | ||
| 449 | 298 | &bottom_left_radius, &bottom_right_radius); | ||
| 450 | 299 | |||
| 451 | 300 | width = width - fgeom->borders.invisible.left - fgeom->borders.invisible.right; | ||
| 452 | 301 | height = fgeom->borders.visible.bottom; | ||
| 453 | 302 | |||
| 454 | 303 | if (bottom_left_radius) | ||
| 455 | 304 | { | ||
| 456 | 305 | for (i = 0; i < bottom_left_radius; ++i) | ||
| 457 | 306 | { | ||
| 458 | 307 | w = radius_to_width (bottom_left_radius, i); | ||
| 459 | 308 | |||
| 460 | 309 | xrect.x = 0; | ||
| 461 | 310 | xrect.y = height - i - 1; | ||
| 462 | 311 | xrect.width = w; | ||
| 463 | 312 | xrect.height = 1; | ||
| 464 | 313 | |||
| 465 | 314 | XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); | ||
| 466 | 315 | } | ||
| 467 | 316 | } | ||
| 468 | 317 | |||
| 469 | 318 | if (bottom_right_radius) | ||
| 470 | 319 | { | ||
| 471 | 320 | for (i = 0; i < bottom_right_radius; ++i) | ||
| 472 | 321 | { | ||
| 473 | 322 | w = radius_to_width (bottom_right_radius, i); | ||
| 474 | 323 | |||
| 475 | 324 | xrect.x = width - w; | ||
| 476 | 325 | xrect.y = height - i - 1; | ||
| 477 | 326 | xrect.width = w; | ||
| 478 | 327 | xrect.height = 1; | ||
| 479 | 328 | |||
| 480 | 329 | XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); | ||
| 481 | 330 | } | ||
| 482 | 331 | } | ||
| 483 | 332 | |||
| 484 | 333 | border_xregion = XCreateRegion (); | ||
| 485 | 334 | |||
| 486 | 335 | xrect.x = 0; | ||
| 487 | 336 | xrect.y = 0; | ||
| 488 | 337 | xrect.width = width; | ||
| 489 | 338 | xrect.height = height; | ||
| 490 | 339 | |||
| 491 | 340 | XUnionRectWithRegion (&xrect, border_xregion, border_xregion); | ||
| 492 | 341 | |||
| 493 | 342 | XSubtractRegion (border_xregion, corners_xregion, border_xregion); | ||
| 494 | 343 | |||
| 495 | 344 | XDestroyRegion (corners_xregion); | ||
| 496 | 345 | |||
| 497 | 346 | return border_xregion; | ||
| 498 | 347 | } | ||
| 499 | 348 | |||
| 500 | 349 | static Region | ||
| 501 | 350 | meta_get_left_border_region (const MetaFrameGeometry *fgeom, | ||
| 502 | 351 | int height) | ||
| 503 | 352 | { | ||
| 504 | 353 | Region border_xregion; | ||
| 505 | 354 | XRectangle xrect; | ||
| 506 | 355 | |||
| 507 | 356 | border_xregion = XCreateRegion (); | ||
| 508 | 357 | |||
| 509 | 358 | xrect.x = 0; | ||
| 510 | 359 | xrect.y = 0; | ||
| 511 | 360 | xrect.width = fgeom->borders.visible.left; | ||
| 512 | 361 | xrect.height = height - fgeom->borders.total.top - fgeom->borders.total.bottom; | ||
| 513 | 362 | |||
| 514 | 363 | XUnionRectWithRegion (&xrect, border_xregion, border_xregion); | ||
| 515 | 364 | |||
| 516 | 365 | return border_xregion; | ||
| 517 | 366 | } | ||
| 518 | 367 | |||
| 519 | 368 | static Region | ||
| 520 | 369 | meta_get_right_border_region (const MetaFrameGeometry *fgeom, | ||
| 521 | 370 | int height) | ||
| 522 | 371 | { | ||
| 523 | 372 | Region border_xregion; | ||
| 524 | 373 | XRectangle xrect; | ||
| 525 | 374 | |||
| 526 | 375 | border_xregion = XCreateRegion (); | ||
| 527 | 376 | |||
| 528 | 377 | xrect.x = 0; | ||
| 529 | 378 | xrect.y = 0; | ||
| 530 | 379 | xrect.width = fgeom->borders.visible.right; | ||
| 531 | 380 | xrect.height = height - fgeom->borders.total.top - fgeom->borders.total.bottom; | ||
| 532 | 381 | |||
| 533 | 382 | XUnionRectWithRegion (&xrect, border_xregion, border_xregion); | ||
| 534 | 383 | |||
| 535 | 384 | return border_xregion; | ||
| 536 | 385 | } | ||
| 537 | 386 | |||
| 538 | 387 | static MetaButtonState | ||
| 539 | 388 | meta_button_state (int state) | ||
| 540 | 389 | { | ||
| 541 | 390 | if (state & IN_EVENT_WINDOW) | ||
| 542 | 391 | { | ||
| 543 | 392 | if (state & PRESSED_EVENT_WINDOW) | ||
| 544 | 393 | return META_BUTTON_STATE_PRESSED; | ||
| 545 | 394 | |||
| 546 | 395 | return META_BUTTON_STATE_PRELIGHT; | ||
| 547 | 396 | } | ||
| 548 | 397 | |||
| 549 | 398 | return META_BUTTON_STATE_NORMAL; | ||
| 550 | 399 | } | ||
| 551 | 400 | |||
| 552 | 401 | static MetaButtonType | ||
| 553 | 402 | meta_function_to_type (MetaButtonFunction function) | ||
| 554 | 403 | { | ||
| 555 | 404 | switch (function) | ||
| 556 | 405 | { | ||
| 557 | 406 | case META_BUTTON_FUNCTION_MENU: | ||
| 558 | 407 | return META_BUTTON_TYPE_MENU; | ||
| 559 | 408 | case META_BUTTON_FUNCTION_MINIMIZE: | ||
| 560 | 409 | return META_BUTTON_TYPE_MINIMIZE; | ||
| 561 | 410 | case META_BUTTON_FUNCTION_MAXIMIZE: | ||
| 562 | 411 | return META_BUTTON_TYPE_MAXIMIZE; | ||
| 563 | 412 | case META_BUTTON_FUNCTION_CLOSE: | ||
| 564 | 413 | return META_BUTTON_TYPE_CLOSE; | ||
| 565 | 414 | case META_BUTTON_FUNCTION_SHADE: | ||
| 566 | 415 | return META_BUTTON_TYPE_SHADE; | ||
| 567 | 416 | case META_BUTTON_FUNCTION_ABOVE: | ||
| 568 | 417 | return META_BUTTON_TYPE_ABOVE; | ||
| 569 | 418 | case META_BUTTON_FUNCTION_STICK: | ||
| 570 | 419 | return META_BUTTON_TYPE_STICK; | ||
| 571 | 420 | case META_BUTTON_FUNCTION_UNSHADE: | ||
| 572 | 421 | return META_BUTTON_TYPE_UNSHADE; | ||
| 573 | 422 | case META_BUTTON_FUNCTION_UNABOVE: | ||
| 574 | 423 | return META_BUTTON_TYPE_UNABOVE; | ||
| 575 | 424 | case META_BUTTON_FUNCTION_UNSTICK: | ||
| 576 | 425 | return META_BUTTON_TYPE_UNSTICK; | ||
| 577 | 426 | default: | ||
| 578 | 427 | break; | ||
| 579 | 428 | } | ||
| 580 | 429 | |||
| 581 | 430 | return META_BUTTON_TYPE_LAST; | ||
| 582 | 431 | } | ||
| 583 | 432 | |||
| 584 | 433 | static MetaButtonState | ||
| 585 | 434 | meta_button_state_for_button_type (decor_t *d, | ||
| 586 | 435 | MetaButtonType type) | ||
| 587 | 436 | { | ||
| 588 | 437 | switch (type) | ||
| 589 | 438 | { | ||
| 590 | 439 | case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND: | ||
| 591 | 440 | type = meta_function_to_type (meta_button_layout.left_buttons[0]); | ||
| 592 | 441 | break; | ||
| 593 | 442 | case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND: | ||
| 594 | 443 | type = meta_function_to_type (meta_button_layout.left_buttons[1]); | ||
| 595 | 444 | break; | ||
| 596 | 445 | case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND: | ||
| 597 | 446 | type = meta_function_to_type (meta_button_layout.left_buttons[2]); | ||
| 598 | 447 | break; | ||
| 599 | 448 | case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND: | ||
| 600 | 449 | type = meta_function_to_type (meta_button_layout.right_buttons[0]); | ||
| 601 | 450 | break; | ||
| 602 | 451 | case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND: | ||
| 603 | 452 | type = meta_function_to_type (meta_button_layout.right_buttons[1]); | ||
| 604 | 453 | break; | ||
| 605 | 454 | case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND: | ||
| 606 | 455 | type = meta_function_to_type (meta_button_layout.right_buttons[2]); | ||
| 607 | 456 | default: | ||
| 608 | 457 | break; | ||
| 609 | 458 | } | ||
| 610 | 459 | |||
| 611 | 460 | switch (type) | ||
| 612 | 461 | { | ||
| 613 | 462 | case META_BUTTON_TYPE_CLOSE: | ||
| 614 | 463 | return meta_button_state (d->button_states[BUTTON_CLOSE]); | ||
| 615 | 464 | case META_BUTTON_TYPE_MAXIMIZE: | ||
| 616 | 465 | return meta_button_state (d->button_states[BUTTON_MAX]); | ||
| 617 | 466 | case META_BUTTON_TYPE_MINIMIZE: | ||
| 618 | 467 | return meta_button_state (d->button_states[BUTTON_MIN]); | ||
| 619 | 468 | case META_BUTTON_TYPE_MENU: | ||
| 620 | 469 | return meta_button_state (d->button_states[BUTTON_MENU]); | ||
| 621 | 470 | case META_BUTTON_TYPE_SHADE: | ||
| 622 | 471 | return meta_button_state (d->button_states[BUTTON_SHADE]); | ||
| 623 | 472 | case META_BUTTON_TYPE_ABOVE: | ||
| 624 | 473 | return meta_button_state (d->button_states[BUTTON_ABOVE]); | ||
| 625 | 474 | case META_BUTTON_TYPE_STICK: | ||
| 626 | 475 | return meta_button_state (d->button_states[BUTTON_STICK]); | ||
| 627 | 476 | case META_BUTTON_TYPE_UNSHADE: | ||
| 628 | 477 | return meta_button_state (d->button_states[BUTTON_UNSHADE]); | ||
| 629 | 478 | case META_BUTTON_TYPE_UNABOVE: | ||
| 630 | 479 | return meta_button_state (d->button_states[BUTTON_UNABOVE]); | ||
| 631 | 480 | case META_BUTTON_TYPE_UNSTICK: | ||
| 632 | 481 | return meta_button_state (d->button_states[BUTTON_UNSTICK]); | ||
| 633 | 482 | default: | ||
| 634 | 483 | break; | ||
| 635 | 484 | } | ||
| 636 | 485 | |||
| 637 | 486 | return META_BUTTON_STATE_NORMAL; | ||
| 638 | 487 | } | ||
| 639 | 488 | |||
| 640 | 489 | static void | ||
| 641 | 490 | meta_get_decoration_geometry (decor_t *d, | ||
| 642 | 491 | MetaTheme *theme, | ||
| 643 | 492 | MetaFrameFlags *flags, | ||
| 644 | 493 | MetaFrameGeometry *fgeom, | ||
| 645 | 494 | MetaButtonLayout *button_layout, | ||
| 646 | 495 | MetaFrameType frame_type) | ||
| 647 | 496 | { | ||
| 648 | 497 | GdkScreen *screen; | ||
| 649 | 498 | MetaStyleInfo *style_info; | ||
| 650 | 499 | gint client_width; | ||
| 651 | 500 | gint client_height; | ||
| 652 | 501 | |||
| 653 | 502 | if (!(frame_type < META_FRAME_TYPE_LAST)) | ||
| 654 | 503 | frame_type = META_FRAME_TYPE_NORMAL; | ||
| 655 | 504 | |||
| 656 | 505 | if (meta_button_layout_set) | ||
| 657 | 506 | { | ||
| 658 | 507 | *button_layout = meta_button_layout; | ||
| 659 | 508 | } | ||
| 660 | 509 | else | ||
| 661 | 510 | { | ||
| 662 | 511 | gint i; | ||
| 663 | 512 | |||
| 664 | 513 | button_layout->left_buttons[0] = META_BUTTON_FUNCTION_MENU; | ||
| 665 | 514 | |||
| 666 | 515 | for (i = 1; i < MAX_BUTTONS_PER_CORNER; ++i) | ||
| 667 | 516 | button_layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST; | ||
| 668 | 517 | |||
| 669 | 518 | button_layout->right_buttons[0] = META_BUTTON_FUNCTION_MINIMIZE; | ||
| 670 | 519 | button_layout->right_buttons[1] = META_BUTTON_FUNCTION_MAXIMIZE; | ||
| 671 | 520 | button_layout->right_buttons[2] = META_BUTTON_FUNCTION_CLOSE; | ||
| 672 | 521 | |||
| 673 | 522 | for (i = 3; i < MAX_BUTTONS_PER_CORNER; ++i) | ||
| 674 | 523 | button_layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST; | ||
| 675 | 524 | } | ||
| 676 | 525 | |||
| 677 | 526 | *flags = 0; | ||
| 678 | 527 | |||
| 679 | 528 | if (d->actions & WNCK_WINDOW_ACTION_CLOSE) | ||
| 680 | 529 | *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_DELETE; | ||
| 681 | 530 | |||
| 682 | 531 | if (d->actions & WNCK_WINDOW_ACTION_MINIMIZE) | ||
| 683 | 532 | *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MINIMIZE; | ||
| 684 | 533 | |||
| 685 | 534 | if (d->actions & WNCK_WINDOW_ACTION_MAXIMIZE) | ||
| 686 | 535 | *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MAXIMIZE; | ||
| 687 | 536 | |||
| 688 | 537 | *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MENU; | ||
| 689 | 538 | |||
| 690 | 539 | if (d->actions & WNCK_WINDOW_ACTION_RESIZE) | ||
| 691 | 540 | { | ||
| 692 | 541 | if (!(d->state & WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY)) | ||
| 693 | 542 | *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_VERTICAL_RESIZE; | ||
| 694 | 543 | if (!(d->state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY)) | ||
| 695 | 544 | *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_HORIZONTAL_RESIZE; | ||
| 696 | 545 | } | ||
| 697 | 546 | |||
| 698 | 547 | if (d->actions & WNCK_WINDOW_ACTION_MOVE) | ||
| 699 | 548 | *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MOVE; | ||
| 700 | 549 | |||
| 701 | 550 | if (d->actions & WNCK_WINDOW_ACTION_MAXIMIZE) | ||
| 702 | 551 | *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MAXIMIZE; | ||
| 703 | 552 | |||
| 704 | 553 | if (d->actions & WNCK_WINDOW_ACTION_SHADE) | ||
| 705 | 554 | *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_SHADE; | ||
| 706 | 555 | |||
| 707 | 556 | if (d->active) | ||
| 708 | 557 | *flags |= (MetaFrameFlags ) META_FRAME_HAS_FOCUS; | ||
| 709 | 558 | |||
| 710 | 559 | if ((d->state & META_MAXIMIZED) == META_MAXIMIZED) | ||
| 711 | 560 | *flags |= (MetaFrameFlags ) META_FRAME_MAXIMIZED; | ||
| 712 | 561 | |||
| 713 | 562 | if (d->state & WNCK_WINDOW_STATE_STICKY) | ||
| 714 | 563 | *flags |= (MetaFrameFlags ) META_FRAME_STUCK; | ||
| 715 | 564 | |||
| 716 | 565 | if (d->state & WNCK_WINDOW_STATE_FULLSCREEN) | ||
| 717 | 566 | *flags |= (MetaFrameFlags ) META_FRAME_FULLSCREEN; | ||
| 718 | 567 | |||
| 719 | 568 | if (d->state & WNCK_WINDOW_STATE_SHADED) | ||
| 720 | 569 | *flags |= (MetaFrameFlags ) META_FRAME_SHADED; | ||
| 721 | 570 | |||
| 722 | 571 | if (d->state & WNCK_WINDOW_STATE_ABOVE) | ||
| 723 | 572 | *flags |= (MetaFrameFlags ) META_FRAME_ABOVE; | ||
| 724 | 573 | |||
| 725 | 574 | client_width = d->border_layout.top.x2 - d->border_layout.top.x1; | ||
| 726 | 575 | client_width -= d->context->right_space + d->context->left_space; | ||
| 727 | 576 | |||
| 728 | 577 | if (d->border_layout.rotation) | ||
| 729 | 578 | client_height = d->border_layout.left.x2 - d->border_layout.left.x1; | ||
| 730 | 579 | else | ||
| 731 | 580 | client_height = d->border_layout.left.y2 - d->border_layout.left.y1; | ||
| 732 | 581 | |||
| 733 | 582 | screen = gtk_widget_get_screen (d->frame->style_window_rgba); | ||
| 734 | 583 | style_info = meta_theme_create_style_info (screen, d->gtk_theme_variant); | ||
| 735 | 584 | |||
| 736 | 585 | meta_theme_calc_geometry (theme, style_info, frame_type, d->frame->text_height, | ||
| 737 | 586 | *flags, client_width, client_height, | ||
| 738 | 587 | button_layout, fgeom); | ||
| 739 | 588 | |||
| 740 | 589 | meta_style_info_unref (style_info); | ||
| 741 | 590 | } | ||
| 742 | 591 | |||
| 743 | 592 | void | ||
| 744 | 593 | meta_draw_window_decoration (decor_t *d) | ||
| 745 | 594 | { | ||
| 746 | 595 | GdkDisplay *display; | ||
| 747 | 596 | GdkScreen *screen; | ||
| 748 | 597 | Display *xdisplay; | ||
| 749 | 598 | cairo_surface_t *surface; | ||
| 750 | 599 | Picture src; | ||
| 751 | 600 | MetaButtonState button_states [META_BUTTON_TYPE_LAST]; | ||
| 752 | 601 | MetaButtonLayout button_layout; | ||
| 753 | 602 | MetaFrameGeometry fgeom; | ||
| 754 | 603 | MetaFrameFlags flags; | ||
| 755 | 604 | MetaFrameType frame_type; | ||
| 756 | 605 | MetaTheme *theme; | ||
| 757 | 606 | MetaStyleInfo *style_info; | ||
| 758 | 607 | GtkStyleContext *context; | ||
| 759 | 608 | cairo_t *cr; | ||
| 760 | 609 | gint i; | ||
| 761 | 610 | Region top_region; | ||
| 762 | 611 | Region bottom_region; | ||
| 763 | 612 | Region left_region; | ||
| 764 | 613 | Region right_region; | ||
| 765 | 614 | gdouble meta_active_opacity; | ||
| 766 | 615 | gdouble meta_inactive_opacity; | ||
| 767 | 616 | gboolean meta_active_shade_opacity; | ||
| 768 | 617 | gboolean meta_inactive_shade_opacity; | ||
| 769 | 618 | double alpha; | ||
| 770 | 619 | gboolean shade_alpha; | ||
| 771 | 620 | MetaFrameStyle *frame_style; | ||
| 772 | 621 | GtkWidget *style_window; | ||
| 773 | 622 | GdkRGBA bg_rgba; | ||
| 774 | 623 | |||
| 775 | 624 | if (!d->surface || !d->picture) | ||
| 776 | 625 | return; | ||
| 777 | 626 | |||
| 778 | 627 | display = gdk_display_get_default (); | ||
| 779 | 628 | xdisplay = gdk_x11_display_get_xdisplay (display); | ||
| 780 | 629 | |||
| 781 | 630 | top_region = NULL; | ||
| 782 | 631 | bottom_region = NULL; | ||
| 783 | 632 | left_region = NULL; | ||
| 784 | 633 | right_region = NULL; | ||
| 785 | 634 | |||
| 786 | 635 | g_object_get (settings, "metacity-active-opacity", &meta_active_opacity, NULL); | ||
| 787 | 636 | g_object_get (settings, "metacity-inactive-opacity", &meta_inactive_opacity, NULL); | ||
| 788 | 637 | g_object_get (settings, "metacity-active-shade-opacity", &meta_active_shade_opacity, NULL); | ||
| 789 | 638 | g_object_get (settings, "metacity-inactive-shade-opacity", &meta_inactive_shade_opacity, NULL); | ||
| 790 | 639 | |||
| 791 | 640 | alpha = (d->active) ? meta_active_opacity : meta_inactive_opacity; | ||
| 792 | 641 | shade_alpha = (d->active) ? meta_active_shade_opacity : meta_inactive_shade_opacity; | ||
| 793 | 642 | |||
| 794 | 643 | if (decoration_alpha == 1.0) | ||
| 795 | 644 | alpha = 1.0; | ||
| 796 | 645 | |||
| 797 | 646 | if (cairo_xlib_surface_get_depth (d->surface) == 32) | ||
| 798 | 647 | style_window = d->frame->style_window_rgba; | ||
| 799 | 648 | else | ||
| 800 | 649 | style_window = d->frame->style_window_rgb; | ||
| 801 | 650 | |||
| 802 | 651 | context = gtk_widget_get_style_context (style_window); | ||
| 803 | 652 | |||
| 804 | 653 | cr = cairo_create (d->buffer_surface ? d->buffer_surface : d->surface); | ||
| 805 | 654 | |||
| 806 | 655 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); | ||
| 807 | 656 | |||
| 808 | 657 | theme = meta_theme_get_current (); | ||
| 809 | 658 | |||
| 810 | 659 | frame_type = meta_frame_type_from_string (d->frame->type); | ||
| 811 | 660 | |||
| 812 | 661 | if (frame_type == META_FRAME_TYPE_LAST) | ||
| 813 | 662 | frame_type = META_FRAME_TYPE_NORMAL; | ||
| 814 | 663 | |||
| 815 | 664 | meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout, | ||
| 816 | 665 | frame_type); | ||
| 817 | 666 | |||
| 818 | 667 | if ((d->prop_xid || !d->buffer_surface) && !d->frame_window) | ||
| 819 | 668 | draw_shadow_background (d, cr, d->shadow, d->context); | ||
| 820 | 669 | |||
| 821 | 670 | for (i = 0; i < META_BUTTON_TYPE_LAST; ++i) | ||
| 822 | 671 | button_states[i] = meta_button_state_for_button_type (d, i); | ||
| 823 | 672 | |||
| 824 | 673 | frame_style = meta_theme_get_frame_style (theme, frame_type, flags); | ||
| 825 | 674 | |||
| 826 | 675 | gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_rgba); | ||
| 827 | 676 | bg_rgba.alpha = 1.0; | ||
| 828 | 677 | |||
| 829 | 678 | if (frame_style->window_background_color) | ||
| 830 | 679 | { | ||
| 831 | 680 | meta_color_spec_render (frame_style->window_background_color, | ||
| 832 | 681 | context, &bg_rgba); | ||
| 833 | 682 | |||
| 834 | 683 | bg_rgba.alpha = frame_style->window_background_alpha / 255.0; | ||
| 835 | 684 | } | ||
| 836 | 685 | |||
| 837 | 686 | /* Draw something that will be almost invisible to user. This is hacky way | ||
| 838 | 687 | * to fix invisible decorations. */ | ||
| 839 | 688 | cairo_set_source_rgba (cr, 0, 0, 0, 0.01); | ||
| 840 | 689 | cairo_rectangle (cr, 0, 0, 1, 1); | ||
| 841 | 690 | cairo_fill (cr); | ||
| 842 | 691 | /* ------------ */ | ||
| 843 | 692 | |||
| 844 | 693 | cairo_destroy (cr); | ||
| 845 | 694 | |||
| 846 | 695 | if (d->frame_window) | ||
| 847 | 696 | surface = create_surface (fgeom.width, fgeom.height, d->frame->style_window_rgb); | ||
| 848 | 697 | else | ||
| 849 | 698 | surface = create_surface (fgeom.width, fgeom.height, d->frame->style_window_rgba); | ||
| 850 | 699 | |||
| 851 | 700 | // FIXME: this should match the current monitor scaling! | ||
| 852 | 701 | cairo_surface_set_device_scale (surface, 1, 1); | ||
| 853 | 702 | cr = cairo_create (surface); | ||
| 854 | 703 | gdk_cairo_set_source_rgba (cr, &bg_rgba); | ||
| 855 | 704 | cairo_set_operator (cr, CAIRO_OPERATOR_OVER); | ||
| 856 | 705 | |||
| 857 | 706 | src = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (surface), | ||
| 858 | 707 | get_format_for_surface (d, surface), 0, NULL); | ||
| 859 | 708 | |||
| 860 | 709 | screen = gtk_widget_get_screen (d->frame->style_window_rgba); | ||
| 861 | 710 | style_info = meta_theme_create_style_info (screen, d->gtk_theme_variant); | ||
| 862 | 711 | |||
| 863 | 712 | cairo_paint (cr); | ||
| 864 | 713 | meta_theme_draw_frame (theme, style_info, cr, frame_type, flags, | ||
| 865 | 714 | fgeom.width - fgeom.borders.total.left - fgeom.borders.total.right, | ||
| 866 | 715 | fgeom.height - fgeom.borders.total.top - fgeom.borders.total.bottom, | ||
| 867 | 716 | d->layout, d->frame->text_height, &button_layout, | ||
| 868 | 717 | button_states, d->icon_pixbuf, NULL); | ||
| 869 | 718 | |||
| 870 | 719 | meta_style_info_unref (style_info); | ||
| 871 | 720 | |||
| 872 | 721 | if (fgeom.borders.visible.top) | ||
| 873 | 722 | { | ||
| 874 | 723 | top_region = meta_get_top_border_region (&fgeom, fgeom.width); | ||
| 875 | 724 | |||
| 876 | 725 | decor_blend_border_picture (xdisplay, d->context, src, | ||
| 877 | 726 | fgeom.borders.invisible.left, | ||
| 878 | 727 | fgeom.borders.invisible.top, | ||
| 879 | 728 | d->picture, &d->border_layout, | ||
| 880 | 729 | BORDER_TOP, top_region, | ||
| 881 | 730 | alpha * 0xffff, shade_alpha, 0); | ||
| 882 | 731 | } | ||
| 883 | 732 | |||
| 884 | 733 | if (fgeom.borders.visible.bottom) | ||
| 885 | 734 | { | ||
| 886 | 735 | bottom_region = meta_get_bottom_border_region (&fgeom, fgeom.width); | ||
| 887 | 736 | |||
| 888 | 737 | decor_blend_border_picture (xdisplay, d->context, src, | ||
| 889 | 738 | fgeom.borders.invisible.left, | ||
| 890 | 739 | fgeom.height - fgeom.borders.total.bottom, | ||
| 891 | 740 | d->picture, &d->border_layout, | ||
| 892 | 741 | BORDER_BOTTOM, bottom_region, | ||
| 893 | 742 | alpha * 0xffff, shade_alpha, 0); | ||
| 894 | 743 | } | ||
| 895 | 744 | |||
| 896 | 745 | if (fgeom.borders.visible.left) | ||
| 897 | 746 | { | ||
| 898 | 747 | left_region = meta_get_left_border_region (&fgeom, fgeom.height); | ||
| 899 | 748 | |||
| 900 | 749 | decor_blend_border_picture (xdisplay, d->context, src, | ||
| 901 | 750 | fgeom.borders.invisible.left, | ||
| 902 | 751 | fgeom.borders.total.top, | ||
| 903 | 752 | d->picture, &d->border_layout, | ||
| 904 | 753 | BORDER_LEFT, left_region, | ||
| 905 | 754 | alpha * 0xffff, shade_alpha, 0); | ||
| 906 | 755 | } | ||
| 907 | 756 | |||
| 908 | 757 | if (fgeom.borders.visible.right) | ||
| 909 | 758 | { | ||
| 910 | 759 | right_region = meta_get_right_border_region (&fgeom, fgeom.height); | ||
| 911 | 760 | |||
| 912 | 761 | decor_blend_border_picture (xdisplay, d->context, src, | ||
| 913 | 762 | fgeom.width - fgeom.borders.total.right, | ||
| 914 | 763 | fgeom.borders.total.top, | ||
| 915 | 764 | d->picture, &d->border_layout, | ||
| 916 | 765 | BORDER_RIGHT, right_region, | ||
| 917 | 766 | alpha * 0xffff, shade_alpha, 0); | ||
| 918 | 767 | } | ||
| 919 | 768 | |||
| 920 | 769 | cairo_destroy (cr); | ||
| 921 | 770 | cairo_surface_destroy (surface); | ||
| 922 | 771 | XRenderFreePicture (xdisplay, src); | ||
| 923 | 772 | |||
| 924 | 773 | copy_to_front_buffer (d); | ||
| 925 | 774 | |||
| 926 | 775 | if (d->frame_window) | ||
| 927 | 776 | { | ||
| 928 | 777 | GdkWindow *gdk_frame_window; | ||
| 929 | 778 | GdkPixbuf *pixbuf; | ||
| 930 | 779 | |||
| 931 | 780 | gdk_frame_window = gtk_widget_get_window (d->decor_window); | ||
| 932 | 781 | |||
| 933 | 782 | pixbuf = gdk_pixbuf_get_from_surface (d->surface, 0, 0, d->width, d->height); | ||
| 934 | 783 | gtk_image_set_from_pixbuf (GTK_IMAGE (d->decor_image), pixbuf); | ||
| 935 | 784 | g_object_unref (pixbuf); | ||
| 936 | 785 | |||
| 937 | 786 | gdk_window_move_resize (gdk_frame_window, | ||
| 938 | 787 | d->context->left_corner_space - 1, | ||
| 939 | 788 | d->context->top_corner_space - 1, | ||
| 940 | 789 | d->width, | ||
| 941 | 790 | d->height); | ||
| 942 | 791 | |||
| 943 | 792 | gdk_window_lower (gdk_frame_window); | ||
| 944 | 793 | } | ||
| 945 | 794 | |||
| 946 | 795 | if (d->prop_xid) | ||
| 947 | 796 | { | ||
| 948 | 797 | /* translate from frame to client window space */ | ||
| 949 | 798 | if (top_region) | ||
| 950 | 799 | XOffsetRegion (top_region, -fgeom.borders.total.left, -fgeom.borders.total.top); | ||
| 951 | 800 | if (bottom_region) | ||
| 952 | 801 | XOffsetRegion (bottom_region, -fgeom.borders.total.left, 0); | ||
| 953 | 802 | if (left_region) | ||
| 954 | 803 | XOffsetRegion (left_region, -fgeom.borders.total.left, 0); | ||
| 955 | 804 | |||
| 956 | 805 | decor_update_meta_window_property (d, theme, flags, frame_type, | ||
| 957 | 806 | top_region, bottom_region, | ||
| 958 | 807 | left_region, right_region); | ||
| 959 | 808 | |||
| 960 | 809 | d->prop_xid = 0; | ||
| 961 | 810 | } | ||
| 962 | 811 | |||
| 963 | 812 | if (top_region) | ||
| 964 | 813 | XDestroyRegion (top_region); | ||
| 965 | 814 | if (bottom_region) | ||
| 966 | 815 | XDestroyRegion (bottom_region); | ||
| 967 | 816 | if (left_region) | ||
| 968 | 817 | XDestroyRegion (left_region); | ||
| 969 | 818 | if (right_region) | ||
| 970 | 819 | XDestroyRegion (right_region); | ||
| 971 | 820 | } | ||
| 972 | 821 | |||
| 973 | 822 | static void | ||
| 974 | 823 | meta_calc_button_size (decor_t *d) | ||
| 975 | 824 | { | ||
| 976 | 825 | MetaTheme *theme; | ||
| 977 | 826 | MetaFrameType frame_type; | ||
| 978 | 827 | MetaFrameFlags flags; | ||
| 979 | 828 | MetaFrameGeometry fgeom; | ||
| 980 | 829 | MetaButtonLayout button_layout; | ||
| 981 | 830 | gint i, min_x, x, y, w, h, width; | ||
| 982 | 831 | |||
| 983 | 832 | if (!d->context) | ||
| 984 | 833 | { | ||
| 985 | 834 | d->button_width = 0; | ||
| 986 | 835 | return; | ||
| 987 | 836 | } | ||
| 988 | 837 | |||
| 989 | 838 | theme = meta_theme_get_current (); | ||
| 990 | 839 | |||
| 991 | 840 | frame_type = meta_frame_type_from_string (d->frame->type); | ||
| 992 | 841 | if (!(frame_type < META_FRAME_TYPE_LAST)) | ||
| 993 | 842 | frame_type = META_FRAME_TYPE_NORMAL; | ||
| 994 | 843 | |||
| 995 | 844 | meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout, | ||
| 996 | 845 | frame_type); | ||
| 997 | 846 | |||
| 998 | 847 | width = d->border_layout.top.x2 - d->border_layout.top.x1 - | ||
| 999 | 848 | d->context->left_space - d->context->right_space + | ||
| 1000 | 849 | fgeom.borders.total.left + fgeom.borders.total.right; | ||
| 1001 | 850 | |||
| 1002 | 851 | min_x = width; | ||
| 1003 | 852 | |||
| 1004 | 853 | for (i = 0; i < 3; ++i) | ||
| 1005 | 854 | { | ||
| 1006 | 855 | static guint button_actions[3] = { | ||
| 1007 | 856 | WNCK_WINDOW_ACTION_CLOSE, | ||
| 1008 | 857 | WNCK_WINDOW_ACTION_MAXIMIZE, | ||
| 1009 | 858 | WNCK_WINDOW_ACTION_MINIMIZE | ||
| 1010 | 859 | }; | ||
| 1011 | 860 | |||
| 1012 | 861 | if (d->actions & button_actions[i]) | ||
| 1013 | 862 | { | ||
| 1014 | 863 | if (meta_get_button_position (d, i, width, 256, &x, &y, &w, &h)) | ||
| 1015 | 864 | { | ||
| 1016 | 865 | if (x > width / 2 && x < min_x) | ||
| 1017 | 866 | min_x = x; | ||
| 1018 | 867 | } | ||
| 1019 | 868 | } | ||
| 1020 | 869 | } | ||
| 1021 | 870 | |||
| 1022 | 871 | d->button_width = width - min_x; | ||
| 1023 | 872 | } | ||
| 1024 | 873 | |||
| 1025 | 874 | static MetaButtonFunction | ||
| 1026 | 875 | button_to_meta_button_function (gint i) | ||
| 1027 | 876 | { | ||
| 1028 | 877 | switch (i) | ||
| 1029 | 878 | { | ||
| 1030 | 879 | case BUTTON_MENU: | ||
| 1031 | 880 | return META_BUTTON_FUNCTION_MENU; | ||
| 1032 | 881 | case BUTTON_MIN: | ||
| 1033 | 882 | return META_BUTTON_FUNCTION_MINIMIZE; | ||
| 1034 | 883 | case BUTTON_MAX: | ||
| 1035 | 884 | return META_BUTTON_FUNCTION_MAXIMIZE; | ||
| 1036 | 885 | case BUTTON_CLOSE: | ||
| 1037 | 886 | return META_BUTTON_FUNCTION_CLOSE; | ||
| 1038 | 887 | case BUTTON_SHADE: | ||
| 1039 | 888 | return META_BUTTON_FUNCTION_SHADE; | ||
| 1040 | 889 | case BUTTON_ABOVE: | ||
| 1041 | 890 | return META_BUTTON_FUNCTION_ABOVE; | ||
| 1042 | 891 | case BUTTON_STICK: | ||
| 1043 | 892 | return META_BUTTON_FUNCTION_STICK; | ||
| 1044 | 893 | case BUTTON_UNSHADE: | ||
| 1045 | 894 | return META_BUTTON_FUNCTION_UNSHADE; | ||
| 1046 | 895 | case BUTTON_UNABOVE: | ||
| 1047 | 896 | return META_BUTTON_FUNCTION_UNABOVE; | ||
| 1048 | 897 | case BUTTON_UNSTICK: | ||
| 1049 | 898 | return META_BUTTON_FUNCTION_UNSTICK; | ||
| 1050 | 899 | default: | ||
| 1051 | 900 | break; | ||
| 1052 | 901 | } | ||
| 1053 | 902 | |||
| 1054 | 903 | return META_BUTTON_FUNCTION_LAST; | ||
| 1055 | 904 | } | ||
| 1056 | 905 | |||
| 1057 | 906 | gboolean | ||
| 1058 | 907 | meta_get_button_position (decor_t *d, | ||
| 1059 | 908 | gint i, | ||
| 1060 | 909 | gint width, | ||
| 1061 | 910 | gint height, | ||
| 1062 | 911 | gint *x, | ||
| 1063 | 912 | gint *y, | ||
| 1064 | 913 | gint *w, | ||
| 1065 | 914 | gint *h) | ||
| 1066 | 915 | { | ||
| 1067 | 916 | MetaButtonLayout button_layout; | ||
| 1068 | 917 | MetaFrameGeometry fgeom; | ||
| 1069 | 918 | MetaFrameType frame_type; | ||
| 1070 | 919 | MetaFrameFlags flags; | ||
| 1071 | 920 | MetaTheme *theme; | ||
| 1072 | 921 | MetaButtonFunction button_function; | ||
| 1073 | 922 | MetaButtonSpace *space; | ||
| 1074 | 923 | |||
| 1075 | 924 | if (!d->context) | ||
| 1076 | 925 | { | ||
| 1077 | 926 | /* undecorated windows implicitly have no buttons */ | ||
| 1078 | 927 | return FALSE; | ||
| 1079 | 928 | } | ||
| 1080 | 929 | |||
| 1081 | 930 | theme = meta_theme_get_current (); | ||
| 1082 | 931 | |||
| 1083 | 932 | frame_type = meta_frame_type_from_string (d->frame->type); | ||
| 1084 | 933 | if (!(frame_type < META_FRAME_TYPE_LAST)) | ||
| 1085 | 934 | frame_type = META_FRAME_TYPE_NORMAL; | ||
| 1086 | 935 | |||
| 1087 | 936 | meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout, | ||
| 1088 | 937 | frame_type); | ||
| 1089 | 938 | |||
| 1090 | 939 | button_function = button_to_meta_button_function (i); | ||
| 1091 | 940 | if (!meta_button_present (&button_layout, button_function)) | ||
| 1092 | 941 | return FALSE; | ||
| 1093 | 942 | |||
| 1094 | 943 | switch (i) | ||
| 1095 | 944 | { | ||
| 1096 | 945 | case BUTTON_MENU: | ||
| 1097 | 946 | space = &fgeom.menu_rect; | ||
| 1098 | 947 | break; | ||
| 1099 | 948 | case BUTTON_MIN: | ||
| 1100 | 949 | space = &fgeom.min_rect; | ||
| 1101 | 950 | break; | ||
| 1102 | 951 | case BUTTON_MAX: | ||
| 1103 | 952 | space = &fgeom.max_rect; | ||
| 1104 | 953 | break; | ||
| 1105 | 954 | case BUTTON_CLOSE: | ||
| 1106 | 955 | space = &fgeom.close_rect; | ||
| 1107 | 956 | break; | ||
| 1108 | 957 | case BUTTON_SHADE: | ||
| 1109 | 958 | space = &fgeom.shade_rect; | ||
| 1110 | 959 | break; | ||
| 1111 | 960 | case BUTTON_ABOVE: | ||
| 1112 | 961 | space = &fgeom.above_rect; | ||
| 1113 | 962 | break; | ||
| 1114 | 963 | case BUTTON_STICK: | ||
| 1115 | 964 | space = &fgeom.stick_rect; | ||
| 1116 | 965 | break; | ||
| 1117 | 966 | case BUTTON_UNSHADE: | ||
| 1118 | 967 | space = &fgeom.unshade_rect; | ||
| 1119 | 968 | break; | ||
| 1120 | 969 | case BUTTON_UNABOVE: | ||
| 1121 | 970 | space = &fgeom.unabove_rect; | ||
| 1122 | 971 | break; | ||
| 1123 | 972 | case BUTTON_UNSTICK: | ||
| 1124 | 973 | space = &fgeom.unstick_rect; | ||
| 1125 | 974 | break; | ||
| 1126 | 975 | default: | ||
| 1127 | 976 | return FALSE; | ||
| 1128 | 977 | } | ||
| 1129 | 978 | |||
| 1130 | 979 | if (!space->clickable.width && !space->clickable.height) | ||
| 1131 | 980 | return FALSE; | ||
| 1132 | 981 | |||
| 1133 | 982 | *x = space->clickable.x; | ||
| 1134 | 983 | *y = space->clickable.y; | ||
| 1135 | 984 | *w = space->clickable.width; | ||
| 1136 | 985 | *h = space->clickable.height; | ||
| 1137 | 986 | |||
| 1138 | 987 | if (d->frame_window) | ||
| 1139 | 988 | { | ||
| 1140 | 989 | *x += d->frame->win_extents.left + 4; | ||
| 1141 | 990 | *y += d->frame->win_extents.top + 2; | ||
| 1142 | 991 | } | ||
| 1143 | 992 | |||
| 1144 | 993 | return TRUE; | ||
| 1145 | 994 | } | ||
| 1146 | 995 | |||
| 1147 | 996 | gfloat | ||
| 1148 | 997 | meta_get_title_scale (decor_frame_t *frame) | ||
| 1149 | 998 | { | ||
| 1150 | 999 | MetaTheme *theme; | ||
| 1151 | 1000 | MetaFrameType type; | ||
| 1152 | 1001 | MetaFrameFlags flags; | ||
| 1153 | 1002 | |||
| 1154 | 1003 | theme = meta_theme_get_current (); | ||
| 1155 | 1004 | type = meta_frame_type_from_string (frame->type); | ||
| 1156 | 1005 | flags = 0xc33; /* fixme */ | ||
| 1157 | 1006 | |||
| 1158 | 1007 | if (type == META_FRAME_TYPE_LAST) | ||
| 1159 | 1008 | return 1.0f; | ||
| 1160 | 1009 | |||
| 1161 | 1010 | gfloat scale = meta_theme_get_title_scale (theme, type, flags); | ||
| 1162 | 1011 | |||
| 1163 | 1012 | return scale; | ||
| 1164 | 1013 | } | ||
| 1165 | 1014 | |||
| 1166 | 1015 | gboolean | ||
| 1167 | 1016 | meta_calc_decoration_size (decor_t *d, | ||
| 1168 | 1017 | gint w, | ||
| 1169 | 1018 | gint h, | ||
| 1170 | 1019 | gint name_width, | ||
| 1171 | 1020 | gint *width, | ||
| 1172 | 1021 | gint *height) | ||
| 1173 | 1022 | { | ||
| 1174 | 1023 | decor_layout_t layout; | ||
| 1175 | 1024 | decor_context_t *context; | ||
| 1176 | 1025 | decor_shadow_t *shadow; | ||
| 1177 | 1026 | |||
| 1178 | 1027 | if (!d->decorated) | ||
| 1179 | 1028 | return FALSE; | ||
| 1180 | 1029 | |||
| 1181 | 1030 | if ((d->state & META_MAXIMIZED) == META_MAXIMIZED) | ||
| 1182 | 1031 | { | ||
| 1183 | 1032 | if (!d->frame_window) | ||
| 1184 | 1033 | { | ||
| 1185 | 1034 | if (d->active) | ||
| 1186 | 1035 | { | ||
| 1187 | 1036 | context = &d->frame->max_window_context_active; | ||
| 1188 | 1037 | shadow = d->frame->max_border_shadow_active; | ||
| 1189 | 1038 | } | ||
| 1190 | 1039 | else | ||
| 1191 | 1040 | { | ||
| 1192 | 1041 | context = &d->frame->max_window_context_inactive; | ||
| 1193 | 1042 | shadow = d->frame->max_border_shadow_inactive; | ||
| 1194 | 1043 | } | ||
| 1195 | 1044 | } | ||
| 1196 | 1045 | else | ||
| 1197 | 1046 | { | ||
| 1198 | 1047 | context = &d->frame->max_window_context_no_shadow; | ||
| 1199 | 1048 | shadow = d->frame->max_border_no_shadow; | ||
| 1200 | 1049 | } | ||
| 1201 | 1050 | } | ||
| 1202 | 1051 | else | ||
| 1203 | 1052 | { | ||
| 1204 | 1053 | if (!d->frame_window) | ||
| 1205 | 1054 | { | ||
| 1206 | 1055 | if (d->active) | ||
| 1207 | 1056 | { | ||
| 1208 | 1057 | context = &d->frame->window_context_active; | ||
| 1209 | 1058 | shadow = d->frame->border_shadow_active; | ||
| 1210 | 1059 | } | ||
| 1211 | 1060 | else | ||
| 1212 | 1061 | { | ||
| 1213 | 1062 | context = &d->frame->window_context_inactive; | ||
| 1214 | 1063 | shadow = d->frame->border_shadow_inactive; | ||
| 1215 | 1064 | } | ||
| 1216 | 1065 | } | ||
| 1217 | 1066 | else | ||
| 1218 | 1067 | { | ||
| 1219 | 1068 | context = &d->frame->window_context_no_shadow; | ||
| 1220 | 1069 | shadow = d->frame->border_no_shadow; | ||
| 1221 | 1070 | } | ||
| 1222 | 1071 | } | ||
| 1223 | 1072 | |||
| 1224 | 1073 | if (!d->frame_window) | ||
| 1225 | 1074 | { | ||
| 1226 | 1075 | decor_get_best_layout (context, w, h, &layout); | ||
| 1227 | 1076 | |||
| 1228 | 1077 | if (context != d->context || memcmp (&layout, &d->border_layout, sizeof (layout))) | ||
| 1229 | 1078 | { | ||
| 1230 | 1079 | *width = layout.width; | ||
| 1231 | 1080 | *height = layout.height; | ||
| 1232 | 1081 | |||
| 1233 | 1082 | d->border_layout = layout; | ||
| 1234 | 1083 | d->context = context; | ||
| 1235 | 1084 | d->shadow = shadow; | ||
| 1236 | 1085 | |||
| 1237 | 1086 | meta_calc_button_size (d); | ||
| 1238 | 1087 | |||
| 1239 | 1088 | return TRUE; | ||
| 1240 | 1089 | } | ||
| 1241 | 1090 | } | ||
| 1242 | 1091 | else | ||
| 1243 | 1092 | { | ||
| 1244 | 1093 | if ((d->state & META_MAXIMIZED) == META_MAXIMIZED) | ||
| 1245 | 1094 | decor_get_default_layout (context, d->client_width, | ||
| 1246 | 1095 | d->client_height - d->frame->titlebar_height, | ||
| 1247 | 1096 | &layout); | ||
| 1248 | 1097 | else | ||
| 1249 | 1098 | decor_get_default_layout (context, d->client_width, | ||
| 1250 | 1099 | d->client_height, &layout); | ||
| 1251 | 1100 | |||
| 1252 | 1101 | *width = layout.width; | ||
| 1253 | 1102 | *height = layout.height; | ||
| 1254 | 1103 | |||
| 1255 | 1104 | d->border_layout = layout; | ||
| 1256 | 1105 | d->shadow = shadow; | ||
| 1257 | 1106 | d->context = context; | ||
| 1258 | 1107 | |||
| 1259 | 1108 | meta_calc_button_size (d); | ||
| 1260 | 1109 | |||
| 1261 | 1110 | return TRUE; | ||
| 1262 | 1111 | } | ||
| 1263 | 1112 | |||
| 1264 | 1113 | return FALSE; | ||
| 1265 | 1114 | } | ||
| 1266 | 1115 | |||
| 1267 | 1116 | #define TOP_RESIZE_HEIGHT 2 | ||
| 1268 | 1117 | #define RESIZE_EXTENDS 15 | ||
| 1269 | 1118 | |||
| 1270 | 1119 | void | ||
| 1271 | 1120 | meta_get_event_window_position (decor_t *d, | ||
| 1272 | 1121 | gint i, | ||
| 1273 | 1122 | gint j, | ||
| 1274 | 1123 | gint width, | ||
| 1275 | 1124 | gint height, | ||
| 1276 | 1125 | gint *x, | ||
| 1277 | 1126 | gint *y, | ||
| 1278 | 1127 | gint *w, | ||
| 1279 | 1128 | gint *h) | ||
| 1280 | 1129 | { | ||
| 1281 | 1130 | MetaButtonLayout button_layout; | ||
| 1282 | 1131 | MetaFrameGeometry fgeom; | ||
| 1283 | 1132 | MetaFrameFlags flags; | ||
| 1284 | 1133 | MetaTheme *theme; | ||
| 1285 | 1134 | |||
| 1286 | 1135 | theme = meta_theme_get_current (); | ||
| 1287 | 1136 | |||
| 1288 | 1137 | meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout, | ||
| 1289 | 1138 | meta_frame_type_from_string (d->frame->type)); | ||
| 1290 | 1139 | |||
| 1291 | 1140 | width += fgeom.borders.total.right + fgeom.borders.total.left; | ||
| 1292 | 1141 | height += fgeom.borders.total.top + fgeom.borders.total.bottom; | ||
| 1293 | 1142 | |||
| 1294 | 1143 | switch (i) | ||
| 1295 | 1144 | { | ||
| 1296 | 1145 | case 2: /* bottom */ | ||
| 1297 | 1146 | switch (j) | ||
| 1298 | 1147 | { | ||
| 1299 | 1148 | case 2: /* bottom right */ | ||
| 1300 | 1149 | *x = width - fgeom.borders.total.right - RESIZE_EXTENDS; | ||
| 1301 | 1150 | *y = height - fgeom.borders.total.bottom - RESIZE_EXTENDS; | ||
| 1302 | 1151 | |||
| 1303 | 1152 | if (d->frame_window) | ||
| 1304 | 1153 | { | ||
| 1305 | 1154 | *x += d->frame->win_extents.left + 2; | ||
| 1306 | 1155 | *y += d->frame->win_extents.top + 2; | ||
| 1307 | 1156 | } | ||
| 1308 | 1157 | |||
| 1309 | 1158 | *w = fgeom.borders.total.right + RESIZE_EXTENDS; | ||
| 1310 | 1159 | *h = fgeom.borders.total.bottom + RESIZE_EXTENDS; | ||
| 1311 | 1160 | break; | ||
| 1312 | 1161 | case 1: /* bottom */ | ||
| 1313 | 1162 | *x = fgeom.borders.total.left + RESIZE_EXTENDS; | ||
| 1314 | 1163 | *y = height - fgeom.borders.total.bottom; | ||
| 1315 | 1164 | |||
| 1316 | 1165 | if (d->frame_window) | ||
| 1317 | 1166 | *y += d->frame->win_extents.top + 2; | ||
| 1318 | 1167 | |||
| 1319 | 1168 | *w = width - fgeom.borders.total.left - fgeom.borders.total.right - (2 * RESIZE_EXTENDS); | ||
| 1320 | 1169 | *h = fgeom.borders.total.bottom; | ||
| 1321 | 1170 | break; | ||
| 1322 | 1171 | case 0: /* bottom left */ | ||
| 1323 | 1172 | default: | ||
| 1324 | 1173 | *x = 0; | ||
| 1325 | 1174 | *y = height - fgeom.borders.total.bottom - RESIZE_EXTENDS; | ||
| 1326 | 1175 | |||
| 1327 | 1176 | if (d->frame_window) | ||
| 1328 | 1177 | { | ||
| 1329 | 1178 | *x += d->frame->win_extents.left + 4; | ||
| 1330 | 1179 | *y += d->frame->win_extents.bottom + 2; | ||
| 1331 | 1180 | } | ||
| 1332 | 1181 | |||
| 1333 | 1182 | *w = fgeom.borders.total.left + RESIZE_EXTENDS; | ||
| 1334 | 1183 | *h = fgeom.borders.total.bottom + RESIZE_EXTENDS; | ||
| 1335 | 1184 | break; | ||
| 1336 | 1185 | } | ||
| 1337 | 1186 | break; | ||
| 1338 | 1187 | case 1: /* middle */ | ||
| 1339 | 1188 | switch (j) | ||
| 1340 | 1189 | { | ||
| 1341 | 1190 | case 2: /* right */ | ||
| 1342 | 1191 | *x = width - fgeom.borders.total.right; | ||
| 1343 | 1192 | *y = fgeom.borders.total.top + RESIZE_EXTENDS; | ||
| 1344 | 1193 | |||
| 1345 | 1194 | if (d->frame_window) | ||
| 1346 | 1195 | *x += d->frame->win_extents.left + 2; | ||
| 1347 | 1196 | |||
| 1348 | 1197 | *w = fgeom.borders.total.right; | ||
| 1349 | 1198 | *h = height - fgeom.borders.total.top - fgeom.borders.total.bottom - (2 * RESIZE_EXTENDS); | ||
| 1350 | 1199 | break; | ||
| 1351 | 1200 | case 1: /* middle */ | ||
| 1352 | 1201 | *x = fgeom.borders.total.left; | ||
| 1353 | 1202 | *y = fgeom.title_rect.y + TOP_RESIZE_HEIGHT; | ||
| 1354 | 1203 | *w = width - fgeom.borders.total.left - fgeom.borders.total.right; | ||
| 1355 | 1204 | *h = height - fgeom.top_titlebar_edge - fgeom.borders.total.bottom; | ||
| 1356 | 1205 | break; | ||
| 1357 | 1206 | case 0: /* left */ | ||
| 1358 | 1207 | default: | ||
| 1359 | 1208 | *x = 0; | ||
| 1360 | 1209 | *y = fgeom.borders.total.top + RESIZE_EXTENDS; | ||
| 1361 | 1210 | |||
| 1362 | 1211 | if (d->frame_window) | ||
| 1363 | 1212 | *x += d->frame->win_extents.left + 4; | ||
| 1364 | 1213 | |||
| 1365 | 1214 | *w = fgeom.borders.total.left; | ||
| 1366 | 1215 | *h = height - fgeom.borders.total.top - fgeom.borders.total.bottom - (2 * RESIZE_EXTENDS); | ||
| 1367 | 1216 | break; | ||
| 1368 | 1217 | } | ||
| 1369 | 1218 | break; | ||
| 1370 | 1219 | case 0: /* top */ | ||
| 1371 | 1220 | default: | ||
| 1372 | 1221 | switch (j) | ||
| 1373 | 1222 | { | ||
| 1374 | 1223 | case 2: /* top right */ | ||
| 1375 | 1224 | *x = width - fgeom.borders.total.right - RESIZE_EXTENDS; | ||
| 1376 | 1225 | *y = 0; | ||
| 1377 | 1226 | |||
| 1378 | 1227 | if (d->frame_window) | ||
| 1379 | 1228 | { | ||
| 1380 | 1229 | *x += d->frame->win_extents.left + 2; | ||
| 1381 | 1230 | *y += d->frame->win_extents.top + 2 - fgeom.title_rect.height; | ||
| 1382 | 1231 | } | ||
| 1383 | 1232 | |||
| 1384 | 1233 | *w = fgeom.borders.total.right + RESIZE_EXTENDS; | ||
| 1385 | 1234 | *h = fgeom.borders.total.top + RESIZE_EXTENDS; | ||
| 1386 | 1235 | break; | ||
| 1387 | 1236 | case 1: /* top */ | ||
| 1388 | 1237 | *x = fgeom.borders.total.left + RESIZE_EXTENDS; | ||
| 1389 | 1238 | *y = 0; | ||
| 1390 | 1239 | |||
| 1391 | 1240 | if (d->frame_window) | ||
| 1392 | 1241 | *y += d->frame->win_extents.top + 2; | ||
| 1393 | 1242 | |||
| 1394 | 1243 | *w = width - fgeom.borders.total.left - fgeom.borders.total.right - (2 * RESIZE_EXTENDS); | ||
| 1395 | 1244 | *h = fgeom.borders.total.top - fgeom.title_rect.height; | ||
| 1396 | 1245 | break; | ||
| 1397 | 1246 | case 0: /* top left */ | ||
| 1398 | 1247 | default: | ||
| 1399 | 1248 | *x = 0; | ||
| 1400 | 1249 | *y = 0; | ||
| 1401 | 1250 | |||
| 1402 | 1251 | if (d->frame_window) | ||
| 1403 | 1252 | { | ||
| 1404 | 1253 | *x += d->frame->win_extents.left + 4; | ||
| 1405 | 1254 | *y += d->frame->win_extents.top + 2 - fgeom.title_rect.height; | ||
| 1406 | 1255 | } | ||
| 1407 | 1256 | |||
| 1408 | 1257 | *w = fgeom.borders.total.left + RESIZE_EXTENDS; | ||
| 1409 | 1258 | *h = fgeom.borders.total.top + RESIZE_EXTENDS; | ||
| 1410 | 1259 | break; | ||
| 1411 | 1260 | } | ||
| 1412 | 1261 | break; | ||
| 1413 | 1262 | } | ||
| 1414 | 1263 | |||
| 1415 | 1264 | if (!(flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)) | ||
| 1416 | 1265 | { | ||
| 1417 | 1266 | /* turn off top and bottom event windows */ | ||
| 1418 | 1267 | if (i == 0 || i == 2) | ||
| 1419 | 1268 | *w = *h = 0; | ||
| 1420 | 1269 | } | ||
| 1421 | 1270 | |||
| 1422 | 1271 | if (!(flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)) | ||
| 1423 | 1272 | { | ||
| 1424 | 1273 | /* turn off left and right event windows */ | ||
| 1425 | 1274 | if (j == 0 || j == 2) | ||
| 1426 | 1275 | *w = *h = 0; | ||
| 1427 | 1276 | } | ||
| 1428 | 1277 | } | ||
| 1429 | 1278 | |||
| 1430 | 1279 | static MetaButtonFunction | ||
| 1431 | 1280 | meta_button_function_from_string (const char *str) | ||
| 1432 | 1281 | { | ||
| 1433 | 1282 | if (strcmp (str, "menu") == 0) | ||
| 1434 | 1283 | return META_BUTTON_FUNCTION_MENU; | ||
| 1435 | 1284 | else if (strcmp (str, "appmenu") == 0) | ||
| 1436 | 1285 | return META_BUTTON_FUNCTION_APPMENU; | ||
| 1437 | 1286 | else if (strcmp (str, "minimize") == 0) | ||
| 1438 | 1287 | return META_BUTTON_FUNCTION_MINIMIZE; | ||
| 1439 | 1288 | else if (strcmp (str, "maximize") == 0) | ||
| 1440 | 1289 | return META_BUTTON_FUNCTION_MAXIMIZE; | ||
| 1441 | 1290 | else if (strcmp (str, "close") == 0) | ||
| 1442 | 1291 | return META_BUTTON_FUNCTION_CLOSE; | ||
| 1443 | 1292 | else if (strcmp (str, "shade") == 0) | ||
| 1444 | 1293 | return META_BUTTON_FUNCTION_SHADE; | ||
| 1445 | 1294 | else if (strcmp (str, "above") == 0) | ||
| 1446 | 1295 | return META_BUTTON_FUNCTION_ABOVE; | ||
| 1447 | 1296 | else if (strcmp (str, "stick") == 0) | ||
| 1448 | 1297 | return META_BUTTON_FUNCTION_STICK; | ||
| 1449 | 1298 | else if (strcmp (str, "unshade") == 0) | ||
| 1450 | 1299 | return META_BUTTON_FUNCTION_UNSHADE; | ||
| 1451 | 1300 | else if (strcmp (str, "unabove") == 0) | ||
| 1452 | 1301 | return META_BUTTON_FUNCTION_UNABOVE; | ||
| 1453 | 1302 | else if (strcmp (str, "unstick") == 0) | ||
| 1454 | 1303 | return META_BUTTON_FUNCTION_UNSTICK; | ||
| 1455 | 1304 | else | ||
| 1456 | 1305 | return META_BUTTON_FUNCTION_LAST; | ||
| 1457 | 1306 | } | ||
| 1458 | 1307 | |||
| 1459 | 1308 | static MetaButtonFunction | ||
| 1460 | 1309 | meta_button_opposite_function (MetaButtonFunction ofwhat) | ||
| 1461 | 1310 | { | ||
| 1462 | 1311 | switch (ofwhat) | ||
| 1463 | 1312 | { | ||
| 1464 | 1313 | case META_BUTTON_FUNCTION_SHADE: | ||
| 1465 | 1314 | return META_BUTTON_FUNCTION_UNSHADE; | ||
| 1466 | 1315 | case META_BUTTON_FUNCTION_UNSHADE: | ||
| 1467 | 1316 | return META_BUTTON_FUNCTION_SHADE; | ||
| 1468 | 1317 | |||
| 1469 | 1318 | case META_BUTTON_FUNCTION_ABOVE: | ||
| 1470 | 1319 | return META_BUTTON_FUNCTION_UNABOVE; | ||
| 1471 | 1320 | case META_BUTTON_FUNCTION_UNABOVE: | ||
| 1472 | 1321 | return META_BUTTON_FUNCTION_ABOVE; | ||
| 1473 | 1322 | |||
| 1474 | 1323 | case META_BUTTON_FUNCTION_STICK: | ||
| 1475 | 1324 | return META_BUTTON_FUNCTION_UNSTICK; | ||
| 1476 | 1325 | case META_BUTTON_FUNCTION_UNSTICK: | ||
| 1477 | 1326 | return META_BUTTON_FUNCTION_STICK; | ||
| 1478 | 1327 | |||
| 1479 | 1328 | default: | ||
| 1480 | 1329 | return META_BUTTON_FUNCTION_LAST; | ||
| 1481 | 1330 | } | ||
| 1482 | 1331 | } | ||
| 1483 | 1332 | |||
| 1484 | 1333 | static void | ||
| 1485 | 1334 | meta_initialize_button_layout (MetaButtonLayout *layout) | ||
| 1486 | 1335 | { | ||
| 1487 | 1336 | int i; | ||
| 1488 | 1337 | |||
| 1489 | 1338 | for (i = 0; i < MAX_BUTTONS_PER_CORNER; ++i) | ||
| 1490 | 1339 | { | ||
| 1491 | 1340 | layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST; | ||
| 1492 | 1341 | layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST; | ||
| 1493 | 1342 | layout->left_buttons_has_spacer[i] = FALSE; | ||
| 1494 | 1343 | layout->right_buttons_has_spacer[i] = FALSE; | ||
| 1495 | 1344 | } | ||
| 1496 | 1345 | } | ||
| 1497 | 1346 | |||
| 1498 | 1347 | void | ||
| 1499 | 1348 | meta_update_button_layout (const char *value) | ||
| 1500 | 1349 | { | ||
| 1501 | 1350 | MetaButtonLayout new_layout; | ||
| 1502 | 1351 | MetaButtonFunction f; | ||
| 1503 | 1352 | char **sides; | ||
| 1504 | 1353 | int i; | ||
| 1505 | 1354 | |||
| 1506 | 1355 | meta_initialize_button_layout (&new_layout); | ||
| 1507 | 1356 | |||
| 1508 | 1357 | sides = g_strsplit (value, ":", 2); | ||
| 1509 | 1358 | |||
| 1510 | 1359 | if (sides[0] != NULL) | ||
| 1511 | 1360 | { | ||
| 1512 | 1361 | char **buttons; | ||
| 1513 | 1362 | int b; | ||
| 1514 | 1363 | gboolean used[META_BUTTON_FUNCTION_LAST]; | ||
| 1515 | 1364 | |||
| 1516 | 1365 | for (i = 0; i < META_BUTTON_FUNCTION_LAST; ++i) | ||
| 1517 | 1366 | used[i] = FALSE; | ||
| 1518 | 1367 | |||
| 1519 | 1368 | buttons = g_strsplit (sides[0], ",", -1); | ||
| 1520 | 1369 | |||
| 1521 | 1370 | i = b = 0; | ||
| 1522 | 1371 | while (buttons[b] != NULL) | ||
| 1523 | 1372 | { | ||
| 1524 | 1373 | f = meta_button_function_from_string (buttons[b]); | ||
| 1525 | 1374 | if (i > 0 && strcmp ("spacer", buttons[b]) == 0) | ||
| 1526 | 1375 | { | ||
| 1527 | 1376 | new_layout.left_buttons_has_spacer[i - 1] = TRUE; | ||
| 1528 | 1377 | f = meta_button_opposite_function (f); | ||
| 1529 | 1378 | |||
| 1530 | 1379 | if (f != META_BUTTON_FUNCTION_LAST) | ||
| 1531 | 1380 | new_layout.left_buttons_has_spacer[i - 2] = TRUE; | ||
| 1532 | 1381 | } | ||
| 1533 | 1382 | else | ||
| 1534 | 1383 | { | ||
| 1535 | 1384 | if (f != META_BUTTON_FUNCTION_LAST && !used[f]) | ||
| 1536 | 1385 | { | ||
| 1537 | 1386 | used[f] = TRUE; | ||
| 1538 | 1387 | new_layout.left_buttons[i++] = f; | ||
| 1539 | 1388 | |||
| 1540 | 1389 | f = meta_button_opposite_function (f); | ||
| 1541 | 1390 | |||
| 1542 | 1391 | if (f != META_BUTTON_FUNCTION_LAST) | ||
| 1543 | 1392 | new_layout.left_buttons[i++] = f; | ||
| 1544 | 1393 | |||
| 1545 | 1394 | } | ||
| 1546 | 1395 | else | ||
| 1547 | 1396 | { | ||
| 1548 | 1397 | fprintf (stderr, "%s: Ignoring unknown or already-used " | ||
| 1549 | 1398 | "button name \"%s\"\n", program_name, buttons[b]); | ||
| 1550 | 1399 | } | ||
| 1551 | 1400 | } | ||
| 1552 | 1401 | ++b; | ||
| 1553 | 1402 | } | ||
| 1554 | 1403 | |||
| 1555 | 1404 | new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST; | ||
| 1556 | 1405 | |||
| 1557 | 1406 | g_strfreev (buttons); | ||
| 1558 | 1407 | |||
| 1559 | 1408 | if (sides[1] != NULL) | ||
| 1560 | 1409 | { | ||
| 1561 | 1410 | for (i = 0; i < META_BUTTON_FUNCTION_LAST; ++i) | ||
| 1562 | 1411 | used[i] = FALSE; | ||
| 1563 | 1412 | |||
| 1564 | 1413 | buttons = g_strsplit (sides[1], ",", -1); | ||
| 1565 | 1414 | |||
| 1566 | 1415 | i = b = 0; | ||
| 1567 | 1416 | while (buttons[b] != NULL) | ||
| 1568 | 1417 | { | ||
| 1569 | 1418 | f = meta_button_function_from_string (buttons[b]); | ||
| 1570 | 1419 | if (i > 0 && strcmp ("spacer", buttons[b]) == 0) | ||
| 1571 | 1420 | { | ||
| 1572 | 1421 | new_layout.right_buttons_has_spacer[i - 1] = TRUE; | ||
| 1573 | 1422 | f = meta_button_opposite_function (f); | ||
| 1574 | 1423 | if (f != META_BUTTON_FUNCTION_LAST) | ||
| 1575 | 1424 | new_layout.right_buttons_has_spacer[i - 2] = TRUE; | ||
| 1576 | 1425 | } | ||
| 1577 | 1426 | else | ||
| 1578 | 1427 | { | ||
| 1579 | 1428 | if (f != META_BUTTON_FUNCTION_LAST && !used[f]) | ||
| 1580 | 1429 | { | ||
| 1581 | 1430 | used[f] = TRUE; | ||
| 1582 | 1431 | new_layout.right_buttons[i++] = f; | ||
| 1583 | 1432 | |||
| 1584 | 1433 | f = meta_button_opposite_function (f); | ||
| 1585 | 1434 | |||
| 1586 | 1435 | if (f != META_BUTTON_FUNCTION_LAST) | ||
| 1587 | 1436 | new_layout.right_buttons[i++] = f; | ||
| 1588 | 1437 | } | ||
| 1589 | 1438 | else | ||
| 1590 | 1439 | { | ||
| 1591 | 1440 | fprintf (stderr, "%s: Ignoring unknown or " | ||
| 1592 | 1441 | "already-used button name \"%s\"\n", | ||
| 1593 | 1442 | program_name, buttons[b]); | ||
| 1594 | 1443 | } | ||
| 1595 | 1444 | } | ||
| 1596 | 1445 | ++b; | ||
| 1597 | 1446 | } | ||
| 1598 | 1447 | |||
| 1599 | 1448 | new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST; | ||
| 1600 | 1449 | |||
| 1601 | 1450 | g_strfreev (buttons); | ||
| 1602 | 1451 | } | ||
| 1603 | 1452 | } | ||
| 1604 | 1453 | |||
| 1605 | 1454 | g_strfreev (sides); | ||
| 1606 | 1455 | |||
| 1607 | 1456 | /* Invert the button layout for RTL languages */ | ||
| 1608 | 1457 | if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) | ||
| 1609 | 1458 | { | ||
| 1610 | 1459 | MetaButtonLayout rtl_layout; | ||
| 1611 | 1460 | int j; | ||
| 1612 | 1461 | |||
| 1613 | 1462 | meta_initialize_button_layout (&rtl_layout); | ||
| 1614 | 1463 | |||
| 1615 | 1464 | i = 0; | ||
| 1616 | 1465 | while (new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST) | ||
| 1617 | 1466 | ++i; | ||
| 1618 | 1467 | |||
| 1619 | 1468 | for (j = 0; j < i; ++j) | ||
| 1620 | 1469 | { | ||
| 1621 | 1470 | rtl_layout.right_buttons[j] = new_layout.left_buttons[i - j - 1]; | ||
| 1622 | 1471 | if (j == 0) | ||
| 1623 | 1472 | rtl_layout.right_buttons_has_spacer[i - 1] = new_layout.left_buttons_has_spacer[i - j - 1]; | ||
| 1624 | 1473 | else | ||
| 1625 | 1474 | rtl_layout.right_buttons_has_spacer[j - 1] = new_layout.left_buttons_has_spacer[i - j - 1]; | ||
| 1626 | 1475 | } | ||
| 1627 | 1476 | |||
| 1628 | 1477 | i = 0; | ||
| 1629 | 1478 | while (new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST) | ||
| 1630 | 1479 | ++i; | ||
| 1631 | 1480 | |||
| 1632 | 1481 | for (j = 0; j < i; ++j) | ||
| 1633 | 1482 | { | ||
| 1634 | 1483 | rtl_layout.left_buttons[j] = new_layout.right_buttons[i - j - 1]; | ||
| 1635 | 1484 | if (j == 0) | ||
| 1636 | 1485 | rtl_layout.left_buttons_has_spacer[i - 1] = new_layout.right_buttons_has_spacer[i - j - 1]; | ||
| 1637 | 1486 | else | ||
| 1638 | 1487 | rtl_layout.left_buttons_has_spacer[j - 1] = new_layout.right_buttons_has_spacer[i - j - 1]; | ||
| 1639 | 1488 | } | ||
| 1640 | 1489 | |||
| 1641 | 1490 | new_layout = rtl_layout; | ||
| 1642 | 1491 | } | ||
| 1643 | 1492 | |||
| 1644 | 1493 | meta_button_layout = new_layout; | ||
| 1645 | 1494 | } | ||
| 1646 | 1495 | |||
| 1647 | 1496 | void | ||
| 1648 | 1497 | meta_update_border_extents (decor_frame_t *frame) | ||
| 1649 | 1498 | { | ||
| 1650 | 1499 | MetaTheme *theme; | ||
| 1651 | 1500 | GdkScreen *screen; | ||
| 1652 | 1501 | MetaStyleInfo *style_info; | ||
| 1653 | 1502 | MetaFrameBorders borders; | ||
| 1654 | 1503 | MetaFrameType frame_type; | ||
| 1655 | 1504 | gint top_height; | ||
| 1656 | 1505 | gint bottom_height; | ||
| 1657 | 1506 | gint left_width; | ||
| 1658 | 1507 | gint right_width; | ||
| 1659 | 1508 | |||
| 1660 | 1509 | gwd_decor_frame_ref (frame); | ||
| 1661 | 1510 | |||
| 1662 | 1511 | frame_type = meta_frame_type_from_string (frame->type); | ||
| 1663 | 1512 | if (!(frame_type < META_FRAME_TYPE_LAST)) | ||
| 1664 | 1513 | frame_type = META_FRAME_TYPE_NORMAL; | ||
| 1665 | 1514 | |||
| 1666 | 1515 | theme = meta_theme_get_current (); | ||
| 1667 | 1516 | |||
| 1668 | 1517 | screen = gtk_widget_get_screen (frame->style_window_rgba); | ||
| 1669 | 1518 | style_info = meta_theme_create_style_info (screen, NULL); | ||
| 1670 | 1519 | |||
| 1671 | 1520 | meta_theme_get_frame_borders (theme, style_info, frame_type, frame->text_height, | ||
| 1672 | 1521 | 0, &borders); | ||
| 1673 | 1522 | |||
| 1674 | 1523 | top_height = borders.visible.top; | ||
| 1675 | 1524 | bottom_height = borders.visible.bottom; | ||
| 1676 | 1525 | left_width = borders.visible.left; | ||
| 1677 | 1526 | right_width = borders.visible.right; | ||
| 1678 | 1527 | |||
| 1679 | 1528 | frame->win_extents.top = frame->win_extents.top; | ||
| 1680 | 1529 | frame->win_extents.bottom = bottom_height; | ||
| 1681 | 1530 | frame->win_extents.left = left_width; | ||
| 1682 | 1531 | frame->win_extents.right = right_width; | ||
| 1683 | 1532 | |||
| 1684 | 1533 | frame->titlebar_height = top_height - frame->win_extents.top; | ||
| 1685 | 1534 | |||
| 1686 | 1535 | meta_theme_get_frame_borders (theme, style_info, frame_type, frame->text_height, | ||
| 1687 | 1536 | META_FRAME_MAXIMIZED, &borders); | ||
| 1688 | 1537 | |||
| 1689 | 1538 | top_height = borders.visible.top; | ||
| 1690 | 1539 | bottom_height = borders.visible.bottom; | ||
| 1691 | 1540 | left_width = borders.visible.left; | ||
| 1692 | 1541 | right_width = borders.visible.right; | ||
| 1693 | 1542 | |||
| 1694 | 1543 | frame->max_win_extents.top = frame->win_extents.top; | ||
| 1695 | 1544 | frame->max_win_extents.bottom = bottom_height; | ||
| 1696 | 1545 | frame->max_win_extents.left = left_width; | ||
| 1697 | 1546 | frame->max_win_extents.right = right_width; | ||
| 1698 | 1547 | |||
| 1699 | 1548 | frame->max_titlebar_height = top_height - frame->max_win_extents.top; | ||
| 1700 | 1549 | |||
| 1701 | 1550 | meta_style_info_unref (style_info); | ||
| 1702 | 1551 | |||
| 1703 | 1552 | gwd_decor_frame_unref (frame); | ||
| 1704 | 1553 | } | ||
| 1705 | 1554 | |||
| 1706 | 1555 | #endif | ||
| 1707 | 0 | 1556 | ||
| 1708 | === modified file 'plugins/grid/src/grid.cpp' | |||
| 1709 | === modified file 'plugins/neg/src/neg.cpp' | |||
| 1710 | === modified file 'plugins/opengl/src/paint.cpp' | |||
| 1711 | === modified file 'src/region/src/region.cpp' | |||
| 1712 | --- src/region/src/region.cpp 2012-10-16 07:00:03 +0000 | |||
| 1713 | +++ src/region/src/region.cpp 2018-02-20 17:39:33 +0000 | |||
| 1714 | @@ -110,7 +110,10 @@ | |||
| 1715 | 110 | CompRegion::~CompRegion () | 110 | CompRegion::~CompRegion () |
| 1716 | 111 | { | 111 | { |
| 1717 | 112 | if (priv) | 112 | if (priv) |
| 1719 | 113 | XDestroyRegion (static_cast<Region> (priv)); | 113 | { |
| 1720 | 114 | XDestroyRegion (static_cast<Region> (priv)); | ||
| 1721 | 115 | priv = NULL; | ||
| 1722 | 116 | } | ||
| 1723 | 114 | } | 117 | } |
| 1724 | 115 | 118 | ||
| 1725 | 116 | void | 119 | void |
| 1726 | 117 | 120 | ||
| 1727 | === modified file 'src/screen.cpp' | |||
