~hypodermia/ubuntu/oneiric/compiz/fix-for-bug-301174

« back to all changes in this revision

Viewing changes to gtk/window-decorator/metacity.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-02-24 17:31:29 UTC
  • mfrom: (0.167.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110224173129-hsczyk7yw7s21flf
Tags: 1:0.9.4-0ubuntu1
* New upstream release:
  - Fix no windows receiving the focus if someone got the focus then was
    destroyed
  - Fix crash when resizing using keybindings
  - Fix unresponsive inactive decorations (LP: #703755) 
  - Fix the long awaited gconf crash (LP: #691561)
  - gtk-window-decorator doesn't respect special decoration styles
    (LP: #290835)
* debian/compiz-core.links,
  debian/source_compiz.py,
  debian/compiz-core.install:
  - install again a richer apport hook to redirect nux/libunity/unityshell
    crash. It also asks the user to redirect unity issues against unity (still
    incuding xorg info when needed)
* Removed a bunch of patches either cherry-picked or pushed upstream. With the
  other fixes, the gconf workaround is hopefully not needed anymore.
* refresh existing patches to still apply
* debian/control:
  - rename dep on compiz-fusion* to compiz*
* debian/patches/085_add_grid_plugin.patch:
  - refresh the grid plugin from new release
* debian/patches/086_new_grid_defaults.patch
  - separate tweaking the default settings to only have the effect that were
    specified:
    top -> maximize, left (top or bottom left) -> window half left of the
    screen, right (top or bottom right) -> window half right of the screen,
    bottom -> do nothing

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2006 Novell, Inc.
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public
 
15
 * License along with this library; if not, write to the
 
16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
 * Boston, MA 02111-1307, USA.
 
18
 *
 
19
 * Author: David Reveman <davidr@novell.com>
 
20
 *
 
21
 * 2D Mode: Copyright © 2010 Sam Spilsbury <smspillaz@gmail.com>
 
22
 * Frames Management: Copright © 2011 Canonical Ltd.
 
23
 *        Authored By: Sam Spilsbury <sam.spilsbury@canonical.com>
 
24
 */
 
25
 
1
26
#include "gtk-window-decorator.h"
2
27
 
3
28
#ifdef USE_METACITY
4
29
 
5
 
double   meta_opacity              = META_OPACITY;
6
 
gboolean meta_shade_opacity        = META_SHADE_OPACITY;
7
 
double   meta_active_opacity       = META_ACTIVE_OPACITY;
8
 
gboolean meta_active_shade_opacity = META_ACTIVE_SHADE_OPACITY;
9
 
 
10
 
gboolean         meta_button_layout_set = FALSE;
11
 
MetaButtonLayout meta_button_layout;
12
 
 
13
30
static void
14
31
decor_update_meta_window_property (decor_t        *d,
15
32
                                   MetaTheme      *theme,
23
40
    Display         *xdisplay =
24
41
        GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
25
42
    gint            nQuad;
26
 
    decor_extents_t extents, max_extents;
 
43
    decor_extents_t win_extents = d->frame->win_extents;
 
44
    decor_extents_t max_win_extents = d->frame->max_win_extents;
27
45
    decor_quad_t    quads[N_QUADS_MAX];
28
46
    gint            w, lh, rh;
29
47
    gint            top_stretch_offset;
59
77
                                             top_stretch_offset,
60
78
                                             bottom_stretch_offset);
61
79
 
62
 
    extents = _win_extents;
63
 
    max_extents = _max_win_extents;
64
 
 
65
 
    extents.top += titlebar_height;
66
 
    max_extents.top += max_titlebar_height;
 
80
    win_extents.top += d->frame->titlebar_height;
 
81
    max_win_extents.top += d->frame->max_titlebar_height;
67
82
 
68
83
    if (d->frame_window)
69
 
        decor_gen_window_property (data, &extents, &max_extents, 20, 20);
 
84
        decor_gen_window_property (data, &win_extents, &max_win_extents, 20, 20);
70
85
    else
71
86
        decor_quads_to_property (data, GDK_PIXMAP_XID (d->pixmap),
72
 
                                 &extents, &max_extents,
 
87
                                 &win_extents, &win_extents,
 
88
                                 &max_win_extents, &max_win_extents,
73
89
                                 ICON_SPACE + d->button_width,
74
90
                                 0,
75
91
                                 quads, nQuad);
348
364
{
349
365
    switch (type) {
350
366
    case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
351
 
        type = meta_function_to_type (meta_button_layout.left_buttons[0]);
 
367
        type = meta_function_to_type (settings->meta_button_layout.left_buttons[0]);
352
368
        break;
353
369
    case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
354
 
        type = meta_function_to_type (meta_button_layout.left_buttons[1]);
 
370
        type = meta_function_to_type (settings->meta_button_layout.left_buttons[1]);
355
371
        break;
356
372
    case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
357
 
        type = meta_function_to_type (meta_button_layout.left_buttons[2]);
 
373
        type = meta_function_to_type (settings->meta_button_layout.left_buttons[2]);
358
374
        break;
359
375
    case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
360
 
        type = meta_function_to_type (meta_button_layout.right_buttons[0]);
 
376
        type = meta_function_to_type (settings->meta_button_layout.right_buttons[0]);
361
377
        break;
362
378
    case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
363
 
        type = meta_function_to_type (meta_button_layout.right_buttons[1]);
 
379
        type = meta_function_to_type (settings->meta_button_layout.right_buttons[1]);
364
380
        break;
365
381
    case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
366
 
        type = meta_function_to_type (meta_button_layout.right_buttons[2]);
 
382
        type = meta_function_to_type (settings->meta_button_layout.right_buttons[2]);
367
383
    default:
368
384
        break;
369
385
    }
406
422
                              MetaFrameFlags    *flags,
407
423
                              MetaFrameGeometry *fgeom,
408
424
                              MetaButtonLayout  *button_layout,
 
425
                              MetaFrameType     frame_type,
409
426
                              GdkRectangle      *clip)
410
427
{
411
428
    gint left_width, right_width, top_height, bottom_height;
412
429
 
413
 
    if (meta_button_layout_set)
 
430
    if (!(frame_type < META_FRAME_TYPE_LAST))
 
431
        frame_type = META_FRAME_TYPE_NORMAL;
 
432
 
 
433
    if (settings->meta_button_layout_set)
414
434
    {
415
 
        *button_layout = meta_button_layout;
 
435
        *button_layout = settings->meta_button_layout;
416
436
    }
417
437
    else
418
438
    {
482
502
#endif
483
503
 
484
504
    meta_theme_get_frame_borders (theme,
485
 
                                  META_FRAME_TYPE_NORMAL,
486
 
                                  text_height,
 
505
                                  frame_type,
 
506
                                  d->frame->text_height,
487
507
                                  *flags,
488
508
                                  &top_height,
489
509
                                  &bottom_height,
502
522
        clip->height = d->border_layout.left.y2 - d->border_layout.left.y1;
503
523
 
504
524
    meta_theme_calc_geometry (theme,
505
 
                              META_FRAME_TYPE_NORMAL,
506
 
                              text_height,
 
525
                              frame_type,
 
526
                              d->frame->text_height,
507
527
                              *flags,
508
528
                              clip->width,
509
529
                              clip->height,
521
541
        GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
522
542
    GdkPixmap         *pixmap;
523
543
    Picture           src;
524
 
    MetaButtonState   button_states[META_BUTTON_TYPE_LAST];
 
544
    MetaButtonState   button_states [META_BUTTON_TYPE_LAST];
525
545
    MetaButtonLayout  button_layout;
526
546
    MetaFrameGeometry fgeom;
527
547
    MetaFrameFlags    flags;
 
548
    MetaFrameType     frame_type;
528
549
    MetaTheme         *theme;
529
550
    GtkStyle          *style;
530
551
    cairo_t           *cr;
535
556
    Region            bottom_region = NULL;
536
557
    Region            left_region = NULL;
537
558
    Region            right_region = NULL;
538
 
    double            alpha = (d->active) ? meta_active_opacity : meta_opacity;
539
 
    gboolean          shade_alpha = (d->active) ? meta_active_shade_opacity :
540
 
                                                  meta_shade_opacity;
 
559
    double            alpha = (d->active) ? settings->meta_active_opacity : settings->meta_opacity;
 
560
    gboolean          shade_alpha = (d->active) ? settings->meta_active_shade_opacity :
 
561
                                                  settings->meta_shade_opacity;
541
562
    MetaFrameStyle    *frame_style;
542
563
    GtkWidget         *style_window;
543
564
    GdkColor          bg_color;
555
576
        gdk_drawable_set_colormap (GDK_DRAWABLE (d->buffer_pixmap), cmap);
556
577
    }
557
578
 
558
 
    if (decoration_alpha == 1.0)
 
579
    if (settings->decoration_alpha == 1.0)
559
580
        alpha = 1.0;
560
581
 
561
582
    if (gdk_drawable_get_depth (GDK_DRAWABLE (d->pixmap)) == 32)
562
583
    {
563
 
        style = gtk_widget_get_style (style_window_rgba);
564
 
        style_window = style_window_rgba;
 
584
        style = gtk_widget_get_style (d->frame->style_window_rgba);
 
585
        style_window = d->frame->style_window_rgba;
565
586
    }
566
587
    else
567
588
    {
568
 
        style = gtk_widget_get_style (style_window_rgb);
569
 
        style_window = style_window_rgb;
 
589
        style = gtk_widget_get_style (d->frame->style_window_rgb);
 
590
        style_window = d->frame->style_window_rgb;
570
591
    }
571
592
 
572
593
    drawable = d->buffer_pixmap ? d->buffer_pixmap : d->pixmap;
577
598
 
578
599
    theme = meta_theme_get_current ();
579
600
 
 
601
    frame_type = meta_frame_type_from_string (d->frame->type);
 
602
 
 
603
    if (frame_type == META_FRAME_TYPE_LAST)
 
604
        frame_type = META_FRAME_TYPE_NORMAL;
 
605
 
580
606
    meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
581
 
                                  &clip);
 
607
                                  frame_type, &clip);
582
608
 
583
609
    /* we only have to redraw the shadow background when decoration
584
610
       changed size */
589
615
        button_states[i] = meta_button_state_for_button_type (d, i);
590
616
 
591
617
    frame_style = meta_theme_get_frame_style (theme,
592
 
                                              META_FRAME_TYPE_NORMAL,
 
618
                                              frame_type,
593
619
                                              flags);
594
620
 
595
621
    bg_color = style->bg[GTK_STATE_NORMAL];
625
651
 
626
652
            cmap   = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap));
627
653
            depth  = gdk_drawable_get_depth (GDK_DRAWABLE (d->frame_window));
628
 
            pixmap = create_pixmap (rect.width, size, depth);
 
654
            pixmap = create_pixmap (rect.width, size, d->frame->style_window_rgb);
629
655
            gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), cmap);
630
656
        }
631
657
        else
632
 
            pixmap = create_pixmap (rect.width, size, 32);
 
658
            pixmap = create_pixmap (rect.width, size, d->frame->style_window_rgba);
633
659
 
634
660
        cr = gdk_cairo_create (GDK_DRAWABLE (pixmap));
635
661
        gdk_cairo_set_source_color_alpha (cr, &bg_color, bg_alpha);
650
676
                                   pixmap,
651
677
                                   &rect,
652
678
                                   0, 0,
653
 
                                   META_FRAME_TYPE_NORMAL,
 
679
                                   frame_type,
654
680
                                   flags,
655
681
                                   clip.width - fgeom.left_width -
656
682
                                   fgeom.right_width,
657
683
                                   clip.height - fgeom.top_height -
658
684
                                   fgeom.bottom_height,
659
685
                                   d->layout,
660
 
                                   text_height,
 
686
                                   d->frame->text_height,
661
687
                                   &button_layout,
662
688
                                   button_states,
663
689
                                   d->icon_pixbuf,
690
716
                                   &rect,
691
717
                                   0,
692
718
                                   -(clip.height - fgeom.bottom_height),
693
 
                                   META_FRAME_TYPE_NORMAL,
 
719
                                   frame_type,
694
720
                                   flags,
695
721
                                   clip.width - fgeom.left_width -
696
722
                                   fgeom.right_width,
697
723
                                   clip.height - fgeom.top_height -
698
724
                                   fgeom.bottom_height,
699
725
                                   d->layout,
700
 
                                   text_height,
 
726
                                   d->frame->text_height,
701
727
                                   &button_layout,
702
728
                                   button_states,
703
729
                                   d->icon_pixbuf,
741
767
 
742
768
            cmap   = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap));
743
769
            depth  = gdk_drawable_get_depth (GDK_DRAWABLE (d->frame_window));
744
 
            pixmap = create_pixmap (size, rect.height, depth);
 
770
            pixmap = create_pixmap (size, rect.height, d->frame->style_window_rgb);
745
771
            gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), cmap);
746
772
        }
747
773
        else
748
 
            pixmap = create_pixmap (size, rect.height, 32);
 
774
            pixmap = create_pixmap (size, rect.height, d->frame->style_window_rgba);
749
775
 
750
776
        cr = gdk_cairo_create (GDK_DRAWABLE (pixmap));
751
777
        gdk_cairo_set_source_color_alpha (cr, &bg_color, bg_alpha);
767
793
                                   &rect,
768
794
                                   0,
769
795
                                   -fgeom.top_height,
770
 
                                   META_FRAME_TYPE_NORMAL,
 
796
                                   frame_type,
771
797
                                   flags,
772
798
                                   clip.width - fgeom.left_width -
773
799
                                   fgeom.right_width,
774
800
                                   clip.height - fgeom.top_height -
775
801
                                   fgeom.bottom_height,
776
802
                                   d->layout,
777
 
                                   text_height,
 
803
                                   d->frame->text_height,
778
804
                                   &button_layout,
779
805
                                   button_states,
780
806
                                   d->icon_pixbuf,
807
833
                                   &rect,
808
834
                                   -(clip.width - fgeom.right_width),
809
835
                                   -fgeom.top_height,
810
 
                                   META_FRAME_TYPE_NORMAL,
 
836
                                   frame_type,
811
837
                                   flags,
812
838
                                   clip.width - fgeom.left_width -
813
839
                                   fgeom.right_width,
814
840
                                   clip.height - fgeom.top_height -
815
841
                                   fgeom.bottom_height,
816
842
                                   d->layout,
817
 
                                   text_height,
 
843
                                   d->frame->text_height,
818
844
                                   &button_layout,
819
845
                                   button_states,
820
846
                                   d->icon_pixbuf,
847
873
    if (d->frame_window)
848
874
    {
849
875
        GdkWindow *gdk_frame_window = gtk_widget_get_window (d->decor_window);
850
 
        decor_extents_t extents;
851
 
 
852
 
        if (d->state & (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY |
853
 
                        WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY))
854
 
        {
855
 
            extents.left = 0;
856
 
            extents.right = 0;
857
 
            extents.top = 10;
858
 
            extents.bottom = 0;
859
 
        }
860
 
        else
861
 
        {
862
 
            extents = _win_extents;
863
 
        }
864
876
 
865
877
        /*
866
878
         * FIXME: What is '4' supposed to be for here...
934
946
}
935
947
 
936
948
gboolean
937
 
meta_get_button_position (decor_t *d,
938
 
                          gint    i,
939
 
                          gint    width,
940
 
                          gint    height,
941
 
                          gint    *x,
942
 
                          gint    *y,
943
 
                          gint    *w,
944
 
                          gint    *h)
 
949
meta_get_button_position (decor_t        *d,
 
950
                          gint          i,
 
951
                          gint          width,
 
952
                          gint          height,
 
953
                          gint          *x,
 
954
                          gint          *y,
 
955
                          gint          *w,
 
956
                          gint          *h)
945
957
{
946
958
    MetaButtonLayout  button_layout;
947
959
    MetaFrameGeometry fgeom;
964
976
    theme = meta_theme_get_current ();
965
977
 
966
978
    meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
 
979
                                  meta_frame_type_from_string (d->frame->type),
967
980
                                  &clip);
968
981
 
969
982
    switch (i) {
1057
1070
 
1058
1071
    if (d->frame_window)
1059
1072
    {
1060
 
        *x += _win_extents.left + 4;
1061
 
        *y += _win_extents.top + 2;
 
1073
        *x += d->frame->win_extents.left + 4;
 
1074
        *y += d->frame->win_extents.top + 2;
1062
1075
    }
1063
1076
 
1064
1077
    return TRUE;
1065
1078
}
1066
1079
 
 
1080
gfloat
 
1081
meta_get_title_scale (decor_frame_t *frame)
 
1082
{
 
1083
    MetaTheme      *theme = meta_theme_get_current ();
 
1084
    MetaFrameType  type;
 
1085
    MetaFrameFlags flags = 0xc33; /* fixme */
 
1086
 
 
1087
    type = meta_frame_type_from_string (frame->type);
 
1088
 
 
1089
    if (type == META_FRAME_TYPE_LAST)
 
1090
        return 1.0f;
 
1091
 
 
1092
    gfloat scale = meta_theme_get_title_scale (theme, type, flags);
 
1093
 
 
1094
    return scale;
 
1095
}
 
1096
 
1067
1097
gboolean
1068
1098
meta_calc_decoration_size (decor_t *d,
1069
1099
                           gint    w,
1080
1110
    {
1081
1111
        if (!d->frame_window)
1082
1112
        {
1083
 
            context = &max_window_context;
1084
 
            shadow  = max_border_shadow;
 
1113
            context = &d->frame->max_window_context;
 
1114
            shadow  = d->frame->max_border_shadow;
1085
1115
        }
1086
1116
        else
1087
1117
        {
1088
 
            context = &max_window_context_no_shadow;
1089
 
            shadow  = max_border_no_shadow;
 
1118
            context = &d->frame->max_window_context_no_shadow;
 
1119
            shadow  = d->frame->max_border_no_shadow;
1090
1120
        }
1091
1121
    }
1092
1122
    else
1093
1123
    {
1094
1124
        if (!d->frame_window)
1095
1125
        {
1096
 
            context = &window_context;
1097
 
            shadow  = border_shadow;
 
1126
            context = &d->frame->window_context;
 
1127
            shadow  = d->frame->border_shadow;
1098
1128
        }
1099
1129
        else
1100
1130
        {
1101
 
            context = &window_context_no_shadow;
1102
 
            shadow  = border_no_shadow;
 
1131
            context = &d->frame->window_context_no_shadow;
 
1132
            shadow  = d->frame->border_no_shadow;
1103
1133
        }
1104
1134
    }
1105
1135
 
1126
1156
    {
1127
1157
        if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
1128
1158
            decor_get_default_layout (context, d->client_width,
1129
 
                                      d->client_height - titlebar_height,
 
1159
                                      d->client_height - d->frame->titlebar_height,
1130
1160
                                      &layout);
1131
1161
        else
1132
1162
            decor_get_default_layout (context, d->client_width,
1136
1166
        *height = layout.height;
1137
1167
 
1138
1168
        d->border_layout = layout;
1139
 
        d->shadow        = no_border_shadow;
 
1169
        d->shadow        = shadow;
1140
1170
        d->context       = context;
1141
1171
 
1142
1172
        meta_calc_button_size (d);
1182
1212
    MetaFrameGeometry fgeom;
1183
1213
    MetaFrameFlags    flags;
1184
1214
    MetaTheme         *theme;
 
1215
    WnckWindowType    win_type;
1185
1216
    GdkRectangle      clip;
1186
1217
 
1187
1218
    theme = meta_theme_get_current ();
1188
1219
 
 
1220
    win_type = wnck_window_get_window_type (d->win);
1189
1221
    meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
 
1222
                                  meta_frame_type_from_string (d->frame->type),
1190
1223
                                  &clip);
1191
1224
 
1192
1225
    width  += fgeom.right_width + fgeom.left_width;
1199
1232
            if (d->frame_window)
1200
1233
            {
1201
1234
                *x = width - fgeom.right_width - RESIZE_EXTENDS +
1202
 
                     _win_extents.left + 2;
 
1235
                     d->frame->win_extents.left + 2;
1203
1236
                *y = height - fgeom.bottom_height - RESIZE_EXTENDS +
1204
 
                     _win_extents.top + 2;
 
1237
                     d->frame->win_extents.top + 2;
1205
1238
            }
1206
1239
            else
1207
1240
            {
1215
1248
            *x = fgeom.left_width + RESIZE_EXTENDS;
1216
1249
            *y = height - fgeom.bottom_height;
1217
1250
            if (d->frame_window)
1218
 
                *y += _win_extents.top + 2;
 
1251
                *y += d->frame->win_extents.top + 2;
1219
1252
            *w = width - fgeom.left_width - fgeom.right_width -
1220
1253
                 (2 * RESIZE_EXTENDS);
1221
1254
            *h = fgeom.bottom_height;
1226
1259
            *y = height - fgeom.bottom_height - RESIZE_EXTENDS;
1227
1260
            if (d->frame_window)
1228
1261
            {
1229
 
                *x += _win_extents.left + 4;
1230
 
                *y += _win_extents.bottom + 2;
 
1262
                *x += d->frame->win_extents.left + 4;
 
1263
                *y += d->frame->win_extents.bottom + 2;
1231
1264
            }
1232
1265
            *w = fgeom.left_width + RESIZE_EXTENDS;
1233
1266
            *h = fgeom.bottom_height + RESIZE_EXTENDS;
1239
1272
        case 2: /* right */
1240
1273
            *x = width - fgeom.right_width;
1241
1274
            if (d->frame_window)
1242
 
                *x += _win_extents.left + 2;
 
1275
                *x += d->frame->win_extents.left + 2;
1243
1276
            *w = fgeom.right_width;
1244
1277
            *h = height - fgeom.top_height - fgeom.bottom_height -
1245
1278
                 (2 * RESIZE_EXTENDS);
1254
1287
        default:
1255
1288
            *x = 0;
1256
1289
            if (d->frame_window)
1257
 
                *x += _win_extents.left + 4;
 
1290
                *x += d->frame->win_extents.left + 4;
1258
1291
            *y = fgeom.top_height + RESIZE_EXTENDS;
1259
1292
            *w = fgeom.left_width;
1260
1293
            *h = height - fgeom.top_height - fgeom.bottom_height -
1270
1303
            *y = 0;
1271
1304
            if (d->frame_window)
1272
1305
            {
1273
 
                *x += _win_extents.left + 2;
1274
 
                *y += _win_extents.top + 2 - fgeom.title_rect.height;
 
1306
                *x += d->frame->win_extents.left + 2;
 
1307
                *y += d->frame->win_extents.top + 2 - fgeom.title_rect.height;
1275
1308
            }
1276
1309
            *w = fgeom.right_width + RESIZE_EXTENDS;
1277
1310
            *h = fgeom.top_height + RESIZE_EXTENDS;
1280
1313
            *x = fgeom.left_width + RESIZE_EXTENDS;
1281
1314
            *y = 0;
1282
1315
            if (d->frame_window)
1283
 
                *y += _win_extents.top + 2;
 
1316
                *y += d->frame->win_extents.top + 2;
1284
1317
            *w = width - fgeom.left_width - fgeom.right_width -
1285
1318
                 (2 * RESIZE_EXTENDS);
1286
1319
            *h = fgeom.title_rect.y + TOP_RESIZE_HEIGHT;
1291
1324
            *y = 0;
1292
1325
            if (d->frame_window)
1293
1326
            {
1294
 
                *x += _win_extents.left + 4;
1295
 
                *y += _win_extents.top + 2 - fgeom.title_rect.height;
 
1327
                *x += d->frame->win_extents.left + 4;
 
1328
                *y += d->frame->win_extents.top + 2 - fgeom.title_rect.height;
1296
1329
            }
1297
1330
            *w = fgeom.left_width + RESIZE_EXTENDS;
1298
1331
            *h = fgeom.top_height + RESIZE_EXTENDS;
1546
1579
        new_layout = rtl_layout;
1547
1580
    }
1548
1581
 
1549
 
    meta_button_layout = new_layout;
 
1582
    settings->meta_button_layout = new_layout;
1550
1583
}
1551
1584
 
1552
1585
void
1553
 
meta_update_border_extents (gint text_height)
 
1586
meta_update_border_extents (decor_frame_t *frame)
1554
1587
{
1555
 
    MetaTheme *theme;
1556
 
    gint      top_height, bottom_height, left_width, right_width;
1557
 
 
1558
 
    theme = meta_theme_get_current ();
1559
 
 
1560
 
    meta_theme_get_frame_borders (theme,
1561
 
                                  META_FRAME_TYPE_NORMAL,
1562
 
                                  text_height, 0,
1563
 
                                  &top_height,
1564
 
                                  &bottom_height,
1565
 
                                  &left_width,
1566
 
                                  &right_width);
1567
 
 
1568
 
    _win_extents.top    = _default_win_extents.top;
1569
 
    _win_extents.bottom = bottom_height;
1570
 
    _win_extents.left   = left_width;
1571
 
    _win_extents.right  = right_width;
1572
 
 
1573
 
    titlebar_height = top_height - _win_extents.top;
1574
 
 
1575
 
    meta_theme_get_frame_borders (theme,
1576
 
                                  META_FRAME_TYPE_NORMAL,
1577
 
                                  text_height, META_FRAME_MAXIMIZED,
1578
 
                                  &top_height,
1579
 
                                  &bottom_height,
1580
 
                                  &left_width,
1581
 
                                  &right_width);
1582
 
 
1583
 
    _max_win_extents.top    = _default_win_extents.top;
1584
 
    _max_win_extents.bottom = bottom_height;
1585
 
    _max_win_extents.left   = left_width;
1586
 
    _max_win_extents.right  = right_width;
1587
 
 
1588
 
    max_titlebar_height = top_height - _max_win_extents.top;
 
1588
    MetaTheme *theme = meta_theme_get_current ();
 
1589
 
 
1590
    gwd_decor_frame_ref (frame);
 
1591
    decor_frame_t *default_frame = gwd_get_decor_frame ("default");
 
1592
    MetaFrameType frame_type = meta_frame_type_from_string (frame->type);
 
1593
    gint          top_height, bottom_height, left_width, right_width;
 
1594
 
 
1595
    if (!(frame_type < META_FRAME_TYPE_LAST))
 
1596
        frame_type = META_FRAME_TYPE_NORMAL;
 
1597
 
 
1598
    meta_theme_get_frame_borders (theme,
 
1599
                                  frame_type,
 
1600
                                  frame->text_height,
 
1601
                                  0,
 
1602
                                  &top_height,
 
1603
                                  &bottom_height,
 
1604
                                  &left_width,
 
1605
                                  &right_width);
 
1606
 
 
1607
    frame->win_extents.top    = default_frame->win_extents.top;
 
1608
    frame->win_extents.bottom = bottom_height;
 
1609
    frame->win_extents.left   = left_width;
 
1610
    frame->win_extents.right  = right_width;
 
1611
 
 
1612
    frame->titlebar_height = top_height - frame->win_extents.top;
 
1613
 
 
1614
    meta_theme_get_frame_borders (theme,
 
1615
                                  frame_type,
 
1616
                                  frame->text_height,
 
1617
                                  META_FRAME_MAXIMIZED,
 
1618
                                  &top_height,
 
1619
                                  &bottom_height,
 
1620
                                  &left_width,
 
1621
                                  &right_width);
 
1622
 
 
1623
    frame->max_win_extents.top    = default_frame->win_extents.top;
 
1624
    frame->max_win_extents.bottom = bottom_height;
 
1625
    frame->max_win_extents.left   = left_width;
 
1626
    frame->max_win_extents.right  = right_width;
 
1627
 
 
1628
    frame->max_titlebar_height = top_height - frame->max_win_extents.top;
 
1629
 
 
1630
    gwd_decor_frame_unref (frame);
 
1631
    gwd_decor_frame_unref (default_frame);
1589
1632
}
1590
1633
 
1591
1634
#endif