1 /*****************************************************************************/
2 /* Enlightenment - The Window Manager that dares to do what others don't */
3 /*****************************************************************************/
5 * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
6 * Copyright (C) 2004-2009 Kim Woelders
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to
10 * deal in the Software without restriction, including without limitation the
11 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 * sell copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies of the Software, its documentation and marketing & publicity
17 * materials, and acknowledgment shall be given in the documentation, materials
18 * and software packages that this Software was used.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 #include <sys/types.h>
46 #define FILEPATH_LEN_MAX 4096
49 #define MAX(a,b) ((a)>(b)?(a):(b))
52 #define MIN(a,b) ((a)<(b)?(a):(b))
55 #define IN_RANGE(a, b, range) \
56 ((((a) > (b)) && ((a) - (b) <= (range))) || \
57 (((a) <= (b)) && ((b) - (a) <= (range))))
59 #define IN_ABOVE(a, b, range) \
60 (((a) >= (b)) && ((a) - (b) <= (range)))
62 #define IN_BELOW(a, b, range) \
63 (((a) <= (b)) && ((b) - (a) <= (range)))
65 #define SPANS_COMMON(x1, w1, x2, w2) \
66 (!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
68 #define STATE_NORMAL 0
69 #define STATE_HILITED 1
70 #define STATE_CLICKED 2
71 #define STATE_DISABLED 3
75 #define FLAG_MINIICON 2
77 #define FLAG_FIXED_HORIZ 8
78 #define FLAG_FIXED_VERT 16
80 #define MODE_FOCUS_POINTER 0
81 #define MODE_FOCUS_SLOPPY 1
82 #define MODE_FOCUS_CLICK 2
84 #define EDGE_FLIP_OFF 0
85 #define EDGE_FLIP_ON 1
86 #define EDGE_FLIP_MOVE 2
99 #define MODE_MOVE_PENDING 1
101 #define MODE_RESIZE 3
102 #define MODE_RESIZE_H 4
103 #define MODE_RESIZE_V 5
104 #define MODE_DESKDRAG 6
105 #define MODE_BUTTONDRAG 7
106 #define MODE_DESKRAY 8
107 #define MODE_PAGER_DRAG_PENDING 9
108 #define MODE_PAGER_DRAG 10
110 #define EVENT_MOUSE_DOWN 0
111 #define EVENT_MOUSE_UP 1
112 #define EVENT_MOUSE_ENTER 2
113 #define EVENT_MOUSE_LEAVE 3
114 #define EVENT_KEY_DOWN 4
115 #define EVENT_KEY_UP 5
116 #define EVENT_DOUBLE_DOWN 6
117 #define EVENT_FOCUS_IN 7
118 #define EVENT_FOCUS_OUT 8
120 /* Server extensions */
123 #define XEXT_SCRSAVER 2
125 #define XEXT_COMPOSITE 4
126 #define XEXT_DAMAGE 5
128 #define XEXT_RENDER 7
131 #define XEXT_CM_ALL 16
133 #define XEXT_AVAILABLE(ext) (Mode.server.extensions & (1 << ext))
140 /* Configuration parameters */
143 unsigned int step; /* Animation time step, ms */
147 int delay; /* milliseconds */
163 int dragbar_ordering;
164 char desks_wraparound;
169 char areas_wraparound;
171 int edge_flip_resistance;
178 char enable; /* wmdockapp only */
179 char sticky; /* Make dockapps sticky by default */
187 char transientsfollowleader;
188 char switchfortransientmap;
189 char all_new_windows_get_focus;
190 char new_transients_get_focus;
191 char new_transients_get_focus_if_group_focused;
197 char set_xroot_info_on_root_window;
206 KeySym left, right, up, down, escape, ret;
213 int mode_maximize_default;
215 char avoid_server_grab;
216 char update_while_moving;
217 char enable_sync_request;
218 char dragbar_nocover;
229 char manual_mouse_pointer;
230 char center_if_desk_full;
232 char raise_fullscreen;
237 int slidespeedcleanup;
238 #ifdef USE_XINERAMA_no /* Not implemented */
239 char extra_head; /* Not used */
245 char enable_logout_dialog;
246 char enable_reboot_halt;
257 int screen_snap_dist;
264 char use_theme_font_cfg;
265 char use_alt_font_cfg;
270 #ifdef ENABLE_THEME_TRANSPARENCY
292 char raise_on_select;
298 char argb_internal_objects;
299 char argb_internal_clients;
301 char argb_clients_inherit_attr;
302 int image_cache_size;
303 int mask_alpha_threshold;
304 char enable_startup_id;
305 char use_render_for_scaling;
306 char bindings_reload;
307 unsigned int no_sync_mask;
311 char memory_paranoia;
318 unsigned int startup_id;
329 char dummy; /* Prevent empty struct */
331 char xinerama_active;
339 int cx, cy; /* Any detected pointer movement */
340 int mx, my; /* Motion event */
341 int px, py; /* Previous motion event */
345 unsigned int last_button;
346 unsigned int last_keycode;
347 unsigned int last_keystate;
351 unsigned int damage_count;
355 char pointer_grab_active;
356 Window pointer_grab_window;
360 char utf8_int; /* Use UTF-8 internally */
361 char utf8_loc; /* Locale is UTF-8 */
364 unsigned int mod_key_mask;
365 unsigned int mod_combos[8];
368 char check; /* Avoid losing windows offscreen */
370 int swapcoord_x, swapcoord_y;
373 signed char enable_features;
382 unsigned int extensions;
393 char *exec_name; /* argv[0] */
394 char master; /* We are the master E */
395 char single; /* No slaves */
396 char window; /* Running in virtual root window */
403 char in_signal_handler;
418 EWin *mouse_over_ewin;
420 Colormap current_cmap;
424 char keybinds_changed;
425 char showing_desktop;
426 Window button_proxy_win;
432 * Function prototypes
439 #define EXEC_SET_LANG 0x01
440 #define EXEC_SET_STARTUP_ID 0x02
441 int execApplication(const char *params, int flags);
442 void Espawn(int argc, char **argv);
443 void EspawnCmd(const char *cmd);
446 void SkipTillEnd(FILE * ConfigFile);
447 char *GetLine(char *s, int size, FILE * f);
448 int ConfigParseline1(char *str, char *s2, char **p2, char **p3);
449 void ConfigParseError(const char *where, const char *line);
450 void ConfigAlertLoad(const char *txt);
451 char *FindFile(const char *file, const char *themepath);
452 char *ThemeFileFind(const char *file);
453 char *ConfigFileFind(const char *name, const char *themepath,
455 int ConfigFileLoad(const char *name, const char *themepath,
456 int (*parse) (FILE * fs), int preparse);
457 int ConfigFileRead(FILE * fs);
458 int ThemeConfigLoad(void);
462 void __PRINTF_2__ DialogOK(const char *title, const char *fmt, ...);
463 void DialogOKstr(const char *title, const char *txt);
465 #define DialogOK(title, fmt, ...) do {} while(0)
466 #define DialogOKstr(title, fmt) do {} while(0)
467 #endif /* ENABLE_DIALOGS */
470 void ConfigurationLoad(void);
471 void ConfigurationSave(void);
472 void ConfigurationSet(const char *params);
473 void ConfigurationShow(const char *params);
476 void EdgeCheckMotion(int x, int y);
477 void EdgeWindowsShow(void);
478 void EdgeWindowsHide(void);
481 Window ExtInitWinCreate(void);
482 void ExtInitWinSet(Window win);
483 Window ExtInitWinGet(void);
484 void ExtInitWinKill(void);
487 void FontConfigLoad(void);
488 void FontConfigUnload(void);
489 const char *FontLookup(const char *name);
492 void SignalsSetup(void);
493 void SignalsRestore(void);
496 __NORETURN__ void EExit(int exitcode);
497 __EXPORT__ const char *EDirRoot(void);
498 const char *EDirBin(void);
499 const char *EDirUser(void);
500 const char *EDirUserCache(void);
501 void EDirMake(const char *base, const char *name);
502 const char *EGetSavePrefix(void);
506 void Quicksort(void **a, int l, int r,
507 int (*CompareFunc) (void *d1, void *d2));
508 void ETimedLoopInit(int k1, int k2, int speed);
509 int ETimedLoopNext(void);
515 int matchregexp(const char *rx, const char *s);
518 void SetupX(const char *dstr);
521 int SlideoutsConfigLoad(FILE * fs);
524 void StartupWindowsCreate(void);
525 void StartupWindowsOpen(void);
526 void StartupBackgroundsDestroy(void);
529 char *ThemeFind(const char *theme);
530 char *ThemePathName(const char *path);
531 void ThemePathFind(void);
532 char **ThemesList(int *num);
537 extern const char e_wm_name[];
538 extern const char e_wm_version[];
539 __EXPORT__ extern EConf Conf;
540 __EXPORT__ extern EMode Mode;