Releasing debian version 0.5.8-3.
[debian/lxpanel.git] / src / panel.h
CommitLineData
6cc5e1a6
DB
1/**
2 * Copyright (c) 2006 LxDE Developers, see the file AUTHORS for details.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef PANEL_H
20#define PANEL_H
21
22#include <X11/Xlib.h>
23#include <gtk/gtk.h>
24#include <gdk/gdk.h>
25
26#include "config.h"
27
28#include "bg.h"
29#include "ev.h"
30
31enum { ALLIGN_NONE, ALLIGN_LEFT, ALLIGN_CENTER, ALLIGN_RIGHT };
32enum { EDGE_NONE, EDGE_LEFT, EDGE_RIGHT, EDGE_TOP, EDGE_BOTTOM };
33enum { WIDTH_NONE, WIDTH_REQUEST, WIDTH_PIXEL, WIDTH_PERCENT };
34enum { HEIGHT_NONE, HEIGHT_PIXEL, HEIGHT_REQUEST };
35enum {
36 ORIENT_NONE = -1,
37 ORIENT_VERT = GTK_ORIENTATION_VERTICAL,
38 ORIENT_HORIZ = GTK_ORIENTATION_HORIZONTAL
39};
40enum { POS_NONE, POS_START, POS_END };
41
1ea75322
DB
42#define PANEL_ICON_SIZE 24 /* Default size of panel icons */
43#define PANEL_HEIGHT_DEFAULT 26 /* Default height of horizontal panel */
44#define PANEL_WIDTH_DEFAULT 150 /* Default "height" of vertical panel */
45#define PANEL_HEIGHT_MAX 200 /* Maximum height of panel */
46#define PANEL_HEIGHT_MIN 16 /* Minimum height of panel */
47#define PANEL_ICON_HIGHLIGHT 0x202020 /* Constant to pass to icon loader */
6cc5e1a6 48
10862fa6
DB
49/* to check if we are in LXDE */
50extern gboolean is_in_lxde;
51
1ea75322
DB
52/* Context of a panel on a given edge. */
53typedef struct _Panel {
6cc5e1a6 54 char* name;
1ea75322
DB
55 GtkWidget * topgwin; /* Main panel window */
56 Window topxwin; /* Main panel's X window */
57 GdkDisplay * display; /* Main panel's GdkDisplay */
58 GtkStyle * defstyle;
59
60 GtkWidget * box; /* Top level widget */
10862fa6 61
6cc5e1a6
DB
62 GtkRequisition requisition;
63 GtkWidget *(*my_box_new) (gboolean, gint);
64 GtkWidget *(*my_separator_new) ();
65
66 FbBg *bg;
67 int alpha;
68 guint32 tintcolor;
69 guint32 fontcolor;
70 GdkColor gtintcolor;
71 GdkColor gfontcolor;
72
73 int ax, ay, aw, ah; /* prefferd allocation of a panel */
74 int cx, cy, cw, ch; /* current allocation (as reported by configure event) allocation */
75 int allign, edge, margin;
76 int orientation;
77 int widthtype, width;
78 int heighttype, height;
1ea75322
DB
79 gulong strut_size; /* Values for WM_STRUT_PARTIAL */
80 gulong strut_lower;
81 gulong strut_upper;
82 int strut_edge;
6cc5e1a6 83
b3df3353 84 guint config_changed : 1;
6cc5e1a6
DB
85 guint self_destroy : 1;
86 guint setdocktype : 1;
87 guint setstrut : 1;
88 guint round_corners : 1;
89 guint usefontcolor : 1;
90 guint transparent : 1;
91 guint background : 1;
92 guint spacing;
93
1ea75322
DB
94 guint autohide : 1;
95 guint visible : 1;
96 int height_when_hidden;
97 guint hide_timeout;
98 int icon_size; /* Icon size */
99
6cc5e1a6
DB
100 int desknum;
101 int curdesk;
102 guint32 *workarea;
103 int wa_len;
104
105 char* background_file;
106
1ea75322
DB
107 GList * plugins; /* List of all plugins */
108 GSList * system_menus; /* List of plugins having menus */
109
110 GtkWidget* plugin_pref_dialog; /* Plugin preference dialog */
111 GtkWidget* pref_dialog; /* preference dialog */
112 GtkWidget* margin_control; /* Margin control in preference dialog */
113 GtkWidget* height_label; /* Label of height control */
114 GtkWidget* width_label; /* Label of width control */
115 GtkWidget* alignment_left_label; /* Label of alignment: left control */
116 GtkWidget* alignment_right_label; /* Label of alignment: right control */
117 GtkWidget* height_control; /* Height control in preference dialog */
118 GtkWidget* width_control; /* Width control in preference dialog */
119} Panel;
120
121/* Decoded value of WM_STATE property. */
6cc5e1a6
DB
122typedef struct {
123 unsigned int modal : 1;
124 unsigned int sticky : 1;
125 unsigned int maximized_vert : 1;
126 unsigned int maximized_horz : 1;
127 unsigned int shaded : 1;
128 unsigned int skip_taskbar : 1;
129 unsigned int skip_pager : 1;
130 unsigned int hidden : 1;
131 unsigned int fullscreen : 1;
132 unsigned int above : 1;
133 unsigned int below : 1;
134} NetWMState;
135
1ea75322 136/* Decoded value of _NET_WM_WINDOW_TYPE property. */
6cc5e1a6
DB
137typedef struct {
138 unsigned int desktop : 1;
139 unsigned int dock : 1;
140 unsigned int toolbar : 1;
141 unsigned int menu : 1;
142 unsigned int utility : 1;
143 unsigned int splash : 1;
144 unsigned int dialog : 1;
145 unsigned int normal : 1;
146} NetWMWindowType;
147
148typedef struct {
149 char *name;
150 char *disp_name;
151 void (*cmd)(void);
152} Command;
153
154extern Command commands[];
155
156extern gchar *cprofile;
157
158extern Atom a_UTF8_STRING;
159extern Atom a_XROOTPMAP_ID;
160
161extern Atom a_WM_STATE;
162extern Atom a_WM_CLASS;
163extern Atom a_WM_DELETE_WINDOW;
164extern Atom a_WM_PROTOCOLS;
165extern Atom a_NET_WORKAREA;
166extern Atom a_NET_CLIENT_LIST;
167extern Atom a_NET_CLIENT_LIST_STACKING;
168extern Atom a_NET_NUMBER_OF_DESKTOPS;
169extern Atom a_NET_CURRENT_DESKTOP;
170extern Atom a_NET_DESKTOP_VIEWPORT;
171extern Atom a_NET_DESKTOP_NAMES;
172extern Atom a_NET_ACTIVE_WINDOW;
173extern Atom a_NET_CLOSE_WINDOW;
bfba7517 174extern Atom a_NET_SHOWING_DESKTOP;
6cc5e1a6
DB
175extern Atom a_NET_SUPPORTED;
176extern Atom a_NET_WM_STATE;
177extern Atom a_NET_WM_STATE_SKIP_TASKBAR;
178extern Atom a_NET_WM_STATE_SKIP_PAGER;
179extern Atom a_NET_WM_STATE_STICKY;
180extern Atom a_NET_WM_STATE_HIDDEN;
181extern Atom a_NET_WM_STATE_SHADED;
182
183#define a_NET_WM_STATE_REMOVE 0 /* remove/unset property */
184#define a_NET_WM_STATE_ADD 1 /* add/set property */
185#define a_NET_WM_STATE_TOGGLE 2 /* toggle property */
186
187extern Atom a_NET_WM_WINDOW_TYPE;
188extern Atom a_NET_WM_WINDOW_TYPE_DESKTOP;
189extern Atom a_NET_WM_WINDOW_TYPE_DOCK;
190extern Atom a_NET_WM_WINDOW_TYPE_TOOLBAR;
191extern Atom a_NET_WM_WINDOW_TYPE_MENU;
192extern Atom a_NET_WM_WINDOW_TYPE_UTILITY;
193extern Atom a_NET_WM_WINDOW_TYPE_SPLASH;
194extern Atom a_NET_WM_WINDOW_TYPE_DIALOG;
195extern Atom a_NET_WM_WINDOW_TYPE_NORMAL;
196
197extern Atom a_NET_WM_DESKTOP;
198extern Atom a_NET_WM_NAME;
199extern Atom a_NET_WM_VISIBLE_NAME;
200extern Atom a_NET_WM_STRUT;
201extern Atom a_NET_WM_STRUT_PARTIAL;
202extern Atom a_NET_WM_ICON;
203extern Atom a_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR;
204
1ea75322
DB
205extern Atom a_NET_SYSTEM_TRAY_OPCODE;
206extern Atom a_NET_SYSTEM_TRAY_MESSAGE_DATA;
207extern Atom a_NET_SYSTEM_TRAY_ORIENTATION;
208extern Atom a_MANAGER;
209
6cc5e1a6
DB
210extern Atom a_LXPANEL_CMD; /* for private client message */
211
212extern int verbose;
213
bfba7517
DB
214/* if current window manager is EWMH conforming. */
215extern gboolean is_ewmh_supported;
216
6cc5e1a6
DB
217extern FbEv *fbev;
218
219#define FBPANEL_WIN(win) gdk_window_lookup(win)
220
1ea75322
DB
221extern void panel_apply_icon(GtkWindow *w);
222extern void panel_destroy(Panel *p);
223extern void panel_adjust_geometry_terminology(Panel *p);
224extern void panel_determine_background_pixmap(Panel * p, GtkWidget * widget, GdkWindow * window);
225extern void panel_draw_label_text(Panel * p, GtkWidget * label, char * text, gboolean bold, gboolean custom_color);
226extern void panel_establish_autohide(Panel *p);
227extern void panel_image_set_from_file(Panel * p, GtkWidget * image, char * file);
934ecce5 228extern gboolean panel_image_set_icon_theme(Panel * p, GtkWidget * image, const gchar * icon);
1ea75322
DB
229extern void panel_set_wm_strut(Panel *p);
230extern void panel_set_dock_type(Panel *p);
231extern void panel_set_panel_configuration_changed(Panel *p);
232extern void panel_update_background( Panel* p );
233
234extern int panel_handle_x_error(Display * d, XErrorEvent * ev);
235extern int panel_handle_x_error_swallow_BadWindow_BadDrawable(Display * d, XErrorEvent * ev);
6cc5e1a6
DB
236
237extern const char* lxpanel_get_file_manager();
238extern const char* lxpanel_get_terminal();
239
240#endif