~ubuntu-branches/ubuntu/intrepid/matchbox/intrepid

« back to all changes in this revision

Viewing changes to src/structs.h

  • Committer: Bazaar Package Importer
  • Author(s): Paul Hedderly
  • Date: 2002-03-18 14:02:52 UTC
  • Revision ID: james.westby@ubuntu.com-20020318140252-h2icfj2rv2vxsb3c
Tags: upstream-0.1.8
ImportĀ upstreamĀ versionĀ 0.1.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* matchbox - a lightweight window manager
 
2
 
 
3
   Copyright 2002 Matthew Allum
 
4
 
 
5
   This program is free software; you can redistribute it and/or modify
 
6
   it under the terms of the GNU General Public License as published by
 
7
   the Free Software Foundation; either version 2, or (at your option)
 
8
   any later version.
 
9
 
 
10
   This program is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
   GNU General Public License for more details.
 
14
*/
 
15
 
 
16
#ifndef _STRUCTS_H_
 
17
#define _STRUCTS_H_
 
18
 
 
19
#include <stdio.h>
 
20
#include <stdlib.h>
 
21
#include <X11/Xlib.h>
 
22
#include <X11/Xutil.h>
 
23
#include <X11/Xatom.h>
 
24
#ifdef USE_XFT
 
25
#include <X11/Xft/Xft.h>
 
26
#endif
 
27
 
 
28
#define TRUE  1
 
29
#define FALSE 0
 
30
 
 
31
#define APPLY_GRAVITY 1
 
32
#define REMOVE_GRAVITY -1
 
33
 
 
34
#define DOCK_HEIGHT 16
 
35
#define DOCK_MIN_HEIGHT 4
 
36
 
 
37
#define STACK_REMOVE 1
 
38
#define STACK_ADD   -1
 
39
 
 
40
#define BUTTON_NEXT_PRESSED 1
 
41
#define BUTTON_PREV_PRESSED 2
 
42
#define BUTTON_CLOSE_PRESSED 3
 
43
 
 
44
#define MENU_FLAG   (1<<1)
 
45
#define SINGLE_FLAG (1<<2) /* hack to specify when only a single client */
 
46
 
 
47
#define Wm wm       /* tmp to avoid breakage */
 
48
#define Client client
 
49
 
 
50
#define START_CLIENT_LOOP(w,c) (c) = (w)->head_client; do {
 
51
#define END_CLIENT_LOOP(w,c)   } while (((c) = (c)->next) \
 
52
                                        && ((c) != (w)->head_client) );
 
53
 
 
54
#define WBW(c) ((c)->wm->theme->win_border_width)
 
55
 
 
56
typedef enum { dialog, toolbar, detached, 
 
57
               override, docked, menu, mainwin } Client_type;
 
58
 
 
59
typedef struct _client
 
60
{
 
61
   char *name;
 
62
   XSizeHints   *size;
 
63
   Window       window, frame;
 
64
   struct _client *trans;
 
65
   Colormap     cmap;
 
66
   int          x, y, width, height;
 
67
   int          ignore_unmap;
 
68
   int          tmp_data;    /* must be a better way */
 
69
 
 
70
   Client_type type;
 
71
   Bool        shaded;                                // TOGO
 
72
   
 
73
#ifdef USE_XFT
 
74
    XftDraw     *xftdraw;
 
75
#endif
 
76
 
 
77
   void (* reparent)( struct _client* c );
 
78
   void (* redraw)( struct _client* c, Bool use_cache );
 
79
   void (* button_press) (struct _client *c, XButtonEvent *e);
 
80
   void (* move_resize)( struct _client* c );
 
81
   void (* configure)( struct _client* c );
 
82
   void (* get_coverage)( struct _client* c, int* x, int* y, int* h, int* w );
 
83
   void (* hide)( struct _client* c );
 
84
   void (* show)( struct _client* c );
 
85
   void (* destroy)( struct _client* c );
 
86
 
 
87
   Bool mapped;
 
88
   
 
89
   struct _client *next;
 
90
   struct _client *prev;
 
91
 
 
92
   Pixmap backing;
 
93
 
 
94
   void* xtra;
 
95
   struct _wm *wm;
 
96
   
 
97
} client;
 
98
 
 
99
typedef struct _pxm 
 
100
{
 
101
   Pixmap pixmap;
 
102
   Pixmap mask;
 
103
   int width;
 
104
   int height;
 
105
   
 
106
} Pxm ;
 
107
 
 
108
typedef enum { plain, gradient, pixmap } Theme_type;
 
109
 
 
110
 
 
111
typedef struct _theme 
 
112
{
 
113
   XFontStruct* font;
 
114
   XFontStruct* toolbar_font;
 
115
   
 
116
#ifdef USE_XFT
 
117
   XftFont *xftfont;
 
118
   XftFont *toolbar_xftfont;
 
119
   XftColor xft_fg;
 
120
#endif
 
121
 
 
122
   Pxm buttons[6];
 
123
   Pxm tile;
 
124
   
 
125
   int win_border_width;
 
126
   int padding;
 
127
   Bool bevel;
 
128
   
 
129
   XColor bg_col;                   /* for win borders, lines */
 
130
   XColor text_col;                 /* for text */
 
131
   XColor fg_col;                   /* main fg color */
 
132
   XColor fg_start_col, fg_end_col; /* for gradients & bevels */
 
133
 
 
134
   GC text_gc, toolbar_text_gc, bg_gc, fg_gc, effects_gc, mask_gc, invert_gc;
 
135
   
 
136
   Cursor move_curs, resize_curs;
 
137
   
 
138
} Theme;
 
139
 
 
140
typedef struct _wm_config
 
141
{
 
142
   Bool use_dock;
 
143
   Bool use_title;
 
144
   
 
145
   int dock_minheight;
 
146
   int dock_maxheight;
 
147
 
 
148
   unsigned int modifier;
 
149
   
 
150
   char theme_file[255];
 
151
   char display_name[128]; 
 
152
 
 
153
} Wm_config;
 
154
 
 
155
typedef struct _wm
 
156
{
 
157
   Display*     dpy;
 
158
   Atom         atoms[7];
 
159
   Window       root;
 
160
   int          screen;
 
161
   
 
162
   client*      head_client;    /* For ptr to beginning of list   */
 
163
   client*      focused_client; /* currently focused client       */
 
164
   client*      main_client;    /* currently viewable main client */
 
165
   XFontStruct* font;
 
166
 
 
167
   int dpy_width;
 
168
   int dpy_height;
 
169
 
 
170
   int lock; /* to go, replaced by flags */
 
171
 
 
172
   int flags;
 
173
   
 
174
   Window dockwin;
 
175
   int dockwin_offset;
 
176
 
 
177
   Cursor move_curs, resize_curs, curs;
 
178
 
 
179
   /* To do, set in an array */
 
180
   Atom wm_state, wm_change_state, wm_protos, wm_delete, wm_cmapwins,
 
181
      mb_theme, mb_command;
 
182
 
 
183
   Theme* theme;
 
184
   Wm_config *config;
 
185
} wm;
 
186
 
 
187
 
 
188
#endif