~ubuntu-dev/ubuntu/lucid/mutter/lucid-201002101902

« back to all changes in this revision

Viewing changes to src/ui/frames.h

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2009-08-01 09:30:39 UTC
  • Revision ID: james.westby@ubuntu.com-20090801093039-jpu7jwcri465eb0z
Tags: upstream-2.27.1
ImportĀ upstreamĀ versionĀ 2.27.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 
2
 
 
3
/* Metacity window frame manager widget */
 
4
 
 
5
/* 
 
6
 * Copyright (C) 2001 Havoc Pennington
 
7
 * 
 
8
 * This program is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU General Public License as
 
10
 * published by the Free Software Foundation; either version 2 of the
 
11
 * License, or (at your option) any later version.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful, but
 
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * General Public License for more details.
 
17
 * 
 
18
 * You should have received a copy of the GNU General Public License
 
19
 * along with this program; if not, write to the Free Software
 
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
21
 * 02111-1307, USA.
 
22
 */
 
23
 
 
24
#ifndef META_FRAMES_H
 
25
#define META_FRAMES_H
 
26
 
 
27
#include <gtk/gtk.h>
 
28
#include <gdk/gdkx.h>
 
29
#include "common.h"
 
30
#include "theme.h"
 
31
 
 
32
typedef enum
 
33
{
 
34
  META_FRAME_CONTROL_NONE,
 
35
  META_FRAME_CONTROL_TITLE,
 
36
  META_FRAME_CONTROL_DELETE,
 
37
  META_FRAME_CONTROL_MENU,
 
38
  META_FRAME_CONTROL_MINIMIZE,
 
39
  META_FRAME_CONTROL_MAXIMIZE,
 
40
  META_FRAME_CONTROL_UNMAXIMIZE,
 
41
  META_FRAME_CONTROL_SHADE,
 
42
  META_FRAME_CONTROL_UNSHADE,
 
43
  META_FRAME_CONTROL_ABOVE,
 
44
  META_FRAME_CONTROL_UNABOVE,
 
45
  META_FRAME_CONTROL_STICK,
 
46
  META_FRAME_CONTROL_UNSTICK,
 
47
  META_FRAME_CONTROL_RESIZE_SE,
 
48
  META_FRAME_CONTROL_RESIZE_S,
 
49
  META_FRAME_CONTROL_RESIZE_SW,
 
50
  META_FRAME_CONTROL_RESIZE_N,
 
51
  META_FRAME_CONTROL_RESIZE_NE,
 
52
  META_FRAME_CONTROL_RESIZE_NW,
 
53
  META_FRAME_CONTROL_RESIZE_W,
 
54
  META_FRAME_CONTROL_RESIZE_E,
 
55
  META_FRAME_CONTROL_CLIENT_AREA
 
56
} MetaFrameControl;
 
57
 
 
58
/* This is one widget that manages all the window frames
 
59
 * as subwindows.
 
60
 */
 
61
 
 
62
#define META_TYPE_FRAMES            (meta_frames_get_type ())
 
63
#define META_FRAMES(obj)            (GTK_CHECK_CAST ((obj), META_TYPE_FRAMES, MetaFrames))
 
64
#define META_FRAMES_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), META_TYPE_FRAMES, MetaFramesClass))
 
65
#define META_IS_FRAMES(obj)         (GTK_CHECK_TYPE ((obj), META_TYPE_FRAMES))
 
66
#define META_IS_FRAMES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), META_TYPE_FRAMES))
 
67
#define META_FRAMES_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), META_TYPE_FRAMES, MetaFramesClass))
 
68
 
 
69
typedef struct _MetaFrames        MetaFrames;
 
70
typedef struct _MetaFramesClass   MetaFramesClass;
 
71
 
 
72
typedef struct _MetaUIFrame         MetaUIFrame;
 
73
 
 
74
struct _MetaUIFrame
 
75
{
 
76
  Window xwindow;
 
77
  GdkWindow *window;
 
78
  GtkStyle *style;
 
79
  MetaFrameStyle *cache_style;
 
80
  PangoLayout *layout;
 
81
  int text_height;
 
82
  char *title; /* NULL once we have a layout */
 
83
  guint expose_delayed : 1;
 
84
  guint shape_applied : 1;
 
85
  
 
86
  /* FIXME get rid of this, it can just be in the MetaFrames struct */
 
87
  MetaFrameControl prelit_control;
 
88
};
 
89
 
 
90
struct _MetaFrames
 
91
{
 
92
  GtkWindow parent_instance;
 
93
  
 
94
  GHashTable *text_heights;
 
95
 
 
96
  GHashTable *frames;
 
97
 
 
98
  guint tooltip_timeout;
 
99
  MetaUIFrame *last_motion_frame;
 
100
 
 
101
  int expose_delay_count;
 
102
 
 
103
  int invalidate_cache_timeout_id;
 
104
  GList *invalidate_frames;
 
105
  GHashTable *cache;
 
106
};
 
107
 
 
108
struct _MetaFramesClass
 
109
{
 
110
  GtkWindowClass parent_class;
 
111
 
 
112
};
 
113
 
 
114
GType        meta_frames_get_type               (void) G_GNUC_CONST;
 
115
 
 
116
MetaFrames *meta_frames_new (int screen_number);
 
117
 
 
118
void meta_frames_manage_window (MetaFrames *frames,
 
119
                                Window      xwindow,
 
120
                                GdkWindow  *window);
 
121
void meta_frames_unmanage_window (MetaFrames *frames,
 
122
                                  Window      xwindow);
 
123
void meta_frames_set_title (MetaFrames *frames,
 
124
                            Window      xwindow,
 
125
                            const char *title);
 
126
 
 
127
void meta_frames_repaint_frame (MetaFrames *frames,
 
128
                                Window      xwindow);
 
129
 
 
130
void meta_frames_get_geometry (MetaFrames *frames,
 
131
                               Window xwindow,
 
132
                               int *top_height, int *bottom_height,
 
133
                               int *left_width, int *right_width);
 
134
 
 
135
void meta_frames_reset_bg     (MetaFrames *frames,
 
136
                               Window      xwindow);
 
137
void meta_frames_unflicker_bg (MetaFrames *frames,
 
138
                               Window      xwindow,
 
139
                               int         target_width,
 
140
                               int         target_height);
 
141
 
 
142
void meta_frames_apply_shapes (MetaFrames *frames,
 
143
                               Window      xwindow,
 
144
                               int         new_window_width,
 
145
                               int         new_window_height,
 
146
                               gboolean    window_has_shape);
 
147
void meta_frames_move_resize_frame (MetaFrames *frames,
 
148
                                    Window      xwindow,
 
149
                                    int         x,
 
150
                                    int         y,
 
151
                                    int         width,
 
152
                                    int         height);
 
153
void meta_frames_queue_draw (MetaFrames *frames,
 
154
                             Window      xwindow);
 
155
 
 
156
void meta_frames_notify_menu_hide (MetaFrames *frames);
 
157
 
 
158
Window meta_frames_get_moving_frame (MetaFrames *frames);
 
159
 
 
160
void meta_frames_push_delay_exposes (MetaFrames *frames);
 
161
void meta_frames_pop_delay_exposes  (MetaFrames *frames);
 
162
 
 
163
#endif