Mac OS X-style window cycling.
[wmaker-crm.git] / src / funcs.h
1 /*
2 * Window Maker window manager
3 *
4 * Copyright (c) 1997-2003 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.
10 *
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.
15 *
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.
20 */
21
22 #ifndef WMFUNCS_H_
23 #define WMFUNCS_H_
24
25 #include <sys/types.h>
26 #include <stdio.h>
27
28 #include "window.h"
29 #include "defaults.h"
30
31 typedef void (WCallBack)(void *cdata);
32
33 typedef void (WDeathHandler)(pid_t pid, unsigned int status, void *cdata);
34
35 void Shutdown(WShutdownMode mode);
36
37 void RestoreDesktop(WScreen *scr);
38
39 void Exit(int status);
40
41 void Restart(char *manager, Bool abortOnFailure);
42
43 void SetupEnvironment(WScreen *scr);
44
45 void DispatchEvent(XEvent *event);
46
47 void UpdateSwitchMenu(WScreen *scr, WWindow *wwin, int action);
48
49 Bool wRootMenuPerformShortcut(XEvent *event);
50
51 void wRootMenuBindShortcuts(Window window);
52
53 void OpenRootMenu(WScreen *scr, int x, int y, int keyboard);
54
55 void OpenSwitchMenu(WScreen *scr, int x, int y, int keyboard);
56
57 void InitializeSwitchMenu(void);
58
59 void OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard);
60
61 void OpenMiniwindowMenu(WWindow *wwin, int x, int y);
62
63 void OpenWorkspaceMenu(WScreen *scr, int x, int y);
64
65 void CloseWindowMenu(WScreen *scr);
66
67 WMagicNumber wAddDeathHandler(pid_t pid, WDeathHandler *callback, void *cdata);
68
69 void wColormapInstallForWindow(WScreen *scr, WWindow *wwin);
70
71 void wColormapInstallRoot(WScreen *scr);
72
73 void wColormapUninstallRoot(WScreen *scr);
74
75 void wColormapAllowClientInstallation(WScreen *scr, Bool starting);
76
77 Pixmap LoadIcon(WScreen *scr, char *path, char *mask, int title_height);
78
79 void PlaceIcon(WScreen *scr, int *x_ret, int *y_ret, int head);
80
81 int calcIntersectionArea(int x1, int y1, int w1, int h1,
82 int x2, int y2, int w2, int h2);
83
84 void PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
85 unsigned int width, unsigned int height);
86
87
88 void StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next, Bool class_only);
89
90 #ifdef USECPP
91 char *MakeCPPArgs(char *path);
92 #endif
93
94 char *StrConcatDot(char *a, char *b);
95
96 char *ExpandOptions(WScreen *scr, char *cmdline);
97
98 void ExecuteShellCommand(WScreen *scr, char *command);
99
100 Bool IsDoubleClick(WScreen *scr, XEvent *event);
101
102 WWindow *NextToFocusAfter(WWindow *wwin);
103 WWindow *NextToFocusBefore(WWindow *wwin);
104
105 void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y);
106
107 char *ShrinkString(WMFont *font, char *string, int width);
108
109 char *FindImage(char *paths, char *file);
110
111 RImage*wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
112
113 void ParseWindowName(WMPropList *value, char **winstance, char **wclass,
114 char *where);
115
116 void SendHelperMessage(WScreen *scr, char type, int workspace, char *msg);
117
118 char *GetShortcutString(char *text);
119
120 char *EscapeWM_CLASS(char *name, char *class);
121
122 void UnescapeWM_CLASS(char *str, char **name, char **class);
123
124 Bool UpdateDomainFile(WDDomain *domain);
125
126 #ifdef NUMLOCK_HACK
127 void wHackedGrabKey(int keycode, unsigned int modifiers,
128 Window grab_window, Bool owner_events, int pointer_mode,
129 int keyboard_mode);
130 #endif
131
132 void wHackedGrabButton(unsigned int button, unsigned int modifiers,
133 Window grab_window, Bool owner_events,
134 unsigned int event_mask, int pointer_mode,
135 int keyboard_mode, Window confine_to, Cursor cursor);
136
137
138 void ExecExitScript();
139
140 /****** I18N Wrapper for XFetchName,XGetIconName ******/
141
142 Bool wFetchName(Display *dpy, Window win, char **winname);
143 Bool wGetIconName(Display *dpy, Window win, char **iconname);
144
145 /* Free returned string it when done. (applies to the next 2 functions) */
146 char* GetCommandForWindow(Window win);
147 char* GetProgramNameForWindow(Window win);
148
149 Bool GetCommandForPid(int pid, char ***argv, int *argc);
150
151 #endif