~unity-team/unity-window-decorator/uwd.hack

« back to all changes in this revision

Viewing changes to src/metacity.c

  • Committer: Sam Spilsbury
  • Date: 2010-12-09 16:45:02 UTC
  • Revision ID: git-v1:33f287138c730f81be99e41fbcd54fdc46992f76
Add the ability for themes to specify active/inactive shadows, right now shadow values
are hardcoded

Show diffs side-by-side

added added

removed removed

Lines of Context:
1605
1605
}
1606
1606
 
1607
1607
decor_shadow_t *
 
1608
meta_update_shadow (gint shadow_type)
 
1609
{
 
1610
    decor_shadow_options_t opt_active_shadow;
 
1611
    decor_shadow_options_t opt_inactive_shadow;
 
1612
    decor_shadow_options_t opt_no_shadow;
 
1613
    Display                *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
 
1614
    GdkDisplay             *display = gdk_display_get_default ();
 
1615
    GdkScreen              *screen = gdk_display_get_default_screen (display);
 
1616
 
 
1617
    opt_active_shadow.shadow_radius  = shadow_radius;
 
1618
    opt_active_shadow.shadow_opacity = shadow_opacity;
 
1619
 
 
1620
    memcpy (opt_active_shadow.shadow_color, shadow_color, sizeof (shadow_color));
 
1621
 
 
1622
    opt_active_shadow.shadow_offset_x = shadow_offset_x;
 
1623
    opt_active_shadow.shadow_offset_y = shadow_offset_y;
 
1624
 
 
1625
    opt_inactive_shadow.shadow_radius  = 8.0;
 
1626
    opt_inactive_shadow.shadow_opacity = 0.5;
 
1627
 
 
1628
    opt_inactive_shadow.shadow_offset_x = 0;
 
1629
    opt_inactive_shadow.shadow_offset_y = 0;
 
1630
 
 
1631
    memcpy (opt_inactive_shadow.shadow_color, shadow_color, sizeof (shadow_color));
 
1632
 
 
1633
    switch (shadow_type)
 
1634
    {
 
1635
        case SHADOW_TYPE_ACTIVE_NORMAL:
 
1636
            return decor_shadow_create (xdisplay,
 
1637
                                        gdk_x11_screen_get_xscreen (screen),
 
1638
                                        1, 1,
 
1639
                                        _win_extents.left,
 
1640
                                        _win_extents.right,
 
1641
                                        _win_extents.top + titlebar_height,
 
1642
                                        _win_extents.bottom,
 
1643
                                        _win_extents.left -
 
1644
                                        TRANSLUCENT_CORNER_SIZE,
 
1645
                                        _win_extents.right -
 
1646
                                        TRANSLUCENT_CORNER_SIZE,
 
1647
                                        _win_extents.top + titlebar_height -
 
1648
                                        TRANSLUCENT_CORNER_SIZE,
 
1649
                                        _win_extents.bottom -
 
1650
                                        TRANSLUCENT_CORNER_SIZE,
 
1651
                                        &opt_active_shadow,
 
1652
                                        &window_active_context,
 
1653
                                        draw_border_shape,
 
1654
                                        0);
 
1655
            break;
 
1656
        case SHADOW_TYPE_INACTIVE_NORMAL:
 
1657
            return decor_shadow_create (xdisplay,
 
1658
                                        gdk_x11_screen_get_xscreen (screen),
 
1659
                                        1, 1,
 
1660
                                        _win_extents.left,
 
1661
                                        _win_extents.right,
 
1662
                                        _win_extents.top + titlebar_height,
 
1663
                                        _win_extents.bottom,
 
1664
                                        _win_extents.left -
 
1665
                                        TRANSLUCENT_CORNER_SIZE,
 
1666
                                        _win_extents.right -
 
1667
                                        TRANSLUCENT_CORNER_SIZE,
 
1668
                                        _win_extents.top + titlebar_height -
 
1669
                                        TRANSLUCENT_CORNER_SIZE,
 
1670
                                        _win_extents.bottom -
 
1671
                                        TRANSLUCENT_CORNER_SIZE,
 
1672
                                        &opt_inactive_shadow,
 
1673
                                        &window_inactive_context,
 
1674
                                        draw_border_shape,
 
1675
                                        0);
 
1676
        case SHADOW_TYPE_ACTIVE_MAX:
 
1677
            return decor_shadow_create (xdisplay,
 
1678
                                        gdk_x11_screen_get_xscreen (screen),
 
1679
                                        1, 1,
 
1680
                                        _max_win_extents.left,
 
1681
                                        _max_win_extents.right,
 
1682
                                        _max_win_extents.top + max_titlebar_height,
 
1683
                                        _max_win_extents.bottom,
 
1684
                                        _max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
 
1685
                                        _max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
 
1686
                                        _max_win_extents.top + max_titlebar_height -
 
1687
                                        TRANSLUCENT_CORNER_SIZE,
 
1688
                                        _max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
 
1689
                                        &opt_active_shadow,
 
1690
                                        &max_window_active_context,
 
1691
                                        draw_border_shape,
 
1692
                                        (void *) 1);
 
1693
        case SHADOW_TYPE_INACTIVE_MAX:
 
1694
            return decor_shadow_create (xdisplay,
 
1695
                                        gdk_x11_screen_get_xscreen (screen),
 
1696
                                        1, 1,
 
1697
                                        _max_win_extents.left,
 
1698
                                        _max_win_extents.right,
 
1699
                                        _max_win_extents.top + max_titlebar_height,
 
1700
                                        _max_win_extents.bottom,
 
1701
                                        _max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
 
1702
                                        _max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
 
1703
                                        _max_win_extents.top + max_titlebar_height -
 
1704
                                        TRANSLUCENT_CORNER_SIZE,
 
1705
                                        _max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
 
1706
                                        &opt_inactive_shadow,
 
1707
                                        &max_window_active_context,
 
1708
                                        draw_border_shape,
 
1709
                                        (void *) 1);
 
1710
        default:
 
1711
            return NULL;
 
1712
    }
 
1713
 
 
1714
    return NULL;
 
1715
}
 
1716
 
 
1717
void
1608
1718
meta_get_shadow (decor_t *d, gint shadow_type)
1609
1719
{
1610
 
    return NULL;
1611
1720
}
1612
1721
 
 
1722
 
1613
1723
#endif