~ubuntu-branches/ubuntu/vivid/compiz/vivid

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Chris Townsend, Alberts Muktupāvels
  • Date: 2014-07-07 11:42:19 UTC
  • mfrom: (3248.176.40)
  • Revision ID: package-import@ubuntu.com-20140707114219-ipum407fkn7ed64h
Tags: 1:0.9.11+14.10.20140707-0ubuntu1
[ Chris Townsend ]
* Release version 0.9.11
* Bump VERSION to 0.9.12
* Add more button ungrab keymasks, so unfocused Gtk window scrolling
  will work when NumLock is off and CapsLock is on and any combination
  thereof. (LP: #1330198)
* Remove the need to check the viewport we are painting the maximized
  window in while in Expo mode and only scale maximized windows that
  are not being dragged. Fixes a regression caused in r3868. (LP:
  #1333277)

[ Alberts Muktupāvels ]
* This is some preparation work to port gtk-window-decorator to gtk+-
  3.0. Changed gtk_object_destroy to gtk_widget_destory. Removed
  support for old metacity versions. Removed support for old wnck
  versions. .

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
                        int                     *bottom_left_radius,
158
158
                        int                     *bottom_right_radius)
159
159
{
160
 
 
161
 
#ifdef HAVE_METACITY_2_17_0
162
160
    *top_left_radius     = fgeom->top_left_corner_rounded_radius;
163
161
    *top_right_radius    = fgeom->top_right_corner_rounded_radius;
164
162
    *bottom_left_radius  = fgeom->bottom_left_corner_rounded_radius;
165
163
    *bottom_right_radius = fgeom->bottom_right_corner_rounded_radius;
166
 
#else
167
 
    *top_left_radius     = fgeom->top_left_corner_rounded ? 5 : 0;
168
 
    *top_right_radius    = fgeom->top_right_corner_rounded ? 5 : 0;
169
 
    *bottom_left_radius  = fgeom->bottom_left_corner_rounded ? 5 : 0;
170
 
    *bottom_right_radius = fgeom->bottom_right_corner_rounded ? 5 : 0;
171
 
#endif
172
 
 
173
164
}
174
165
 
175
166
static int
378
369
        return META_BUTTON_TYPE_MAXIMIZE;
379
370
    case META_BUTTON_FUNCTION_CLOSE:
380
371
        return META_BUTTON_TYPE_CLOSE;
381
 
 
382
 
#ifdef HAVE_METACITY_2_17_0
383
372
    case META_BUTTON_FUNCTION_SHADE:
384
373
        return META_BUTTON_TYPE_SHADE;
385
374
    case META_BUTTON_FUNCTION_ABOVE:
392
381
        return META_BUTTON_TYPE_UNABOVE;
393
382
    case META_BUTTON_FUNCTION_UNSTICK:
394
383
        return META_BUTTON_TYPE_UNSTICK;
395
 
#endif
396
 
 
397
384
    default:
398
385
        break;
399
386
    }
436
423
        return meta_button_state (d->button_states[BUTTON_MIN]);
437
424
    case META_BUTTON_TYPE_MENU:
438
425
        return meta_button_state (d->button_states[BUTTON_MENU]);
439
 
 
440
 
#ifdef HAVE_METACITY_2_17_0
441
426
    case META_BUTTON_TYPE_SHADE:
442
427
        return meta_button_state (d->button_states[BUTTON_SHADE]);
443
428
    case META_BUTTON_TYPE_ABOVE:
450
435
        return meta_button_state (d->button_states[BUTTON_UNABOVE]);
451
436
    case META_BUTTON_TYPE_UNSTICK:
452
437
        return meta_button_state (d->button_states[BUTTON_UNSTICK]);
453
 
#endif
454
 
 
455
438
    default:
456
439
        break;
457
440
    }
539
522
    if (d->state & WNCK_WINDOW_STATE_SHADED)
540
523
        *flags |= (MetaFrameFlags ) META_FRAME_SHADED;
541
524
 
542
 
#ifdef HAVE_METACITY_2_17_0
543
525
    if (d->state & WNCK_WINDOW_STATE_ABOVE)
544
526
        *flags |= (MetaFrameFlags ) META_FRAME_ABOVE;
545
 
#endif
546
527
 
547
528
    meta_theme_get_frame_borders (theme,
548
529
                                  frame_type,
661
642
    bg_color = style->bg[GTK_STATE_NORMAL];
662
643
    bg_alpha = 1.0;
663
644
 
664
 
#ifdef HAVE_METACITY_2_17_0
665
645
    if (frame_style->window_background_color)
666
646
    {
667
647
        meta_color_spec_render (frame_style->window_background_color,
670
650
 
671
651
        bg_alpha = frame_style->window_background_alpha / 255.0;
672
652
    }
673
 
#endif
674
653
 
675
654
    cairo_destroy (cr);
676
655
 
992
971
 
993
972
    GdkRectangle      clip;
994
973
 
995
 
#ifdef HAVE_METACITY_2_15_21
996
974
    MetaButtonSpace   *space;
997
 
#else
998
 
    GdkRectangle      *space;
999
 
#endif
1000
975
 
1001
976
    gint mutter_draggable_border_width = 0;
1002
977
 
1041
1016
 
1042
1017
        space = &fgeom.close_rect;
1043
1018
        break;
1044
 
 
1045
 
#if defined (HAVE_METACITY_2_17_0) && defined (HAVE_LIBWNCK_2_18_1)
1046
1019
    case BUTTON_SHADE:
1047
1020
        if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_SHADE))
1048
1021
            return FALSE;
1079
1052
 
1080
1053
        space = &fgeom.unstick_rect;
1081
1054
        break;
1082
 
#endif
1083
 
 
1084
1055
    default:
1085
1056
        return FALSE;
1086
1057
    }
1087
1058
 
1088
 
#ifdef HAVE_METACITY_2_15_21
1089
1059
    if (!space->clickable.width && !space->clickable.height)
1090
1060
        return FALSE;
1091
1061
 
1093
1063
    *y = space->clickable.y;
1094
1064
    *w = space->clickable.width;
1095
1065
    *h = space->clickable.height;
1096
 
#else
1097
 
    if (!space->width && !space->height)
1098
 
        return FALSE;
1099
 
 
1100
 
    *x = space->x;
1101
 
    *y = space->y;
1102
 
    *w = space->width;
1103
 
    *h = space->height;
1104
 
#endif
1105
1066
 
1106
1067
    if (d->frame_window)
1107
1068
    {
1502
1463
        return META_BUTTON_FUNCTION_MAXIMIZE;
1503
1464
    else if (strcmp (str, "close") == 0)
1504
1465
        return META_BUTTON_FUNCTION_CLOSE;
1505
 
 
1506
 
#ifdef HAVE_METACITY_2_17_0
1507
1466
    else if (strcmp (str, "shade") == 0)
1508
1467
        return META_BUTTON_FUNCTION_SHADE;
1509
1468
    else if (strcmp (str, "above") == 0)
1516
1475
        return META_BUTTON_FUNCTION_UNABOVE;
1517
1476
    else if (strcmp (str, "unstick") == 0)
1518
1477
        return META_BUTTON_FUNCTION_UNSTICK;
1519
 
#endif
1520
 
 
1521
1478
    else
1522
1479
        return META_BUTTON_FUNCTION_LAST;
1523
1480
}
1527
1484
{
1528
1485
    switch (ofwhat)
1529
1486
    {
1530
 
#ifdef HAVE_METACITY_2_17_0
1531
1487
    case META_BUTTON_FUNCTION_SHADE:
1532
1488
        return META_BUTTON_FUNCTION_UNSHADE;
1533
1489
    case META_BUTTON_FUNCTION_UNSHADE:
1542
1498
        return META_BUTTON_FUNCTION_UNSTICK;
1543
1499
    case META_BUTTON_FUNCTION_UNSTICK:
1544
1500
        return META_BUTTON_FUNCTION_STICK;
1545
 
#endif
1546
1501
 
1547
1502
    default:
1548
1503
        return META_BUTTON_FUNCTION_LAST;
1558
1513
    {
1559
1514
        layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST;
1560
1515
        layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST;
1561
 
#ifdef HAVE_METACITY_2_23_2
1562
1516
        layout->left_buttons_has_spacer[i] = FALSE;
1563
1517
        layout->right_buttons_has_spacer[i] = FALSE;
1564
 
#endif
1565
1518
    }
1566
1519
}
1567
1520
 
1592
1545
        while (buttons[b] != NULL)
1593
1546
        {
1594
1547
            f = meta_button_function_from_string (buttons[b]);
1595
 
#ifdef HAVE_METACITY_2_23_2
1596
1548
            if (i > 0 && strcmp ("spacer", buttons[b]) == 0)
1597
1549
            {
1598
1550
               new_layout.left_buttons_has_spacer[i - 1] = TRUE;
1602
1554
                  new_layout.left_buttons_has_spacer[i - 2] = TRUE;
1603
1555
            }
1604
1556
            else
1605
 
#endif
1606
1557
            {
1607
1558
               if (f != META_BUTTON_FUNCTION_LAST && !used[f])
1608
1559
               {
1639
1590
            while (buttons[b] != NULL)
1640
1591
            {
1641
1592
               f = meta_button_function_from_string (buttons[b]);
1642
 
#ifdef HAVE_METACITY_2_23_2
1643
1593
               if (i > 0 && strcmp ("spacer", buttons[b]) == 0)
1644
1594
               {
1645
1595
                  new_layout.right_buttons_has_spacer[i - 1] = TRUE;
1648
1598
                     new_layout.right_buttons_has_spacer[i - 2] = TRUE;
1649
1599
               }
1650
1600
               else
1651
 
#endif
1652
1601
               {
1653
1602
                   if (f != META_BUTTON_FUNCTION_LAST && !used[f])
1654
1603
                   {
1692
1641
        for (j = 0; j < i; ++j)
1693
1642
        {
1694
1643
            rtl_layout.right_buttons[j] = new_layout.left_buttons[i - j - 1];
1695
 
#ifdef HAVE_METACITY_2_23_2
1696
1644
            if (j == 0)
1697
1645
                rtl_layout.right_buttons_has_spacer[i - 1] =
1698
1646
                    new_layout.left_buttons_has_spacer[i - j - 1];
1699
1647
            else
1700
1648
                rtl_layout.right_buttons_has_spacer[j - 1] =
1701
1649
                    new_layout.left_buttons_has_spacer[i - j - 1];
1702
 
#endif
1703
1650
        }
1704
1651
 
1705
1652
        i = 0;
1709
1656
        for (j = 0; j < i; ++j)
1710
1657
        {
1711
1658
            rtl_layout.left_buttons[j] = new_layout.right_buttons[i - j - 1];
1712
 
#ifdef HAVE_METACITY_2_23_2
1713
1659
            if (j == 0)
1714
1660
                rtl_layout.left_buttons_has_spacer[i - 1] =
1715
1661
                    new_layout.right_buttons_has_spacer[i - j - 1];
1716
1662
            else
1717
1663
                rtl_layout.left_buttons_has_spacer[j - 1] =
1718
1664
                    new_layout.right_buttons_has_spacer[i - j - 1];
1719
 
#endif
1720
1665
        }
1721
1666
 
1722
1667
        new_layout = rtl_layout;