~gnome3-team/mutter/trunk

« back to all changes in this revision

Viewing changes to src/theme.c

  • Committer: rhp
  • Date: 2001-06-02 04:14:18 UTC
  • Revision ID: git-v1:e47c4d16a27aae7c3b8831b9855f25a9dfb8473f
...

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
{
29
29
  PangoLayout *layout;
30
30
  GC text_gc;
 
31
  GC fg_gc;
 
32
  int title_height;
31
33
};
32
34
 
33
35
static gpointer
47
49
 
48
50
  color.red = color.green = color.blue = 0xffff;
49
51
  vals.foreground = meta_get_x_pixel (info->screen, &color);
 
52
  /* FIXME memory-inefficient, could use the same one for all frames
 
53
   * w/ the same root window
 
54
   */
50
55
  d->text_gc = XCreateGC (info->display,
51
56
                          RootWindowOfScreen (info->screen),
52
57
                          GCForeground,
53
58
                          &vals);
 
59
  d->fg_gc = XCreateGC (info->display,
 
60
                        RootWindowOfScreen (info->screen),
 
61
                        GCForeground,
 
62
                        &vals);
 
63
  
 
64
  d->title_height = 0;
54
65
  
55
66
  return d;
56
67
}
67
78
    g_object_unref (G_OBJECT (d->layout));
68
79
 
69
80
  XFreeGC (info->display, d->text_gc);
 
81
  XFreeGC (info->display, d->fg_gc);
70
82
  
71
83
  g_free (d);
72
84
}
73
85
 
74
86
#define VERTICAL_TEXT_PAD 3
75
 
#define LEFT_WIDTH 2
76
 
#define RIGHT_WIDTH 2
77
 
#define BOTTOM_HEIGHT 2
 
87
#define LEFT_WIDTH 15
 
88
#define RIGHT_WIDTH 15
 
89
#define BOTTOM_HEIGHT 20
78
90
void
79
91
default_fill_frame_geometry (MetaFrameInfo *info,
80
92
                             MetaFrameGeometry *geom,
93
105
  
94
106
  pango_layout_get_pixel_extents (d->layout, NULL, &rect);
95
107
 
96
 
  geom->top_height = rect.height + VERTICAL_TEXT_PAD * 2;
 
108
  d->title_height = rect.height + VERTICAL_TEXT_PAD * 2;
 
109
  geom->top_height = d->title_height;
97
110
  
98
111
  geom->left_width = LEFT_WIDTH;
99
112
  geom->right_width = RIGHT_WIDTH;
111
124
                      gpointer frame_data)
112
125
{
113
126
  DefaultFrameData *d;
 
127
  int close_size;
114
128
  
115
129
  d = frame_data;
116
130
  
120
134
                         d->layout,
121
135
                         LEFT_WIDTH,
122
136
                         VERTICAL_TEXT_PAD);
 
137
 
 
138
  close_size = d->title_height;
 
139
  
 
140
  XDrawLine (info->display,
 
141
             info->frame,
 
142
             d->fg_gc,
 
143
             info->width - RIGHT_WIDTH - close_size,
 
144
             VERTICAL_TEXT_PAD,
 
145
             info->width - RIGHT_WIDTH,
 
146
             d->title_height - VERTICAL_TEXT_PAD);
 
147
 
 
148
  XDrawLine (info->display,
 
149
             info->frame,
 
150
             d->fg_gc,
 
151
             info->width - RIGHT_WIDTH,
 
152
             VERTICAL_TEXT_PAD,
 
153
             info->width - RIGHT_WIDTH - close_size,
 
154
             d->title_height - VERTICAL_TEXT_PAD);
123
155
}
124
156
 
 
157
#define RESIZE_EXTENDS 10
125
158
MetaFrameControl
126
159
default_get_control (MetaFrameInfo *info,
127
160
                     int x, int y,
128
161
                     gpointer frame_data)
129
162
{
130
 
 
131
 
 
 
163
  DefaultFrameData *d;
 
164
  int close_size;
 
165
  
 
166
  d = frame_data;
 
167
 
 
168
  close_size = d->title_height;
 
169
  if (y < d->title_height &&
 
170
      x > info->width - RIGHT_WIDTH - close_size)
 
171
    return META_FRAME_CONTROL_DELETE;
 
172
  
 
173
  if (y < d->title_height)
 
174
    return META_FRAME_CONTROL_TITLE;
 
175
  
 
176
  if (y > (info->height - BOTTOM_HEIGHT - RESIZE_EXTENDS) &&
 
177
      x > (info->width - RIGHT_WIDTH - RESIZE_EXTENDS))
 
178
    return META_FRAME_CONTROL_RESIZE_SE;
 
179
  
132
180
  return META_FRAME_CONTROL_NONE;
133
181
}
134
182