e16/src/mod-misc.c

263 lines
7.3 KiB
C
Raw Normal View History

2004-12-28 15:46:49 -08:00
/*
2007-01-13 11:14:29 -08:00
* Copyright (C) 2003-2007 Kim Woelders
2004-12-28 15:46:49 -08:00
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "dialog.h"
#include "emodule.h"
#include "settings.h"
#include "snaps.h"
2004-12-28 15:46:49 -08:00
/***********************************************************************
* *** should all go elsewhere ***
**********************************************************************/
/* Use static module list for now */
extern const EModule ModAclass;
extern const EModule ModBackgrounds;
extern const EModule ModButtons;
2004-12-28 15:46:49 -08:00
#if USE_COMPOSITE
extern const EModule ModCompMgr;
extern const EModule ModMagwin;
2004-12-28 15:46:49 -08:00
#endif
extern const EModule ModCursors;
extern const EModule ModDesktops;
extern const EModule ModEffects;
extern const EModule ModEwins;
extern const EModule ModFocus;
extern const EModule ModGroups;
extern const EModule ModImageclass;
extern const EModule ModIconboxes;
extern const EModule ModLocale;
extern const EModule ModMenus;
extern const EModule ModMisc;
extern const EModule ModPagers;
extern const EModule ModSlideouts;
extern const EModule ModSound;
extern const EModule ModTextclass;
extern const EModule ModTheme;
extern const EModule ModTooltips;
#ifdef ENABLE_THEME_TRANSPARENCY
extern const EModule ModTransparency;
#endif
extern const EModule ModWarplist;
extern const EModule ModWindowMatch;
2004-12-28 15:46:49 -08:00
const EModule *p_modules[] = {
&ModAclass,
&ModBackgrounds,
&ModButtons,
#if USE_COMPOSITE
&ModCompMgr,
&ModMagwin,
2004-12-28 15:46:49 -08:00
#endif
&ModCursors,
2005-04-25 15:07:37 -07:00
&ModDesktops,
2004-12-28 15:46:49 -08:00
&ModEwins,
&ModEffects,
&ModFocus,
&ModGroups,
&ModIconboxes,
&ModImageclass,
&ModLocale,
2004-12-28 15:46:49 -08:00
&ModMenus,
&ModMisc,
&ModPagers,
&ModSlideouts,
&ModSound,
&ModTextclass,
&ModTheme,
&ModTooltips,
#ifdef ENABLE_THEME_TRANSPARENCY
2004-12-28 15:46:49 -08:00
&ModTransparency,
#endif
2004-12-28 15:46:49 -08:00
&ModWarplist,
&ModWindowMatch,
2004-12-28 15:46:49 -08:00
};
int n_modules = sizeof(p_modules) / sizeof(EModule *);
#if 0
2004-12-28 15:46:49 -08:00
static void
MiscSighan(int sig, void *prm __UNUSED__)
{
switch (sig)
{
case ESIGNAL_START:
break;
}
}
#endif
2004-12-28 15:46:49 -08:00
static const CfgItem MiscCfgItems[] = {
2004-12-28 15:46:49 -08:00
2007-01-27 20:59:46 -08:00
CFG_ITEM_INT(Conf, animation.step, 10),
CFG_ITEM_INT(Conf, buttons.move_resistance, 10),
2004-12-28 15:46:49 -08:00
CFG_ITEM_BOOL(Conf, dialogs.headers, 0),
CFG_ITEM_BOOL(Conf, dialogs.button_image, 0),
2004-12-28 15:46:49 -08:00
CFG_ITEM_BOOL(Conf, dock.enable, 1),
CFG_ITEM_BOOL(Conf, dock.sticky, 1),
2004-12-28 15:46:49 -08:00
CFG_ITEM_INT(Conf, dock.dirmode, DOCK_DOWN),
CFG_ITEM_INT(Conf, dock.startx, 0),
CFG_ITEM_INT(Conf, dock.starty, 0),
CFG_ITEM_BOOL(Conf, hints.set_xroot_info_on_root_window, 0),
CFG_ITEM_INT(Conf, movres.mode_move, 0),
CFG_ITEM_INT(Conf, movres.mode_resize, 2),
CFG_ITEM_INT(Conf, movres.mode_info, 1),
CFG_ITEM_BOOL(Conf, movres.update_while_moving, 0),
CFG_ITEM_BOOL(Conf, movres.enable_sync_request, 0),
CFG_ITEM_INT(Conf, opacity.menus, 85),
CFG_ITEM_INT(Conf, opacity.movres, 60),
CFG_ITEM_INT(Conf, opacity.tooltips, 80),
2004-12-28 15:46:49 -08:00
CFG_ITEM_BOOL(Conf, place.manual, 0),
CFG_ITEM_BOOL(Conf, place.manual_mouse_pointer, 0),
CFG_ITEM_BOOL(Conf, place.slidein, 0),
CFG_ITEM_BOOL(Conf, place.cleanupslide, 1),
CFG_ITEM_INT(Conf, place.slidemode, 0),
CFG_ITEM_INT(Conf, place.slidespeedmap, 6000),
CFG_ITEM_INT(Conf, place.slidespeedcleanup, 8000),
2004-12-28 15:46:49 -08:00
CFG_ITEM_BOOL(Conf, place.ignore_struts, 0),
CFG_ITEM_BOOL(Conf, place.raise_fullscreen, 0),
CFG_ITEM_BOOL(Conf, session.enable_script, 0),
CFG_ITEM_STR(Conf, session.script),
CFG_ITEM_BOOL(Conf, session.enable_logout_dialog, 1),
CFG_ITEM_BOOL(Conf, session.enable_reboot_halt, 0),
CFG_ITEM_STR(Conf, session.cmd_reboot),
CFG_ITEM_STR(Conf, session.cmd_halt),
CFG_ITEM_BOOL(Conf, shading.animate, 1),
CFG_ITEM_INT(Conf, shading.speed, 8000),
2004-12-28 15:46:49 -08:00
CFG_ITEM_BOOL(Conf, snap.enable, 1),
CFG_ITEM_INT(Conf, snap.edge_snap_dist, 8),
CFG_ITEM_INT(Conf, snap.screen_snap_dist, 32),
CFG_ITEM_BOOL(Conf, startup.firsttime, 1),
CFG_ITEM_BOOL(Conf, startup.animate, 1),
CFG_ITEM_BOOL(Conf, testing.argb_internal_objects, 0),
CFG_ITEM_BOOL(Conf, testing.argb_internal_clients, 0),
CFG_ITEM_BOOL(Conf, testing.argb_clients, 0),
CFG_ITEM_BOOL(Conf, testing.argb_clients_inherit_attr, 0),
CFG_ITEM_INT(Conf, testing.mask_alpha_threshold, 8),
2004-12-28 15:46:49 -08:00
CFG_ITEM_BOOL(Conf, autosave, 1),
CFG_ITEM_BOOL(Conf, memory_paranoia, 1),
CFG_ITEM_BOOL(Conf, save_under, 0),
};
#define N_CFG_ITEMS ((int)(sizeof(MiscCfgItems)/sizeof(CfgItem)))
2004-12-28 15:46:49 -08:00
static void
MiscIpcExec(const char *params, Client * c __UNUSED__)
{
if (params)
execApplication(params, EXEC_SET_LANG);
else
IpcPrintf("exec what?\n");
2004-12-28 15:46:49 -08:00
}
static void
MiscIpcConfig(const char *params, Client * c __UNUSED__)
{
const char *p;
char cmd[128], prm[128];
int len;
cmd[0] = prm[0] = '\0';
p = params;
if (p)
{
len = 0;
sscanf(p, "%100s %100s %n", cmd, prm, &len);
p += len;
}
if (!p || cmd[0] == '?')
{
/* Show info */
}
else if (!strncmp(cmd, "cfg", 3))
{
if (!strncmp(prm, "autoraise", 2))
DialogShowSimple(&DlgAutoraise, NULL);
2004-12-28 15:46:49 -08:00
else if (!strncmp(prm, "misc", 2))
DialogShowSimple(&DlgMisc, NULL);
2004-12-28 15:46:49 -08:00
else if (!strncmp(prm, "moveresize", 2))
DialogShowSimple(&DlgMoveResize, NULL);
2004-12-28 15:46:49 -08:00
else if (!strncmp(prm, "placement", 2))
DialogShowSimple(&DlgPlacement, NULL);
2004-12-28 15:46:49 -08:00
else if (!strncmp(prm, "remember", 2))
DialogShowSimple(&DlgRemember, NULL);
else if (!strncmp(prm, "session", 2))
DialogShowSimple(&DlgSession, NULL);
else if (prm[0] == '\0')
SettingsConfiguration();
2004-12-28 15:46:49 -08:00
}
}
static const IpcItem MiscIpcArray[] = {
2004-12-28 15:46:49 -08:00
{
MiscIpcExec,
"exec", NULL,
"Execute program",
" exec <command> Execute command\n"}
,
{
MiscIpcConfig,
"misc", NULL,
"Miscellaneous functions",
" misc cfg <thing> Configure thing (autoraise/misc/moveresize/placement/remember/session)\n"}
2004-12-28 15:46:49 -08:00
};
#define N_IPC_FUNCS (sizeof(MiscIpcArray)/sizeof(IpcItem))
/* Stuff not elsewhere */
const EModule ModMisc = {
2004-12-28 15:46:49 -08:00
"misc", NULL,
NULL,
2004-12-28 15:46:49 -08:00
{N_IPC_FUNCS, MiscIpcArray}
,
{N_CFG_ITEMS, MiscCfgItems}
2004-12-28 15:46:49 -08:00
};
void
autosave(void)
{
if (!Mode.wm.save_ok)
return;
if (EDebug(EDBUG_TYPE_SESSION))
Eprintf("autosave\n");
Real_SaveSnapInfo(0, NULL);
/* Save the configuration parameters */
ConfigurationSave();
}