~ubuntu-branches/ubuntu/utopic/marco/utopic-proposed

« back to all changes in this revision

Viewing changes to src/ui/theme.c

  • Committer: Package Import Robot
  • Author(s): Mike Gabriel
  • Date: 2014-03-11 20:38:14 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140311203814-kyq2m8h0zbk7vymi
Tags: 1.8.0+dfsg1-1
* New upstream release.
* Repack upstream tarball and omit non-DFSG (GFDL-1.1) files
  (creating themes documentation).
* debian/watch:
  + Use tagged CGit tarball snapshots as upstream source.
  + Mangle Debian package version.
* debian/copyright:
  + Adapt to files in new (repacked) upstream tarball.
* debian/rules:
  + Build package using autogen.sh.
* debian/control:
  + Add B-D: yelp-tools.
  + Drop B-D: mate-doc-utils, mate-doc-utils-gnome.
* debian/patches:
  + Drop patch 1001_hypen-used-as-minus-sign-on-man-page.patch. Fixed
    upstream.
  + Add patch 2001_omit-gfdl-licensed-theme-documentation.patch. Don't build
    GFDL-1.1 licensed files that got removed from the repacked tarball.
* debian/marco-common.install: 
  + Marco's arch-indep files now reside in /usr/share/marco (not
    /usr/share/mate-window-manager).
  + Install gsettings conversion map into bin:package marco-common.
* lintian:
  + Drop unused overrides.
  + Add override for shlib-calls-exit in bin:package libmarco-private0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3387
3387
  env->theme = meta_current_theme;
3388
3388
}
3389
3389
 
 
3390
#if GTK_CHECK_VERSION (3, 0, 0)
 
3391
static GtkStateFlags
 
3392
state_flags_from_gtk_state (GtkStateType state)
 
3393
{
 
3394
  switch (state)
 
3395
    {
 
3396
    case GTK_STATE_NORMAL:
 
3397
      return 0;
 
3398
    case GTK_STATE_PRELIGHT:
 
3399
      return GTK_STATE_FLAG_PRELIGHT;
 
3400
    case GTK_STATE_ACTIVE:
 
3401
      return GTK_STATE_FLAG_ACTIVE;
 
3402
    case GTK_STATE_SELECTED:
 
3403
      return GTK_STATE_FLAG_SELECTED;
 
3404
    case GTK_STATE_INSENSITIVE:
 
3405
      return GTK_STATE_FLAG_INSENSITIVE;
 
3406
    case GTK_STATE_INCONSISTENT:
 
3407
      return GTK_STATE_FLAG_INCONSISTENT;
 
3408
    case GTK_STATE_FOCUSED:
 
3409
      return GTK_STATE_FLAG_FOCUSED;
 
3410
    }
 
3411
  return 0;
 
3412
}
 
3413
#endif
 
3414
 
3390
3415
/* This code was originally rendering anti-aliased using X primitives, and
3391
3416
 * now has been switched to draw anti-aliased using cairo. In general, the
3392
3417
 * closest correspondence between X rendering and cairo rendering is given
3402
3427
meta_draw_op_draw_with_env (const MetaDrawOp    *op,
3403
3428
                            GtkStyle            *style_gtk,
3404
3429
                            GtkWidget           *widget,
 
3430
                            #if GTK_CHECK_VERSION(3, 0, 0)
 
3431
                            cairo_t             *cr,
 
3432
                            #else
3405
3433
                            GdkDrawable         *drawable,
3406
3434
                            const GdkRectangle  *clip,
 
3435
                            #endif
3407
3436
                            const MetaDrawInfo  *info,
3408
3437
                            MetaRectangle        rect,
3409
3438
                            MetaPositionExprEnv *env)
3410
3439
{
3411
3440
  GdkColor color;
 
3441
 
 
3442
  #if GTK_CHECK_VERSION(3, 0, 0)
 
3443
  cairo_save(cr);
 
3444
  gtk_style_context_save(style_gtk);
 
3445
  #else
3412
3446
  cairo_t *cr;
3413
 
 
3414
3447
  cr = gdk_cairo_create (drawable);
 
3448
  #endif
3415
3449
 
3416
3450
  cairo_set_line_width (cr, 1.0);
3417
3451
 
 
3452
  #if !GTK_CHECK_VERSION(3, 0, 0)
3418
3453
  if (clip)
3419
3454
    {
3420
3455
      gdk_cairo_rectangle (cr, clip);
3421
3456
      cairo_clip (cr);
3422
3457
    }
3423
 
 
 
3458
  #endif
 
3459
  
3424
3460
  switch (op->type)
3425
3461
    {
3426
3462
    case META_DRAW_LINE:
3686
3722
        rwidth = parse_size_unchecked (op->data.gtk_arrow.width, env);
3687
3723
        rheight = parse_size_unchecked (op->data.gtk_arrow.height, env);
3688
3724
 
 
3725
        #if GTK_CHECK_VERSION(3, 0, 0)
 
3726
 
 
3727
        double size = MAX(rwidth, rheight), angle = 0;
 
3728
 
 
3729
        switch (op->data.gtk_arrow.arrow)
 
3730
          {
 
3731
          case GTK_ARROW_UP:
 
3732
            angle = 0;
 
3733
            break;
 
3734
          case GTK_ARROW_RIGHT:
 
3735
            angle = M_PI / 2;
 
3736
            break;
 
3737
          case GTK_ARROW_DOWN:
 
3738
            angle = M_PI;
 
3739
            break;
 
3740
          case GTK_ARROW_LEFT:
 
3741
            angle = 3 * M_PI / 2;
 
3742
            break;
 
3743
          case GTK_ARROW_NONE:
 
3744
            return;
 
3745
          }
 
3746
 
 
3747
        gtk_style_context_set_state (style_gtk,
 
3748
                                     state_flags_from_gtk_state (op->data.gtk_arrow.state));
 
3749
        gtk_render_arrow (style_gtk, cr, angle, rx, ry, size);
 
3750
 
 
3751
        #else
 
3752
 
3689
3753
        gtk_paint_arrow (style_gtk,
3690
3754
                         drawable,
3691
3755
                         op->data.gtk_arrow.state,
3696
3760
                         op->data.gtk_arrow.arrow,
3697
3761
                         op->data.gtk_arrow.filled,
3698
3762
                         rx, ry, rwidth, rheight);
 
3763
        #endif
3699
3764
      }
3700
3765
      break;
3701
3766
 
3708
3773
        rwidth = parse_size_unchecked (op->data.gtk_box.width, env);
3709
3774
        rheight = parse_size_unchecked (op->data.gtk_box.height, env);
3710
3775
 
 
3776
        #if GTK_CHECK_VERSION(3, 0, 0)
 
3777
        gtk_style_context_set_state (style_gtk,
 
3778
                                     state_flags_from_gtk_state (op->data.gtk_box.state));
 
3779
        gtk_render_background (style_gtk, cr, rx, ry, rwidth, rheight);
 
3780
        gtk_render_frame (style_gtk, cr, rx, ry, rwidth, rheight);
 
3781
        #else
3711
3782
        gtk_paint_box (style_gtk,
3712
3783
                       drawable,
3713
3784
                       op->data.gtk_box.state,
3716
3787
                       widget,
3717
3788
                       "marco",
3718
3789
                       rx, ry, rwidth, rheight);
 
3790
        #endif
3719
3791
      }
3720
3792
      break;
3721
3793
 
3727
3799
        ry1 = parse_y_position_unchecked (op->data.gtk_vline.y1, env);
3728
3800
        ry2 = parse_y_position_unchecked (op->data.gtk_vline.y2, env);
3729
3801
 
 
3802
        #if GTK_CHECK_VERSION(3, 0, 0)
 
3803
        gtk_style_context_set_state (style_gtk,
 
3804
                                     state_flags_from_gtk_state (op->data.gtk_vline.state));
 
3805
        gtk_render_line (style_gtk, cr, rx, ry1, rx, ry2);
 
3806
        #else
3730
3807
        gtk_paint_vline (style_gtk,
3731
3808
                         drawable,
3732
3809
                         op->data.gtk_vline.state,
3734
3811
                         widget,
3735
3812
                         "marco",
3736
3813
                         ry1, ry2, rx);
 
3814
        #endif
3737
3815
      }
3738
3816
      break;
3739
3817
 
3772
3850
          rx = parse_x_position_unchecked (op->data.title.x, env);
3773
3851
          ry = parse_y_position_unchecked (op->data.title.y, env);
3774
3852
 
 
3853
          if (rx - env->rect.x + env->title_width >= env->rect.width)
 
3854
          {
 
3855
            const double alpha_margin = 30.0;
 
3856
            int text_space = env->rect.x + env->rect.width -
 
3857
                             (rx - env->rect.x) - env->right_width;
 
3858
 
 
3859
            double startalpha = 1.0 - (alpha_margin/((double)text_space));
 
3860
 
 
3861
            cairo_pattern_t *linpat;
 
3862
            linpat = cairo_pattern_create_linear (rx, ry, text_space,
 
3863
                                                  env->title_height);
 
3864
            cairo_pattern_add_color_stop_rgb (linpat, 0, color.red/65535.0,
 
3865
                                                         color.green/65535.0,
 
3866
                                                         color.blue/65535.0);
 
3867
            cairo_pattern_add_color_stop_rgb (linpat, startalpha,
 
3868
                                                      color.red/65535.0,
 
3869
                                                      color.green/65535.0,
 
3870
                                                      color.blue/65535.0);
 
3871
            cairo_pattern_add_color_stop_rgba (linpat, 1, color.red/65535.0,
 
3872
                                                          color.green/65535.0,
 
3873
                                                          color.blue/65535.0, 0);
 
3874
            cairo_set_source(cr, linpat);
 
3875
            cairo_pattern_destroy(linpat);
 
3876
          } else {
 
3877
            gdk_cairo_set_source_color (cr, &color);
 
3878
          }
 
3879
 
3775
3880
          cairo_move_to (cr, rx, ry);
3776
3881
          pango_cairo_show_layout (cr, info->title_layout);
3777
3882
        }
3787
3892
        d_rect.height = parse_size_unchecked (op->data.op_list.height, env);
3788
3893
 
3789
3894
        meta_draw_op_list_draw_with_style (op->data.op_list.op_list,
3790
 
                                           style_gtk, widget, drawable, clip, info,
3791
 
                                           d_rect);
 
3895
                                           style_gtk, widget,
 
3896
                                           #if GTK_CHECK_VERSION(3, 0, 0)
 
3897
                                           cr,
 
3898
                                           #else
 
3899
                                           drawable, clip,
 
3900
                                           #endif
 
3901
                                           info, d_rect);
3792
3902
      }
3793
3903
      break;
3794
3904
 
3796
3906
      {
3797
3907
        int rx, ry, rwidth, rheight;
3798
3908
        int tile_xoffset, tile_yoffset;
 
3909
        #if !GTK_CHECK_VERSION(3, 0, 0)
3799
3910
        GdkRectangle new_clip;
 
3911
        #endif
3800
3912
        MetaRectangle tile;
3801
3913
 
3802
3914
        rx = parse_x_position_unchecked (op->data.tile.x, env);
3804
3916
        rwidth = parse_size_unchecked (op->data.tile.width, env);
3805
3917
        rheight = parse_size_unchecked (op->data.tile.height, env);
3806
3918
 
 
3919
        #if GTK_CHECK_VERSION(3, 0, 0)
 
3920
        cairo_save (cr);
 
3921
 
 
3922
        cairo_rectangle (cr, rx, ry, rwidth, rheight);
 
3923
        cairo_clip (cr);
 
3924
 
 
3925
        tile_xoffset = parse_x_position_unchecked (op->data.tile.tile_xoffset, env);
 
3926
        tile_yoffset = parse_y_position_unchecked (op->data.tile.tile_yoffset, env);
 
3927
        /* tile offset should not include x/y */
 
3928
        tile_xoffset -= rect.x;
 
3929
        tile_yoffset -= rect.y;
 
3930
        
 
3931
        tile.width = parse_size_unchecked (op->data.tile.tile_width, env);
 
3932
        tile.height = parse_size_unchecked (op->data.tile.tile_height, env);
 
3933
 
 
3934
        tile.x = rx - tile_xoffset;
 
3935
    
 
3936
        while (tile.x < (rx + rwidth))
 
3937
          {
 
3938
            tile.y = ry - tile_yoffset;
 
3939
            while (tile.y < (ry + rheight))
 
3940
              {
 
3941
                meta_draw_op_list_draw_with_style (op->data.tile.op_list,
 
3942
                                                   style_gtk, widget, cr, info,
 
3943
                                                   tile);
 
3944
 
 
3945
                tile.y += tile.height;
 
3946
              }
 
3947
 
 
3948
            tile.x += tile.width;
 
3949
          }
 
3950
        cairo_restore (cr);
 
3951
 
 
3952
        #else
 
3953
 
3807
3954
        new_clip.x = rx;
3808
3955
        new_clip.y = ry;
3809
3956
        new_clip.width = rwidth;
3838
3985
                tile.x += tile.width;
3839
3986
              }
3840
3987
          }
 
3988
        #endif
3841
3989
      }
3842
3990
      break;
3843
3991
    }
3849
3997
meta_draw_op_draw_with_style (const MetaDrawOp    *op,
3850
3998
                              GtkStyle            *style_gtk,
3851
3999
                              GtkWidget           *widget,
 
4000
                              #if GTK_CHECK_VERSION(3, 0, 0)
 
4001
                              cairo_t             *cr,
 
4002
                              #else
3852
4003
                              GdkDrawable         *drawable,
3853
4004
                              const GdkRectangle  *clip,
 
4005
                              #endif
3854
4006
                              const MetaDrawInfo  *info,
3855
4007
                              MetaRectangle        logical_region)
3856
4008
{
3857
4009
  MetaPositionExprEnv env;
3858
4010
 
 
4011
  #if !GTK_CHECK_VERSION(3, 0, 0)
3859
4012
  g_return_if_fail (style_gtk->colormap == gdk_drawable_get_colormap (drawable));
 
4013
  #endif
3860
4014
 
3861
4015
  fill_env (&env, info, logical_region);
3862
4016
 
3863
 
  meta_draw_op_draw_with_env (op, style_gtk, widget, drawable, clip,
 
4017
  meta_draw_op_draw_with_env (op, style_gtk, widget,
 
4018
                              #if GTK_CHECK_VERSION(3, 0, 0)
 
4019
                              cr,
 
4020
                              #else
 
4021
                              drawable, clip,
 
4022
                              #endif
3864
4023
                              info, logical_region,
3865
4024
                              &env);
3866
4025
 
3869
4028
void
3870
4029
meta_draw_op_draw (const MetaDrawOp    *op,
3871
4030
                   GtkWidget           *widget,
 
4031
                   #if GTK_CHECK_VERSION(3, 0, 0)
 
4032
                   cairo_t             *cr,
 
4033
                   #else
3872
4034
                   GdkDrawable         *drawable,
3873
4035
                   const GdkRectangle  *clip,
 
4036
                   #endif
3874
4037
                   const MetaDrawInfo  *info,
3875
4038
                   MetaRectangle        logical_region)
3876
4039
{
3877
4040
  meta_draw_op_draw_with_style (op, gtk_widget_get_style (widget), widget,
3878
 
                                drawable, clip, info, logical_region);
 
4041
                                #if GTK_CHECK_VERSION(3, 0, 0)
 
4042
                                cr,
 
4043
                                #else
 
4044
                                drawable, clip,
 
4045
                                #endif
 
4046
                                info, logical_region);
3879
4047
}
3880
4048
 
3881
4049
MetaDrawOpList*
3929
4097
meta_draw_op_list_draw_with_style  (const MetaDrawOpList *op_list,
3930
4098
                                    GtkStyle             *style_gtk,
3931
4099
                                    GtkWidget            *widget,
 
4100
                                    #if GTK_CHECK_VERSION(3, 0, 0)
 
4101
                                    cairo_t              *cr,
 
4102
                                    #else
3932
4103
                                    GdkDrawable          *drawable,
3933
4104
                                    const GdkRectangle   *clip,
 
4105
                                    #endif
3934
4106
                                    const MetaDrawInfo   *info,
3935
4107
                                    MetaRectangle         rect)
3936
4108
{
 
4109
  /* BOOKMARK */
 
4110
 
3937
4111
  int i;
 
4112
  #if !GTK_CHECK_VERSION(3, 0, 0)
3938
4113
  GdkRectangle active_clip;
3939
4114
  GdkRectangle orig_clip;
 
4115
  #endif
3940
4116
  MetaPositionExprEnv env;
3941
4117
 
 
4118
  #if !GTK_CHECK_VERSION(3, 0, 0)
3942
4119
  g_return_if_fail (style_gtk->colormap == gdk_drawable_get_colormap (drawable));
 
4120
  #endif
3943
4121
 
3944
4122
  if (op_list->n_ops == 0)
3945
4123
    return;
3957
4135
   * evaluated), we make an array of those, and then fold
3958
4136
   * adjacent items when possible.
3959
4137
   */
 
4138
  
 
4139
  #if GTK_CHECK_VERSION(3, 0, 0)
 
4140
  cairo_save(cr);
 
4141
  #else
3960
4142
  if (clip)
3961
4143
    {
3962
4144
      orig_clip = *clip;
3970
4152
    }
3971
4153
 
3972
4154
  active_clip = orig_clip;
 
4155
  #endif
3973
4156
 
3974
4157
  for (i = 0; i < op_list->n_ops; i++)
3975
4158
    {
3976
4159
      MetaDrawOp *op = op_list->ops[i];
3977
4160
 
 
4161
      #if GTK_CHECK_VERSION(3, 0, 0)
 
4162
      if (op->type == META_DRAW_CLIP)
 
4163
        {
 
4164
          cairo_restore (cr);
 
4165
 
 
4166
          cairo_rectangle (cr, 
 
4167
                           parse_x_position_unchecked (op->data.clip.x, &env),
 
4168
                           parse_y_position_unchecked (op->data.clip.y, &env),
 
4169
                           parse_size_unchecked (op->data.clip.width, &env),
 
4170
                           parse_size_unchecked (op->data.clip.height, &env));
 
4171
          cairo_clip (cr);
 
4172
          
 
4173
          cairo_save (cr);
 
4174
        }
 
4175
      else if (gdk_cairo_get_clip_rectangle (cr, NULL))
 
4176
        {
 
4177
          meta_draw_op_draw_with_env (op,
 
4178
                                      style_gtk, widget, cr, info,
 
4179
                                      rect,
 
4180
                                      &env);
 
4181
        }
 
4182
 
 
4183
      #else
 
4184
 
3978
4185
      if (op->type == META_DRAW_CLIP)
3979
4186
        {
3980
4187
          active_clip.x = parse_x_position_unchecked (op->data.clip.x, &env);
3992
4199
                                      rect,
3993
4200
                                      &env);
3994
4201
        }
 
4202
      #endif
3995
4203
    }
 
4204
 
 
4205
    #if GTK_CHECK_VERSION(3, 0, 0)
 
4206
    cairo_restore(cr);
 
4207
    #endif
3996
4208
}
3997
4209
 
3998
4210
void
3999
4211
meta_draw_op_list_draw  (const MetaDrawOpList *op_list,
4000
4212
                         GtkWidget            *widget,
 
4213
                         #if GTK_CHECK_VERSION(3, 0, 0)
 
4214
                         cairo_t              *cr,
 
4215
                         #else
4001
4216
                         GdkDrawable          *drawable,
4002
4217
                         const GdkRectangle   *clip,
 
4218
                         #endif
4003
4219
                         const MetaDrawInfo   *info,
4004
4220
                         MetaRectangle         rect)
4005
4221
 
4006
4222
{
4007
4223
  meta_draw_op_list_draw_with_style (op_list, gtk_widget_get_style (widget), widget,
4008
 
                                     drawable, clip, info, rect);
 
4224
                                     #if GTK_CHECK_VERSION(3, 0, 0)
 
4225
                                     cr,
 
4226
                                     #else
 
4227
                                     drawable, clip,
 
4228
                                     #endif
 
4229
                                     info, rect);
4009
4230
}
4010
4231
 
4011
4232
void
4313
4534
meta_frame_style_draw_with_style (MetaFrameStyle          *style,
4314
4535
                                  GtkStyle                *style_gtk,
4315
4536
                                  GtkWidget               *widget,
 
4537
                                  #if GTK_CHECK_VERSION(3, 0, 0)
 
4538
                                  cairo_t                 *cr,
 
4539
                                  #else
4316
4540
                                  GdkDrawable             *drawable,
4317
4541
                                  int                      x_offset,
4318
4542
                                  int                      y_offset,
4319
4543
                                  const GdkRectangle      *clip,
 
4544
                                  #endif
4320
4545
                                  const MetaFrameGeometry *fgeom,
4321
4546
                                  int                      client_width,
4322
4547
                                  int                      client_height,
4326
4551
                                  GdkPixbuf               *mini_icon,
4327
4552
                                  GdkPixbuf               *icon)
4328
4553
{
 
4554
    /* BOOKMARK */
4329
4555
  int i, j;
4330
4556
  GdkRectangle titlebar_rect;
4331
4557
  GdkRectangle left_titlebar_edge;
4336
4562
  PangoRectangle extents;
4337
4563
  MetaDrawInfo draw_info;
4338
4564
 
 
4565
  #if !GTK_CHECK_VERSION(3, 0, 0)
4339
4566
  g_return_if_fail (style_gtk->colormap == gdk_drawable_get_colormap (drawable));
 
4567
  #endif
4340
4568
 
4341
4569
  titlebar_rect.x = 0;
4342
4570
  titlebar_rect.y = 0;
4394
4622
  while (i < META_FRAME_PIECE_LAST)
4395
4623
    {
4396
4624
      GdkRectangle rect;
 
4625
      #if !GTK_CHECK_VERSION(3, 0, 0)
4397
4626
      GdkRectangle combined_clip;
 
4627
      #endif
4398
4628
 
4399
4629
      switch ((MetaFramePiece) i)
4400
4630
        {
4461
4691
          break;
4462
4692
        }
4463
4693
 
 
4694
      #if GTK_CHECK_VERSION(3, 0, 0)
 
4695
 
 
4696
      cairo_save (cr);
 
4697
 
 
4698
      gdk_cairo_rectangle (cr, &rect);
 
4699
      cairo_clip (cr);
 
4700
 
 
4701
      if (gdk_cairo_get_clip_rectangle (cr, NULL))
 
4702
        {
 
4703
          MetaDrawOpList *op_list;
 
4704
          MetaFrameStyle *parent;
 
4705
 
 
4706
          parent = style;
 
4707
          op_list = NULL;
 
4708
          while (parent && op_list == NULL)
 
4709
            {
 
4710
              op_list = parent->pieces[i];
 
4711
              parent = parent->parent;
 
4712
            }
 
4713
 
 
4714
          if (op_list)
 
4715
            {
 
4716
              MetaRectangle m_rect;
 
4717
              m_rect = meta_rect (rect.x, rect.y, rect.width, rect.height);
 
4718
              meta_draw_op_list_draw_with_style (op_list,
 
4719
                                                 style_gtk,
 
4720
                                                 widget,
 
4721
                                                 cr,
 
4722
                                                 &draw_info,
 
4723
                                                 m_rect);
 
4724
            }
 
4725
        }
 
4726
 
 
4727
      cairo_restore (cr);
 
4728
 
 
4729
      #else
 
4730
 
4464
4731
      rect.x += x_offset;
4465
4732
      rect.y += y_offset;
4466
4733
 
4498
4765
            }
4499
4766
        }
4500
4767
 
 
4768
      #endif
 
4769
 
4501
4770
 
4502
4771
      /* Draw buttons just before overlay */
 
4772
      #if GTK_CHECK_VERSION(3, 0, 0)
 
4773
 
 
4774
      if ((i + 1) == META_FRAME_PIECE_OVERLAY)
 
4775
        {
 
4776
          MetaDrawOpList *op_list;
 
4777
          int middle_bg_offset;
 
4778
 
 
4779
          middle_bg_offset = 0;
 
4780
          j = 0;
 
4781
          while (j < META_BUTTON_TYPE_LAST)
 
4782
            {
 
4783
 
 
4784
              button_rect (j, fgeom, middle_bg_offset, &rect);
 
4785
 
 
4786
              op_list = get_button (style, j, button_states[j]);
 
4787
              
 
4788
              if (op_list)
 
4789
                {
 
4790
                  cairo_save (cr);
 
4791
                  gdk_cairo_rectangle (cr, &rect);
 
4792
                  cairo_clip (cr);
 
4793
 
 
4794
                  if (gdk_cairo_get_clip_rectangle (cr, NULL))
 
4795
                    {
 
4796
                      MetaRectangle m_rect;
 
4797
 
 
4798
                      m_rect = meta_rect (rect.x, rect.y,
 
4799
                                          rect.width, rect.height);
 
4800
 
 
4801
                      meta_draw_op_list_draw_with_style (op_list,
 
4802
                                                         style_gtk,
 
4803
                                                         widget,
 
4804
                                                         cr,
 
4805
                                                         &draw_info,
 
4806
                                                         m_rect);
 
4807
                    }
 
4808
 
 
4809
                  cairo_restore (cr);
 
4810
                }
 
4811
 
 
4812
              /* MIDDLE_BACKGROUND type may get drawn more than once */
 
4813
              if ((j == META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND ||
 
4814
                   j == META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND) &&
 
4815
                  middle_bg_offset < MAX_MIDDLE_BACKGROUNDS)
 
4816
                {
 
4817
                  ++middle_bg_offset;
 
4818
                }
 
4819
              else
 
4820
                {
 
4821
                  middle_bg_offset = 0;
 
4822
                  ++j;
 
4823
                }
 
4824
            }
 
4825
        }
 
4826
 
 
4827
      #else
 
4828
 
4503
4829
      if ((i + 1) == META_FRAME_PIECE_OVERLAY)
4504
4830
        {
4505
4831
          int middle_bg_offset;
4556
4882
            }
4557
4883
        }
4558
4884
 
 
4885
      #endif
 
4886
 
4559
4887
      ++i;
4560
4888
    }
4561
4889
}
4563
4891
void
4564
4892
meta_frame_style_draw (MetaFrameStyle          *style,
4565
4893
                       GtkWidget               *widget,
 
4894
                       #if GTK_CHECK_VERSION(3, 0, 0)
 
4895
                       cairo_t                 *cr,
 
4896
                       #else
4566
4897
                       GdkDrawable             *drawable,
4567
4898
                       int                      x_offset,
4568
4899
                       int                      y_offset,
4569
4900
                       const GdkRectangle      *clip,
 
4901
                       #endif
4570
4902
                       const MetaFrameGeometry *fgeom,
4571
4903
                       int                      client_width,
4572
4904
                       int                      client_height,
4577
4909
                       GdkPixbuf               *icon)
4578
4910
{
4579
4911
  meta_frame_style_draw_with_style (style, gtk_widget_get_style (widget), widget,
4580
 
                                    drawable, x_offset, y_offset,
4581
 
                                    clip, fgeom, client_width, client_height,
 
4912
                                    #if GTK_CHECK_VERSION(3, 0, 0)
 
4913
                                    cr,
 
4914
                                    #else
 
4915
                                    drawable, x_offset, y_offset, clip,
 
4916
                                    #endif
 
4917
                                    fgeom, client_width, client_height,
4582
4918
                                    title_layout, text_height,
4583
4919
                                    button_states, mini_icon, icon);
4584
4920
}
5133
5469
meta_theme_draw_frame_with_style (MetaTheme              *theme,
5134
5470
                                  GtkStyle               *style_gtk,
5135
5471
                                  GtkWidget              *widget,
 
5472
                                  #if GTK_CHECK_VERSION(3, 0, 0)
 
5473
                                  cairo_t                *cr,
 
5474
                                  #else
5136
5475
                                  GdkDrawable            *drawable,
5137
5476
                                  const GdkRectangle     *clip,
5138
5477
                                  int                     x_offset,
5139
5478
                                  int                     y_offset,
 
5479
                                  #endif
5140
5480
                                  MetaFrameType           type,
5141
5481
                                  MetaFrameFlags          flags,
5142
5482
                                  int                     client_width,
5170
5510
  meta_frame_style_draw_with_style (style,
5171
5511
                                    style_gtk,
5172
5512
                                    widget,
5173
 
                                    drawable,
5174
 
                                    x_offset, y_offset,
5175
 
                                    clip,
 
5513
                                    #if GTK_CHECK_VERSION(3, 0, 0)
 
5514
                                    cr,
 
5515
                                    #else
 
5516
                                    drawable, x_offset, y_offset, clip,
 
5517
                                    #endif
5176
5518
                                    &fgeom,
5177
5519
                                    client_width, client_height,
5178
5520
                                    title_layout,
5184
5526
void
5185
5527
meta_theme_draw_frame (MetaTheme              *theme,
5186
5528
                       GtkWidget              *widget,
 
5529
                       #if GTK_CHECK_VERSION(3, 0, 0)
 
5530
                       cairo_t                *cr,
 
5531
                       #else
5187
5532
                       GdkDrawable            *drawable,
5188
5533
                       const GdkRectangle     *clip,
5189
5534
                       int                     x_offset,
5190
5535
                       int                     y_offset,
 
5536
                       #endif
5191
5537
                       MetaFrameType           type,
5192
5538
                       MetaFrameFlags          flags,
5193
5539
                       int                     client_width,
5200
5546
                       GdkPixbuf              *icon)
5201
5547
{
5202
5548
  meta_theme_draw_frame_with_style (theme, gtk_widget_get_style (widget), widget,
5203
 
                                    drawable, clip, x_offset, y_offset, type,flags,
5204
 
                                    client_width, client_height,
 
5549
                                    #if GTK_CHECK_VERSION(3, 0, 0)
 
5550
                                    cr,
 
5551
                                    #else
 
5552
                                    drawable, clip, x_offset, y_offset,
 
5553
                                    #endif
 
5554
                                    type, flags, client_width, client_height,
5205
5555
                                    title_layout, text_height,
5206
5556
                                    button_layout, button_states,
5207
5557
                                    mini_icon, icon);
5210
5560
void
5211
5561
meta_theme_draw_frame_by_name (MetaTheme              *theme,
5212
5562
                               GtkWidget              *widget,
 
5563
                               #if GTK_CHECK_VERSION(3, 0, 0)
 
5564
                               cairo_t                *cr,
 
5565
                               #else
5213
5566
                               GdkDrawable            *drawable,
5214
5567
                               const GdkRectangle     *clip,
5215
5568
                               int                     x_offset,
5216
5569
                               int                     y_offset,
 
5570
                               #endif
5217
5571
                               const gchar             *style_name,
5218
5572
                               MetaFrameFlags          flags,
5219
5573
                               int                     client_width,
5244
5598
 
5245
5599
  meta_frame_style_draw (style,
5246
5600
                         widget,
5247
 
                         drawable,
5248
 
                         x_offset, y_offset,
5249
 
                         clip,
 
5601
                         #if GTK_CHECK_VERSION(3, 0, 0)
 
5602
                         cr,
 
5603
                         #else
 
5604
                         drawable, x_offset, y_offset, clip,
 
5605
                         #endif
5250
5606
                         &fgeom,
5251
5607
                         client_width, client_height,
5252
5608
                         title_layout,