1 | #ifndef _TASKLIST_APPLET_H_ |
---|
2 | #define _TASKLIST_APPLET_H_ |
---|
3 | |
---|
4 | #include <X11/Xatom.h> |
---|
5 | #include <X11/Xlib.h> |
---|
6 | #include <gdk-pixbuf/gdk-pixbuf.h> |
---|
7 | #include "applet-widget.h" |
---|
8 | #include "gwmh.h" |
---|
9 | |
---|
10 | /* The row height of a task */ |
---|
11 | #define ROW_HEIGHT 24 |
---|
12 | typedef struct _Tasklist Tasklist; |
---|
13 | typedef struct _TasklistTask TasklistTask; |
---|
14 | typedef struct _TasklistConfig TasklistConfig; |
---|
15 | typedef struct _TasklistIcon TasklistIcon; |
---|
16 | |
---|
17 | /* Simple enum for which tasks to show */ |
---|
18 | enum |
---|
19 | { |
---|
20 | TASKS_SHOW_ALL, |
---|
21 | TASKS_SHOW_MINIMIZED, |
---|
22 | TASKS_SHOW_NORMAL |
---|
23 | }; |
---|
24 | |
---|
25 | typedef enum |
---|
26 | { |
---|
27 | MENU_ACTION_CLOSE, |
---|
28 | MENU_ACTION_SHOW, |
---|
29 | MENU_ACTION_HIDE, |
---|
30 | MENU_ACTION_SHOW_HIDE, |
---|
31 | MENU_ACTION_SHADE, |
---|
32 | MENU_ACTION_UNSHADE, |
---|
33 | MENU_ACTION_SHADE_UNSHADE, |
---|
34 | MENU_ACTION_STICK, |
---|
35 | MENU_ACTION_UNSTICK, |
---|
36 | MENU_ACTION_STICK_UNSTICK, |
---|
37 | MENU_ACTION_KILL, |
---|
38 | MENU_ACTION_LAST |
---|
39 | } MenuAction; |
---|
40 | |
---|
41 | struct _TasklistTask { |
---|
42 | Tasklist *tasklist; |
---|
43 | gint x, y; |
---|
44 | gint width, height; |
---|
45 | gint fullwidth; |
---|
46 | TasklistIcon *icon; |
---|
47 | Pixmap wmhints_icon; |
---|
48 | GtkWidget *menu; |
---|
49 | |
---|
50 | /* |
---|
51 | * if we are a group, this is not a real task but a false one |
---|
52 | * filled in with what the task group should be like |
---|
53 | */ |
---|
54 | GwmhTask *gwmh_task; |
---|
55 | |
---|
56 | /* this could be a union */ |
---|
57 | /* for real tasks */ |
---|
58 | TasklistTask *group; |
---|
59 | GtkWidget *menuitem; /* the menuitem in the groups menu */ |
---|
60 | |
---|
61 | /* for task groups */ |
---|
62 | char *group_name; |
---|
63 | GSList *tasks; /* all tasks in group */ |
---|
64 | GSList *vtasks; /* visible tasks in group */ |
---|
65 | TasklistTask *focused_task; /* the task in our group last focused */ |
---|
66 | |
---|
67 | /* whether we are in the vtasks list */ |
---|
68 | gboolean visible; |
---|
69 | /* whether we are a task group */ |
---|
70 | gboolean task_group; |
---|
71 | |
---|
72 | /* set when we get a notify that the gwmh window is destroyed */ |
---|
73 | gboolean destroyed; |
---|
74 | }; |
---|
75 | |
---|
76 | struct _TasklistConfig { |
---|
77 | |
---|
78 | gboolean show_mini_icons; /* Show small icons next to tasks */ |
---|
79 | gboolean show_minimized; /* Show minimized tasks */ |
---|
80 | gboolean show_normal; /* Show normal tasks */ |
---|
81 | gboolean all_desks_normal; /* Show normal tasks on all desktops */ |
---|
82 | gboolean all_desks_minimized; /* Show minimized tasks on all desktops */ |
---|
83 | gboolean confirm_before_kill; /* Confirm before killing windows */ |
---|
84 | gboolean move_to_current; /* Move iconified tasks to current workspace */ |
---|
85 | gboolean sunken; /* Sunken or popped-up look */ |
---|
86 | |
---|
87 | /* Follow the panel sizes */ |
---|
88 | gboolean follow_panel_size; |
---|
89 | |
---|
90 | /* |
---|
91 | * Stuff for horizontal mode |
---|
92 | */ |
---|
93 | |
---|
94 | /* The width of the tasklist */ |
---|
95 | gint horz_width; |
---|
96 | |
---|
97 | /* Number of rows */ |
---|
98 | gint horz_rows; |
---|
99 | |
---|
100 | /* Fixed or dynamic sizing */ |
---|
101 | gboolean horz_fixed; |
---|
102 | |
---|
103 | /* Width of a single task (for dynamic sizing) */ |
---|
104 | gint horz_taskwidth; |
---|
105 | |
---|
106 | /* in dynamic mode, never push applets */ |
---|
107 | gboolean horz_never_push; |
---|
108 | |
---|
109 | /* |
---|
110 | * Stuff for vertical mode |
---|
111 | */ |
---|
112 | /* The height of the tasklist */ |
---|
113 | gint vert_height; |
---|
114 | |
---|
115 | /* The width of the tasklist */ |
---|
116 | gint vert_width; |
---|
117 | |
---|
118 | /* Fixed or dynamic sizing */ |
---|
119 | gboolean vert_fixed; |
---|
120 | |
---|
121 | /* a mode where the width is the max width of any window title */ |
---|
122 | gboolean vert_width_full; |
---|
123 | |
---|
124 | /* in dynamic mode, never push applets */ |
---|
125 | gboolean vert_never_push; |
---|
126 | |
---|
127 | /* grouping options */ |
---|
128 | gboolean enable_grouping; |
---|
129 | gint grouping_min; |
---|
130 | |
---|
131 | /* tooltips */ |
---|
132 | gboolean enable_tooltips; |
---|
133 | }; |
---|
134 | |
---|
135 | struct _TasklistIcon { |
---|
136 | GdkPixbuf *normal; |
---|
137 | GdkPixbuf *minimized; |
---|
138 | }; |
---|
139 | |
---|
140 | struct _Tasklist { |
---|
141 | GNOME_Panel_OrientType orient; /* Tasklist orient */ |
---|
142 | GtkWidget *handle; /* The handle box */ |
---|
143 | GtkWidget *applet; /* The applet */ |
---|
144 | GtkWidget *area; /* The drawing area used to display tasks */ |
---|
145 | |
---|
146 | /* The list of tasks used */ |
---|
147 | GHashTable *tasks; |
---|
148 | |
---|
149 | /* our task groups, grouped by WM_CLASS */ |
---|
150 | GHashTable *groups; |
---|
151 | |
---|
152 | /* |
---|
153 | * list of visible tasks. this should be set by the gwmh |
---|
154 | * listner |
---|
155 | */ |
---|
156 | GSList *vtasks; |
---|
157 | |
---|
158 | /* idle timeout for re-laying out */ |
---|
159 | guint layout_idle; |
---|
160 | |
---|
161 | #define MOTION_TIMEOUT 500 /* Show task motion_task if cursor over task for ... msec */ |
---|
162 | |
---|
163 | /* Show task motion_task after MOTION_TIMEOUT in drag_motion */ |
---|
164 | int motion_timeout; |
---|
165 | |
---|
166 | /* Task to show after motion_timeout */ |
---|
167 | TasklistTask *motion_task; |
---|
168 | |
---|
169 | /* Vertical height, used for resizing */ |
---|
170 | gint vert_height; |
---|
171 | |
---|
172 | /* Horizontal width, used for resizing */ |
---|
173 | gint horz_width; |
---|
174 | |
---|
175 | gint panel_size; |
---|
176 | |
---|
177 | /* The configuration */ |
---|
178 | TasklistConfig config; |
---|
179 | TasklistIcon *unknown_icon; /* The unknown icon */ |
---|
180 | |
---|
181 | /* |
---|
182 | * Used during configuration editing |
---|
183 | */ |
---|
184 | /* The tasklist properties configuration */ |
---|
185 | TasklistConfig PropsConfig; |
---|
186 | |
---|
187 | /* The Property box */ |
---|
188 | GtkWidget *prop; |
---|
189 | |
---|
190 | /* The About box */ |
---|
191 | GtkWidget *about_dialog; |
---|
192 | |
---|
193 | guint task_notifier_id; |
---|
194 | guint desk_notifier_id; |
---|
195 | |
---|
196 | /* Thy evil fake widget for doing tooltips */ |
---|
197 | GtkWidget *fake_tooltip_widget; |
---|
198 | GtkTooltips *tooltips; |
---|
199 | TasklistTask *tooltip_task; |
---|
200 | }; |
---|
201 | |
---|
202 | void tasklist_menu_popup (TasklistTask *task, guint button, |
---|
203 | guint32 activate_time); |
---|
204 | void tasklist_group_popup (TasklistTask *task, guint button, |
---|
205 | guint32 activate_time); |
---|
206 | void tasklist_freeze (Tasklist *tasklist); |
---|
207 | void tasklist_thaw (Tasklist *tasklist); |
---|
208 | void tasklist_draw_task (TasklistTask *task, GdkRectangle *rect); |
---|
209 | void tasklist_display_properties (Tasklist *); |
---|
210 | void tasklist_read_config (Tasklist *); |
---|
211 | void tasklist_clean_menu (TasklistTask *); |
---|
212 | gboolean tasklist_write_config (GtkWidget *w, |
---|
213 | const gchar *privcfgpath, |
---|
214 | const gchar *globcfgpath, |
---|
215 | gpointer data); |
---|
216 | gchar *tasklist_task_get_label (TasklistTask *, int, gboolean add_groupcount); |
---|
217 | void tasklist_change_size (Tasklist *, |
---|
218 | gboolean layout, |
---|
219 | int fullwidth); |
---|
220 | void tasklist_redo_vtasks (Tasklist *); |
---|
221 | void tasklist_layout_tasklist (Tasklist *tasklist); |
---|
222 | GdkPixbuf *tasklist_icon_create_minimized_icon (Tasklist *, GdkPixbuf *pixbuf); |
---|
223 | void tasklist_icon_set (TasklistTask *task); |
---|
224 | void tasklist_icon_destroy (TasklistTask *task); |
---|
225 | Pixmap tasklist_icon_get_pixmap (TasklistTask *task); |
---|
226 | |
---|
227 | #endif /* _TASKLIST_APPLET_H_ */ |
---|