~muktupavels/metacity/lp1403583

« back to all changes in this revision

Viewing changes to src/ui/theme.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Shachnev
  • Date: 2014-11-18 18:13:01 UTC
  • mfrom: (2.3.7 vivid-proposed)
  • Revision ID: package-import@ubuntu.com-20141118181301-omfi79vghwycfal2
Tags: 1:3.14.2-0ubuntu1
* Merge with Debian unstable, remaining changes:
  - 05_raise_on_click_for_click_mode.patch:
    Force raise on click option.
  - 22_fix_above_tab_switching.patch:
    For Above_Tab, don't compare keysym (fixes group switching).
  - debian/metacity-common.links:
    Show keybindings in Unity control center.
  - Use Ubuntu Desktop team Vcs fields.
* Drop all other patches, they were needed only for Unity 2D.
* New upstream bugfix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
/* Metacity Theme Rendering */
4
4
 
5
 
/* 
 
5
/*
6
6
 * Copyright (C) 2001 Havoc Pennington
7
 
 * 
 
7
 *
8
8
 * This program is free software; you can redistribute it and/or
9
9
 * modify it under the terms of the GNU General Public License as
10
10
 * published by the Free Software Foundation; either version 2 of the
14
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of
15
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
16
 * General Public License for more details.
17
 
 * 
 
17
 *
18
18
 * You should have received a copy of the GNU General Public License
19
19
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20
20
 */
32
32
typedef struct _MetaDrawOp MetaDrawOp;
33
33
typedef struct _MetaDrawOpList MetaDrawOpList;
34
34
typedef struct _MetaGradientSpec MetaGradientSpec;
35
 
typedef struct _MetaAlphaGradientSpec MetaAlphaGradientSpec; 
 
35
typedef struct _MetaAlphaGradientSpec MetaAlphaGradientSpec;
36
36
typedef struct _MetaColorSpec MetaColorSpec;
37
37
typedef struct _MetaFrameLayout MetaFrameLayout;
38
38
typedef struct _MetaButtonSpace MetaButtonSpace;
130
130
{
131
131
  /** Reference count. */
132
132
  int refcount;
133
 
  
 
133
 
134
134
  /** Size of left side */
135
135
  int left_width;
136
136
  /** Size of right side */
137
137
  int right_width;
138
138
  /** Size of bottom side */
139
139
  int bottom_height;
140
 
  
 
140
 
141
141
  /** Border of blue title region
142
142
   * \bug (blue?!)
143
143
   **/
145
145
 
146
146
  /** Extra height for inside of title region, above the font height */
147
147
  int title_vertical_pad;
148
 
  
 
148
 
149
149
  /** Right indent of buttons from edges of frame */
150
150
  int right_titlebar_edge;
151
151
  /** Left indent of buttons from edges of frame */
152
152
  int left_titlebar_edge;
153
 
  
 
153
 
154
154
  /**
155
155
   * Sizing rule of buttons, either META_BUTTON_SIZING_ASPECT
156
156
   * (in which case button_aspect will be honoured, and
166
166
   * Otherwise we figure out the height from the button_border.
167
167
   */
168
168
  double button_aspect;
169
 
  
 
169
 
170
170
  /** Width of a button; set even when we are using aspect sizing */
171
171
  int button_width;
172
172
 
178
178
 
179
179
  /** scale factor for title text */
180
180
  double title_scale;
181
 
  
 
181
 
182
182
  /** Whether title text will be displayed */
183
183
  guint has_title : 1;
184
184
 
220
220
  int bottom_height;
221
221
 
222
222
  int width;
223
 
  int height;  
 
223
  int height;
224
224
 
225
225
  GdkRectangle title_rect;
226
226
 
231
231
 
232
232
  /* used for a memset hack */
233
233
#define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
234
 
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, right_right_background) + sizeof (GdkRectangle) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
235
 
  
 
234
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, right_single_background) + sizeof (GdkRectangle) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
 
235
 
236
236
  /* The button rects (if changed adjust memset hack) */
237
237
  MetaButtonSpace close_rect;
238
238
  MetaButtonSpace max_rect;
239
239
  MetaButtonSpace min_rect;
240
240
  MetaButtonSpace menu_rect;
 
241
  MetaButtonSpace appmenu_rect;
241
242
  MetaButtonSpace shade_rect;
242
243
  MetaButtonSpace above_rect;
243
244
  MetaButtonSpace stick_rect;
246
247
  MetaButtonSpace unstick_rect;
247
248
 
248
249
#define MAX_MIDDLE_BACKGROUNDS (MAX_BUTTONS_PER_CORNER - 2)
249
 
  GdkRectangle left_single_background;
250
250
  GdkRectangle left_left_background;
251
251
  GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
252
252
  GdkRectangle left_right_background;
253
 
  GdkRectangle right_single_background;
 
253
  GdkRectangle left_single_background;
254
254
  GdkRectangle right_left_background;
255
255
  GdkRectangle right_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
256
256
  GdkRectangle right_right_background;
 
257
  GdkRectangle right_single_background;
257
258
  /* End of button rects (if changed adjust memset hack) */
258
259
 
259
260
  /* Saved button layout */
278
279
{
279
280
  META_COLOR_SPEC_BASIC,
280
281
  META_COLOR_SPEC_GTK,
 
282
  META_COLOR_SPEC_GTK_CUSTOM,
281
283
  META_COLOR_SPEC_BLEND,
282
284
  META_COLOR_SPEC_SHADE
283
285
} MetaColorSpecType;
308
310
      GtkStateFlags state;
309
311
    } gtk;
310
312
    struct {
 
313
      char *color_name;
 
314
      MetaColorSpec *fallback;
 
315
    } gtkcustom;
 
316
    struct {
311
317
      MetaColorSpec *foreground;
312
318
      MetaColorSpec *background;
313
319
      double alpha;
360
366
 
361
367
  /** Clip to a rectangle */
362
368
  META_DRAW_CLIP,
363
 
  
 
369
 
364
370
  /* Texture thingies */
365
371
 
366
372
  /** Just a filled rectangle with alpha */
367
373
  META_DRAW_TINT,
368
374
  META_DRAW_GRADIENT,
369
375
  META_DRAW_IMAGE,
370
 
  
 
376
 
371
377
  /** GTK theme engine stuff */
372
378
  META_DRAW_GTK_ARROW,
373
379
  META_DRAW_GTK_BOX,
453
459
   * otherwise it is zero.
454
460
   */
455
461
  int value;
456
 
  
 
462
 
457
463
  /** A list of tokens in the expression. */
458
464
  PosToken *tokens;
459
465
 
511
517
      MetaDrawSpec *width;
512
518
      MetaDrawSpec *height;
513
519
    } clip;
514
 
    
 
520
 
515
521
    struct {
516
522
      MetaColorSpec *color_spec;
517
523
      MetaAlphaGradientSpec *alpha_spec;
545
551
      unsigned int vertical_stripes : 1;
546
552
      unsigned int horizontal_stripes : 1;
547
553
    } image;
548
 
    
 
554
 
549
555
    struct {
550
556
      GtkStateFlags state;
551
557
      GtkShadowType shadow;
571
577
      GtkStateFlags state;
572
578
      MetaDrawSpec *x;
573
579
      MetaDrawSpec *y1;
574
 
      MetaDrawSpec *y2;  
 
580
      MetaDrawSpec *y2;
575
581
    } gtk_vline;
576
582
 
577
583
    struct {
587
593
      MetaColorSpec *color_spec;
588
594
      MetaDrawSpec *x;
589
595
      MetaDrawSpec *y;
 
596
      MetaDrawSpec *ellipsize_width;
590
597
    } title;
591
598
 
592
599
    struct {
608
615
      MetaDrawSpec *tile_width;
609
616
      MetaDrawSpec *tile_height;
610
617
    } tile;
611
 
    
 
618
 
612
619
  } data;
613
620
};
614
621
 
642
649
  META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND,
643
650
  META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND,
644
651
  META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND,
 
652
  META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND,
645
653
  META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND,
646
654
  META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND,
647
655
  META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND,
 
656
  META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND,
648
657
  META_BUTTON_TYPE_CLOSE,
649
658
  META_BUTTON_TYPE_MAXIMIZE,
650
659
  META_BUTTON_TYPE_MINIMIZE,
651
660
  META_BUTTON_TYPE_MENU,
 
661
  META_BUTTON_TYPE_APPMENU,
652
662
  META_BUTTON_TYPE_SHADE,
653
663
  META_BUTTON_TYPE_ABOVE,
654
664
  META_BUTTON_TYPE_STICK,
681
691
   *   |       rather than   |
682
692
   *
683
693
   */
684
 
  
 
694
 
685
695
  /* entire frame */
686
696
  META_FRAME_PIECE_ENTIRE_BACKGROUND,
687
697
  /* entire titlebar background */
755
765
};
756
766
 
757
767
/* Kinds of frame...
758
 
 * 
 
768
 *
759
769
 *  normal ->   noresize / vert only / horz only / both
760
770
 *              focused / unfocused
761
771
 *  max    ->   focused / unfocused
767
777
 *
768
778
 * 14 window states times 7 or 8 window types. Except some
769
779
 * window types never get a frame so that narrows it down a bit.
770
 
 * 
 
780
 *
771
781
 */
772
782
typedef enum
773
783
{
886
896
  GQuark quark_icon_height;
887
897
  GQuark quark_title_width;
888
898
  GQuark quark_title_height;
 
899
  GQuark quark_frame_x_center;
 
900
  GQuark quark_frame_y_center;
889
901
};
890
902
 
891
903
struct _MetaPositionExprEnv
901
913
  int bottom_height;
902
914
  int title_width;
903
915
  int title_height;
 
916
  int frame_x_center;
 
917
  int frame_y_center;
904
918
  int mini_icon_width;
905
919
  int mini_icon_height;
906
920
  int icon_width;
916
930
void             meta_frame_layout_get_borders   (const MetaFrameLayout *layout,
917
931
                                                  int                    text_height,
918
932
                                                  MetaFrameFlags         flags,
919
 
                                                  int                   *top_height,
920
 
                                                  int                   *bottom_height,
921
 
                                                  int                   *left_width,
922
 
                                                  int                   *right_width);
 
933
                                                  MetaFrameBorders      *borders);
923
934
 
924
935
gboolean         meta_frame_layout_validate      (const MetaFrameLayout *layout,
925
936
                                                  GError               **error);
1058
1069
                                   MetaFrameType      type,
1059
1070
                                   int                text_height,
1060
1071
                                   MetaFrameFlags     flags,
1061
 
                                   int               *top_height,
1062
 
                                   int               *bottom_height,
1063
 
                                   int               *left_width,
1064
 
                                   int               *right_width);
 
1072
                                   MetaFrameBorders  *borders);
1065
1073
void meta_theme_calc_geometry (MetaTheme              *theme,
1066
1074
                               MetaFrameType           type,
1067
1075
                               int                     text_height,
1070
1078
                               int                     client_height,
1071
1079
                               const MetaButtonLayout *button_layout,
1072
1080
                               MetaFrameGeometry      *fgeom);
1073
 
                                   
 
1081
 
1074
1082
MetaFrameLayout*   meta_theme_lookup_layout       (MetaTheme         *theme,
1075
1083
                                                   const char        *name);
1076
1084
void               meta_theme_insert_layout       (MetaTheme         *theme,