Yet another try to get 0.51.2-pre2 in cvs
[wmaker-crm.git] / src / funcs.h
blob3b79caf5798fbc22acc783a4bf396781822c9fec
1 /*
2 * Window Maker window manager
3 *
4 * Copyright (c) 1997, 1998 Alfredo K. Kojima
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 * USA.
22 #ifndef WMFUNCS_H_
23 #define WMFUNCS_H_
25 #include <sys/types.h>
26 #include <stdio.h>
28 #include "window.h"
30 typedef void (WCallBack)(void *cdata);
32 typedef void (WDeathHandler)(pid_t pid, unsigned int status, void *cdata);
34 void Shutdown(WShutdownMode mode);
36 void RestoreDesktop(WScreen *scr);
38 void Exit(int status);
40 void Restart(char *manager);
42 void SetupEnvironment(WScreen *scr);
44 void DispatchEvent(XEvent *event);
46 #ifndef LITE
48 Bool wRootMenuPerformShortcut(XEvent *event);
50 void wRootMenuBindShortcuts(Window window);
52 void OpenRootMenu(WScreen *scr, int x, int y, int keyboard);
54 void OpenSwitchMenu(WScreen *scr, int x, int y, int keyboard);
56 #endif /* !LITE */
58 void OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard);
60 void OpenMiniwindowMenu(WWindow *wwin, int x, int y);
62 void OpenWorkspaceMenu(WScreen *scr, int x, int y);
64 void CloseWindowMenu(WScreen *scr);
66 #ifdef LITE
68 #define UpdateSwitchMenu(a, b, c)
70 #define UpdateSwitchMenuWorkspace(a, b)
72 #else /*! LITE */
74 void UpdateSwitchMenu(WScreen *scr, WWindow *wwin, int action);
76 void UpdateSwitchMenuWorkspace(WScreen *scr, int workspace);
78 #endif /* !LITE */
80 WMagicNumber wAddDeathHandler(pid_t pid, WDeathHandler *callback, void *cdata);
82 void wColormapInstallForWindow(WScreen *scr, WWindow *wwin);
84 void wColormapInstallRoot(WScreen *scr);
86 void wColormapUninstallRoot(WScreen *scr);
88 void wColormapAllowClientInstallation(WScreen *scr, Bool starting);
90 Pixmap LoadIcon(WScreen *scr, char *path, char *mask, int title_height);
92 void PlaceIcon(WScreen *scr, int *x_ret, int *y_ret);
94 void PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
95 unsigned int width, unsigned int height);
97 #ifdef USECPP
98 char *MakeCPPArgs(char *path);
99 #endif
101 char *ExpandOptions(WScreen *scr, char *cmdline);
103 void ExecuteShellCommand(WScreen *scr, char *command);
105 Bool IsDoubleClick(WScreen *scr, XEvent *event);
107 WWindow *NextFocusWindow(WScreen *scr);
108 WWindow *PrevFocusWindow(WScreen *scr);
110 void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y);
112 char *ShrinkString(WFont *font, char *string, int width);
114 char *FindImage(char *paths, char *file);
116 RImage*wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
118 BOOL StringCompareHook(proplist_t pl1, proplist_t pl2);
120 int IsEof(FILE * stream); /* feof that stats pipes */
122 char *FlattenStringList(char **list, int count);
124 void ParseWindowName(proplist_t value, char **winstance, char **wclass,
125 char *where);
127 void SendHelperMessage(WScreen *scr, char type, int workspace, char *msg);
129 char *GetShortcutString(char *text);
131 char *EscapeWM_CLASS(char *name, char *class);
133 void UnescapeWM_CLASS(char *str, char **name, char **class);
135 #ifdef NUMLOCK_HACK
136 void wHackedGrabKey(int keycode, unsigned int modifiers,
137 Window grab_window, Bool owner_events, int pointer_mode,
138 int keyboard_mode);
139 #endif
141 void wHackedGrabButton(unsigned int button, unsigned int modifiers,
142 Window grab_window, Bool owner_events,
143 unsigned int event_mask, int pointer_mode,
144 int keyboard_mode, Window confine_to, Cursor cursor);
147 /* this function is in dock.c */
148 void ParseCommand(char *command, char ***argv, int *argc);
150 /* This function is in moveres.c. */
151 void wGetGeometryWindowSize(WScreen *scr, unsigned int *width,
152 unsigned int *height);
154 void ExecExitScript();
156 /****** I18N Wrapper for XFetchName,XGetIconName ******/
158 Bool wFetchName(Display *dpy, Window win, char **winname);
159 Bool wGetIconName(Display *dpy, Window win, char **iconname);
161 #ifdef I18N_MB
162 /*void wTextWidth(XFontSet *font, char *text, int length);*/
163 #define wDrawString(d,f,gc,x,y,text,textlen) \
164 XmbDrawString(dpy, d, (f)->font, gc, (x), (y), text, textlen)
166 #define wTextWidth(font,text,textlen) XmbTextEscapement(font,text,textlen)
168 #else /* !I18N_MB */
170 #define wTextWidth(font,text,textlen) XTextWidth(font,text,textlen)
172 /*void wTextWidth(XFontStruct *font, char *text, int length);*/
173 #define wDrawString(d,font,gc,x,y,text,textlen) \
174 XDrawString(dpy, d, gc, (x), (y), text, textlen)
176 #endif /* !I18N_MB */
179 #endif