Adding upstream version 0.7.2.
[debian/lxpanel.git] / src / misc.h
CommitLineData
6cc5e1a6 1/**
6b775dbb 2 * Copyright (c) 2006-2014 LxDE Developers, see the file AUTHORS for details.
6cc5e1a6
DB
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
6b775dbb
AG
19#ifndef __MISC_H__
20#define __MISC_H__ 1
6cc5e1a6
DB
21
22#include <X11/Xatom.h>
23#include <gtk/gtk.h>
24#include <gdk/gdk.h>
25#include <gdk/gdkx.h>
26#include <stdio.h>
6b775dbb 27#include <libfm/fm.h>
6cc5e1a6
DB
28
29#include "panel.h"
6cc5e1a6 30
6b775dbb
AG
31G_BEGIN_DECLS
32
33extern Atom a_UTF8_STRING;
34extern Atom a_XROOTPMAP_ID;
35
36extern Atom a_WM_STATE;
37extern Atom a_WM_CLASS;
38extern Atom a_WM_DELETE_WINDOW;
39extern Atom a_WM_PROTOCOLS;
40extern Atom a_NET_WORKAREA;
41extern Atom a_NET_CLIENT_LIST;
42extern Atom a_NET_CLIENT_LIST_STACKING;
43extern Atom a_NET_NUMBER_OF_DESKTOPS;
44extern Atom a_NET_CURRENT_DESKTOP;
45extern Atom a_NET_DESKTOP_VIEWPORT;
46extern Atom a_NET_DESKTOP_NAMES;
47extern Atom a_NET_ACTIVE_WINDOW;
48extern Atom a_NET_CLOSE_WINDOW;
49extern Atom a_NET_SHOWING_DESKTOP;
50extern Atom a_NET_SUPPORTED;
51extern Atom a_NET_WM_STATE;
52extern Atom a_NET_WM_STATE_SKIP_TASKBAR;
53extern Atom a_NET_WM_STATE_SKIP_PAGER;
54extern Atom a_NET_WM_STATE_STICKY;
55extern Atom a_NET_WM_STATE_HIDDEN;
56extern Atom a_NET_WM_STATE_SHADED;
57
58#define a_NET_WM_STATE_REMOVE 0 /* remove/unset property */
59#define a_NET_WM_STATE_ADD 1 /* add/set property */
60#define a_NET_WM_STATE_TOGGLE 2 /* toggle property */
61
62extern Atom a_NET_WM_WINDOW_TYPE;
63extern Atom a_NET_WM_WINDOW_TYPE_DESKTOP;
64extern Atom a_NET_WM_WINDOW_TYPE_DOCK;
65extern Atom a_NET_WM_WINDOW_TYPE_TOOLBAR;
66extern Atom a_NET_WM_WINDOW_TYPE_MENU;
67extern Atom a_NET_WM_WINDOW_TYPE_UTILITY;
68extern Atom a_NET_WM_WINDOW_TYPE_SPLASH;
69extern Atom a_NET_WM_WINDOW_TYPE_DIALOG;
70extern Atom a_NET_WM_WINDOW_TYPE_NORMAL;
71
72extern Atom a_NET_WM_DESKTOP;
73extern Atom a_NET_WM_NAME;
74extern Atom a_NET_WM_VISIBLE_NAME;
75extern Atom a_NET_WM_STRUT;
76extern Atom a_NET_WM_STRUT_PARTIAL;
77extern Atom a_NET_WM_ICON;
78extern Atom a_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR;
79
80extern Atom a_NET_SYSTEM_TRAY_OPCODE;
81extern Atom a_NET_SYSTEM_TRAY_MESSAGE_DATA;
82extern Atom a_NET_SYSTEM_TRAY_ORIENTATION;
83extern Atom a_MANAGER;
84
85extern Atom a_LXPANEL_CMD; /* for private client message */
86
87/* Decoded value of WM_STATE property. */
6cc5e1a6 88typedef struct {
6b775dbb
AG
89 unsigned int modal : 1;
90 unsigned int sticky : 1;
91 unsigned int maximized_vert : 1;
92 unsigned int maximized_horz : 1;
93 unsigned int shaded : 1;
94 unsigned int skip_taskbar : 1;
95 unsigned int skip_pager : 1;
96 unsigned int hidden : 1;
97 unsigned int fullscreen : 1;
98 unsigned int above : 1;
99 unsigned int below : 1;
100} NetWMState;
101
102/* Decoded value of _NET_WM_WINDOW_TYPE property. */
6cc5e1a6 103typedef struct {
6b775dbb
AG
104 unsigned int desktop : 1;
105 unsigned int dock : 1;
106 unsigned int toolbar : 1;
107 unsigned int menu : 1;
108 unsigned int utility : 1;
109 unsigned int splash : 1;
110 unsigned int dialog : 1;
111 unsigned int normal : 1;
112} NetWMWindowType;
6cc5e1a6 113
2ba86315 114void Xclimsg(Window win, Atom type, long l0, long l1, long l2, long l3, long l4);
6cc5e1a6
DB
115void Xclimsgwm(Window win, Atom type, Atom arg);
116void *get_xaproperty (Window win, Atom prop, Atom type, int *nitems);
117char *get_textproperty(Window win, Atom prop);
118void *get_utf8_property(Window win, Atom atom);
119char **get_utf8_property_list(Window win, Atom atom, int *count);
120
121void resolve_atoms();
122//Window Select_Window(Display *dpy);
123int get_net_number_of_desktops();
124int get_net_current_desktop ();
125int get_net_wm_desktop(Window win);
126int get_wm_state (Window win);
127void get_net_wm_state(Window win, NetWMState *nws);
128void get_net_wm_window_type(Window win, NetWMWindowType *nwwt);
129GPid get_net_wm_pid(Window win);
130
6b775dbb
AG
131/**
132 * panel_handle_x_error
133 * @d: X display
134 * @ev: X error event
135 *
136 * Prints X error message to stderr if logging was enabled.
137 */
138extern int panel_handle_x_error(Display * d, XErrorEvent * ev);
139extern int panel_handle_x_error_swallow_BadWindow_BadDrawable(Display * d, XErrorEvent * ev);
140
141gchar *expand_tilda(const gchar *file);
2ba86315 142
6cc5e1a6
DB
143void get_button_spacing(GtkRequisition *req, GtkContainer *parent, gchar *name);
144guint32 gcolor2rgb24(GdkColor *color);
6b775dbb
AG
145GtkWidget *lxpanel_button_new_for_icon(LXPanel *panel, const gchar *name, GdkColor *color, const gchar *label);
146GtkWidget *lxpanel_button_new_for_fm_icon(LXPanel *panel, FmIcon *icon, GdkColor *color, const gchar *label);
147void lxpanel_button_set_icon(GtkWidget* btn, const gchar *name, gint size);
148void lxpanel_button_update_icon(GtkWidget* btn, FmIcon *icon, gint size);
7486d297 149
6b775dbb 150G_END_DECLS
6cc5e1a6
DB
151
152#endif