Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: Tag: branch-exp E.h Makefile.am actions.c config.c ewins.c ipc.c main.c mod-misc.c sound.c theme.c Added Files: Tag: branch-exp aclass.c Log Message: Split up action stuff, ewins module. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v retrieving revision 1.314.2.43 retrieving revision 1.314.2.44 diff -u -3 -r1.314.2.43 -r1.314.2.44 --- E.h 18 Sep 2004 13:32:25 -0000 1.314.2.43 +++ E.h 19 Sep 2004 08:02:13 -0000 1.314.2.44 @@ -1308,20 +1308,22 @@ * Function prototypes */ -/* actions.c */ -void RefreshScreen(void); -void GrabButtonGrabs(EWin * ewin); -void UnGrabButtonGrabs(EWin * ewin); +/* aclass.c */ ActionClass *CreateAclass(const char *name); +int AclassConfigLoad(FILE * fs); Action *CreateAction(char event, char anymod, int mod, int anybut, int but, char anykey, char *key, char *tooltipstring); void RemoveActionClass(ActionClass * ActionToRemove); -int ActionClassConfigLoad(FILE * fs); void AddToAction(Action * act, int id, void *params); void AddAction(ActionClass * a, Action * act); int EventAclass(XEvent * ev, EWin * ewin, ActionClass * a); +void GrabButtonGrabs(EWin * ewin); +void UnGrabButtonGrabs(EWin * ewin); + +/* actions.c */ +void RefreshScreen(void); void ActionsSetFunction(unsigned int id, int (*func) (EWin *, const char *)); int ActionsCall(unsigned int id, EWin * ewin, @@ -1737,7 +1739,6 @@ void EwinChangesStart(EWin * ewin); void EwinChangesProcess(EWin * ewin); -void EwinsInit(void); void EwinsEventsConfigure(int mode); void EwinsSetFree(void); @@ -2212,7 +2213,7 @@ void RememberImportantInfoForEwin(EWin * ewin); /* sound.c */ -int SoundPlay(const char *name); +void SoundPlay(const char *name); /* stacking.c */ typedef struct _ewinlist EWinList; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Makefile.am,v retrieving revision 1.43.2.16 retrieving revision 1.43.2.17 diff -u -3 -r1.43.2.16 -r1.43.2.17 --- Makefile.am 5 Sep 2004 11:46:33 -0000 1.43.2.16 +++ Makefile.am 19 Sep 2004 08:02:14 -0000 1.43.2.17 @@ -19,6 +19,7 @@ ecore-e16.h \ emodule.h \ timestamp.h \ + aclass.c \ actions.c \ alert.c \ areas.c \ =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/actions.c,v retrieving revision 1.174.2.15 retrieving revision 1.174.2.16 diff -u -3 -r1.174.2.15 -r1.174.2.16 --- actions.c 5 Sep 2004 11:46:33 -0000 1.174.2.15 +++ actions.c 19 Sep 2004 08:02:14 -0000 1.174.2.16 @@ -21,7 +21,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "E.h" -#include "conf.h" #include "timestamp.h" typedef struct @@ -35,562 +34,6 @@ } ActionItem; static ActionItem ActionItems[ACTION_NUMBEROF]; -static char mode_action_destroy = 0; - -ActionClass * -CreateAclass(const char *name) -{ - ActionClass *a; - - EDBUG(5, "CreateAclass"); - a = Emalloc(sizeof(ActionClass)); - a->name = Estrdup(name); - a->num = 0; - a->list = NULL; - a->tooltipstring = NULL; - a->ref_count = 0; - EDBUG_RETURN(a); -} - -int -ActionClassConfigLoad(FILE * fs) -{ - int err = 0; - ActionClass *ac = NULL; - Action *a = NULL; - char s[FILEPATH_LEN_MAX]; - int i1; - char s2[FILEPATH_LEN_MAX]; - char s3[FILEPATH_LEN_MAX]; - char event = 0; - char anymod = 0; - int mod = 0; - int anybut = 0; - int but = 0; - int first = 1; - char anykey = 0; - char *key = NULL; - char *action_tooltipstring = NULL; - char global = 0; - int fields; - - while (GetLine(s, sizeof(s), fs)) - { - s2[0] = 0; - i1 = CONFIG_INVALID; - fields = sscanf(s, "%i %4000s", &i1, s2); - - if (fields < 1) - i1 = CONFIG_INVALID; - else if (i1 == CONFIG_CLOSE || i1 == CONFIG_NEXT) - { - if (fields != 1) - { - RecoverUserConfig(); - Alert(_("CONFIG: ignoring extra data in \"%s\"\n"), s); - } - } - else if (i1 != CONFIG_INVALID) - { - if (fields != 2) - { - RecoverUserConfig(); - Alert(_("CONFIG: missing required data in \"%s\"\n"), s); - } - } - switch (i1) - { - case CONFIG_CLOSE: - goto done; - case CONFIG_CLASSNAME: - case ACLASS_NAME: - ac = RemoveItem(s2, 0, LIST_FINDBY_NAME, LIST_TYPE_ACLASS); - if (!ac) - { - ac = RemoveItem(s2, 0, LIST_FINDBY_NAME, - LIST_TYPE_ACLASS_GLOBAL); - } - if (ac) - { - if (!strcmp(s2, "KEYBINDINGS")) - Mode.keybinds_changed = 1; - RemoveActionClass(ac); - } - ac = CreateAclass(s2); - break; - case CONFIG_TYPE: - case ACLASS_TYPE: - AddItem(ac, ac->name, 0, atoi(s2)); - if (atoi(s2) == LIST_TYPE_ACLASS_GLOBAL) - global = 1; - - break; - case CONFIG_MODIFIER: - case ACLASS_MODIFIER: - /* These are the defines that I have listed... - * These, therefore, are the ones that I am - * going to accept by default. - * REMINDER: add and'ing in future!!!! - * #define ShiftMask (1<<0) - * #define LockMask (1<<1) - * #define ControlMask (1<<2) - * #define Mod1Mask (1<<3) - * #define Mod2Mask (1<<4) - * #define Mod3Mask (1<<5) - * #define Mod4Mask (1<<6) - * #define Mod5Mask (1<<7) - */ - switch (atoi(s2)) - { - case MASK_NONE: - mod = 0; - break; - case MASK_SHIFT: - mod |= ShiftMask; - break; - case MASK_LOCK: - mod |= LockMask; - break; - case MASK_CTRL: - mod |= ControlMask; - break; - case MASK_MOD1: - mod |= Mod1Mask; - break; - case MASK_MOD2: - mod |= Mod2Mask; - break; - case MASK_MOD3: - mod |= Mod3Mask; - break; - case MASK_MOD4: - mod |= Mod4Mask; - break; - case MASK_MOD5: - mod |= Mod5Mask; - break; - case MASK_CTRL_ALT: - mod |= ControlMask | Mod1Mask; - break; - case MASK_SHIFT_ALT: - mod |= ShiftMask | Mod1Mask; - break; - case MASK_CTRL_SHIFT: - mod |= ShiftMask | ControlMask; - break; - case MASK_CTRL_SHIFT_ALT: - mod |= ShiftMask | ControlMask | Mod1Mask; - break; - case MASK_SHIFT_META4: - mod |= Mod4Mask | ShiftMask; - break; - case MASK_CTRL_META4: - mod |= Mod4Mask | ControlMask; - break; - case MASK_CTRL_META4_SHIFT: - mod |= Mod4Mask | ControlMask | ShiftMask; - break; - case MASK_SHIFT_META5: - mod |= Mod5Mask | ShiftMask; - break; - case MASK_CTRL_META5: - mod |= Mod5Mask | ControlMask; - break; - case MASK_CTRL_META5_SHIFT: - mod |= Mod5Mask | ControlMask | ShiftMask; - break; - case MASK_WINDOWS_SHIFT: - mod |= Mod2Mask | ShiftMask; - break; - case MASK_WINDOWS_CTRL: - mod |= Mod2Mask | ControlMask; - break; - case MASK_WINDOWS_ALT: - mod |= Mod2Mask | Mod1Mask; - break; - default: - break; - } - break; - case CONFIG_ANYMOD: - case ACLASS_ANYMOD: - anymod = atoi(s2); - break; - case CONFIG_ANYBUT: - case ACLASS_ANYBUT: - anybut = atoi(s2); - break; - case CONFIG_BUTTON: - case ACLASS_BUT: - but = atoi(s2); - break; - case CONFIG_ANYKEY: - case ACLASS_ANYKEY: - anykey = atoi(s2); - break; - case ACLASS_KEY: - if (key) - Efree(key); - key = Estrdup(s2); - break; - case ACLASS_EVENT_TRIGGER: - event = atoi(s2); - break; - case CONFIG_NEXT: - mod = 0; - anymod = 0; - anybut = 0; - first = 1; - break; - case CONFIG_ACTION: - if (first) - { - a = CreateAction(event, anymod, mod, anybut, but, anykey, - key, action_tooltipstring); - /* the correct place to grab an action key */ - if (action_tooltipstring) - { - Efree(action_tooltipstring); - action_tooltipstring = NULL; - } - if (key) - Efree(key); - key = NULL; - if (global) - GrabActionKey(a); - AddAction(ac, a); - first = 0; - } - s3[0] = 0; - sscanf(s, "%*s %4000s %4000s", s2, s3); - if (!s3[0]) - AddToAction(a, atoi(s2), NULL); - else - AddToAction(a, atoi(s2), Estrdup(atword(s, 3))); - break; - case CONFIG_ACTION_TOOLTIP: - if (action_tooltipstring) - { - action_tooltipstring = - Erealloc(action_tooltipstring, - (strlen(action_tooltipstring) + - strlen(atword(s, 2)) + 2)); - action_tooltipstring = strcat(action_tooltipstring, "\n"); - action_tooltipstring = - strcat(action_tooltipstring, atword(s, 2)); - } - else - action_tooltipstring = Estrdup(atword(s, 2)); - break; - case CONFIG_TOOLTIP: - if (ac->tooltipstring) - { - ac->tooltipstring = - Erealloc(ac->tooltipstring, - (strlen(ac->tooltipstring) + - strlen(atword(s, 2)) + 2)); - ac->tooltipstring = strcat(ac->tooltipstring, "\n"); - ac->tooltipstring = strcat(ac->tooltipstring, atword(s, 2)); - } - else - ac->tooltipstring = Estrdup(atword(s, 2)); - break; - default: - RecoverUserConfig(); - Alert(_("Warning: unable to determine what to do with\n" - "the following text in the middle of current " - "ActionClass definition:\n" - "%s\nWill ignore and continue...\n"), s); - break; - } - } - err = -1; - - if (ac) - RemoveActionClass(ac); - if (action_tooltipstring) - Efree(action_tooltipstring); - - done: - if (key) - Efree(key); - - return err; -} - -void -RefreshScreen(void) -{ - - Window win; - XSetWindowAttributes attr; - - EDBUG(4, "CreateAclass"); - - attr.save_under = False; - attr.backing_store = NotUseful; - - win = - XCreateWindow(disp, VRoot.win, 0, 0, VRoot.w, VRoot.h, 0, CopyFromParent, - CopyFromParent, CopyFromParent, - CWBackingStore | CWSaveUnder, &attr); - XMapRaised(disp, win); - XDestroyWindow(disp, win); - XFlush(disp); - - EDBUG_RETURN_; -} - -void -GrabButtonGrabs(EWin * ewin) -{ - ActionClass *ac; - int j; - Action *a; - unsigned int mod, button, mask; - - ac = (ActionClass *) FindItem("BUTTONBINDINGS", 0, LIST_FINDBY_NAME, - LIST_TYPE_ACLASS); - - if (!ac) - return; - - ac->ref_count++; - for (j = 0; j < ac->num; j++) - { - a = ac->list[j]; - if ((!a) || ((a->event != EVENT_MOUSE_DOWN) - && (a->event != EVENT_MOUSE_UP))) - continue; - - mod = 0; - button = 0; - - if (a->anymodifier) - mod = AnyModifier; - else - mod = a->modifiers; - - if (a->anybutton) - button = AnyButton; - else - button = a->button; - - mask = ButtonPressMask | ButtonReleaseMask; - - if (mod == AnyModifier) - { - GrabButtonSet(button, mod, ewin->win, mask, ECSR_PGRAB, 1); - } - else - { - int i; - - for (i = 0; i < 8; i++) - { - GrabButtonSet(button, mod | Mode.masks.mod_combos[i], - ewin->win, mask, ECSR_PGRAB, 1); - } - } - } -} - -void -UnGrabButtonGrabs(EWin * ewin) -{ - ActionClass *ac; - int j; - Action *a; - unsigned int mod, button; - - ac = (ActionClass *) FindItem("BUTTONBINDINGS", 0, LIST_FINDBY_NAME, - LIST_TYPE_ACLASS); - - if (!ac) - return; - - ac->ref_count--; - for (j = 0; j < ac->num; j++) - { - a = ac->list[j]; - if ((!a) || ((a->event != EVENT_MOUSE_DOWN) - && (a->event != EVENT_MOUSE_UP))) - continue; - - mod = 0; - button = 0; - - if (a->anymodifier) - mod = AnyModifier; - else - mod = a->modifiers; - - if (a->anybutton) - button = AnyButton; - else - button = a->button; - - if (mod == AnyModifier) - { - GrabButtonRelease(button, mod, ewin->win); - } - else - { - int i; - - for (i = 0; i < 8; i++) - { - GrabButtonRelease(button, mod | Mode.masks.mod_combos[i], - ewin->win); - } - } - } -} - -Action * -CreateAction(char event, char anymod, int mod, int anybut, int but, - char anykey, char *key, char *tooltipstring) -{ - Action *act; - - EDBUG(5, "CreateAction"); - - act = Emalloc(sizeof(Action)); - act->action = NULL; - act->event = event; - act->anymodifier = anymod; - act->modifiers = mod; - act->anybutton = anybut; - act->button = but; - act->anykey = anykey; - if (!key) - act->key = 0; - else - act->key = XKeysymToKeycode(disp, XStringToKeysym(key)); - act->key_str = Estrdup(key); - if (tooltipstring) - act->tooltipstring = Estrdup(tooltipstring); - else - act->tooltipstring = NULL; - - EDBUG_RETURN(act); -} - -static void -RemoveActionType(ActionType * ActionTypeToRemove) -{ - ActionType *ptr, *pp; - - EDBUG(5, "RemoveActionType"); - - ptr = ActionTypeToRemove; - while (ptr) - { - if (ptr->params) - Efree(ptr->params); - pp = ptr; - ptr = ptr->Next; - Efree(pp); - } - - EDBUG_RETURN_; -} - -static void -RemoveAction(Action * ActionToRemove) -{ - EDBUG(5, "RemoveAction"); - - if (!ActionToRemove) - EDBUG_RETURN_; - - if ((ActionToRemove->event == EVENT_KEY_DOWN) - || (ActionToRemove->event == EVENT_KEY_UP)) - UnGrabActionKey(ActionToRemove); - if (ActionToRemove->action) - RemoveActionType(ActionToRemove->action); - if (ActionToRemove->tooltipstring) - Efree(ActionToRemove->tooltipstring); - if (ActionToRemove->key_str) - Efree(ActionToRemove->key_str); - Efree(ActionToRemove); - - EDBUG_RETURN_; - -} - -void -RemoveActionClass(ActionClass * ActionClassToRemove) -{ - int i; - - EDBUG(5, "RemoveActionClass"); - - if (!ActionClassToRemove) - EDBUG_RETURN_; - - if (ActionClassToRemove->ref_count > 0) - { - DialogOK(_("ActionClass Error!"), _("%u references remain\n"), - ActionClassToRemove->ref_count); - EDBUG_RETURN_; - } - while (RemoveItemByPtr(ActionClassToRemove, LIST_TYPE_ACLASS)); - - for (i = 0; i < ActionClassToRemove->num; i++) - RemoveAction(ActionClassToRemove->list[i]); - if (ActionClassToRemove->list) - Efree(ActionClassToRemove->list); - if (ActionClassToRemove->name) - Efree(ActionClassToRemove->name); - if (ActionClassToRemove->tooltipstring) - Efree(ActionClassToRemove->tooltipstring); - Efree(ActionClassToRemove); - mode_action_destroy = 1; - - EDBUG_RETURN_; -} - -void -AddToAction(Action * act, int id, void *params) -{ - ActionType *pptr, *ptr, *at; - - EDBUG(5, "AddToAction"); - pptr = NULL; - at = Emalloc(sizeof(ActionType)); - at->Next = NULL; - at->Type = id; - at->params = params; - if (!act->action) - { - act->action = at; - } - else - { - ptr = act->action; - while (ptr) - { - pptr = ptr; - ptr = ptr->Next; - } - pptr->Next = at; - } - EDBUG_RETURN_; -} - -void -AddAction(ActionClass * a, Action * act) -{ - EDBUG(5, "AddAction"); - a->num++; - if (!a->list) - a->list = Emalloc(sizeof(Action *)); - else - a->list = Erealloc(a->list, a->num * sizeof(Action *)); - a->list[a->num - 1] = act; - EDBUG_RETURN_; -} void ActionsSetFunction(unsigned int id, int (*func) (EWin *, const char *)) @@ -653,165 +96,29 @@ return af->func(ewin, params); } -static int -handleAction(EWin * ewin, ActionType * action) -{ - /* This function will handle any type of action that is passed into - * it. ALL internal events should be passed through this function. - * No exceptions. --Mandrake (02/26/98) - */ - - int error; - - EDBUG(5, "handleAction"); - error = ActionsCall(action->Type, ewin, action->params); - - /* Did we just hose ourselves? if so, we'd best not stick around here */ - if (mode_action_destroy) - EDBUG_RETURN(0); - - /* If there is another action in this series, (now that - * we're sure we didn't already die) perform it - */ - if (!error) - if (action->Next) - error = handleAction(ewin, action->Next); - - EDBUG_RETURN(error); -} - -int -EventAclass(XEvent * ev, EWin * ewin, ActionClass * a) +#if 0 /* Not used */ +void +RefreshScreen(void) { - KeyCode key; - int i, type, button, modifiers, ok, mouse, mask, val = 0; - Action *act; - - EDBUG(5, "EventAclass"); - - if (Mode.action_inhibit) - EDBUG_RETURN(0); - - key = type = button = modifiers = mouse = 0; - - mask = - (ShiftMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | - Mod5Mask) & (~(Mode.masks.numlock | Mode.masks.scrollock | LockMask)); - - switch (ev->type) - { - case KeyPress: - type = EVENT_KEY_DOWN; - key = ev->xkey.keycode; - modifiers = ev->xbutton.state & mask; - mouse = 0; - break; - case KeyRelease: - type = EVENT_KEY_UP; - key = ev->xkey.keycode; - modifiers = ev->xbutton.state & mask; - mouse = 0; - break; - case ButtonPress: - if (ev->xbutton.time == 0) - type = EVENT_DOUBLE_DOWN; - else - type = EVENT_MOUSE_DOWN; - button = ev->xbutton.button; - modifiers = ev->xbutton.state & mask; - mouse = 1; - break; - case ButtonRelease: - type = EVENT_MOUSE_UP; - button = ev->xbutton.button; - modifiers = ev->xbutton.state & mask; - mouse = 1; - break; - case EnterNotify: - type = EVENT_MOUSE_ENTER; - button = -1; - modifiers = ev->xcrossing.state & mask; - mouse = 1; - break; - case LeaveNotify: - type = EVENT_MOUSE_LEAVE; - button = -1; - modifiers = ev->xcrossing.state & mask; - mouse = 1; - break; - default: - break; - } + Window win; + XSetWindowAttributes attr; - mode_action_destroy = 0; + EDBUG(4, "CreateAclass"); - for (i = 0; i < a->num; i++) - { - if (!mode_action_destroy) - { - act = a->list[i]; - ok = 0; - if ((act->event == type) && (act->action)) - { - if (mouse) - { - if (button < 0) - { - if (act->anymodifier) - ok = 1; - else if (act->modifiers == modifiers) - ok = 1; - } - else - { - if (act->anymodifier) - { - if (act->anybutton) - ok = 1; - else if (act->button == button) - ok = 1; - } - else if (act->modifiers == modifiers) - { - if (act->anybutton) - ok = 1; - else if (act->button == button) - ok = 1; - } - } - } - else - { - if (act->anymodifier) - { - if (act->anykey) - ok = 1; - else if (act->key == key) - ok = 1; - } - else if (act->modifiers == modifiers) - { - if (act->anykey) - ok = 1; - else if (act->key == key) - ok = 1; - } - } - if (ok) - { - handleAction(ewin, act->action); - val = 1; - } - } - } - if (mode_action_destroy) - break; - } + attr.save_under = False; + attr.backing_store = NotUseful; - mode_action_destroy = 0; + win = + XCreateWindow(disp, VRoot.win, 0, 0, VRoot.w, VRoot.h, 0, CopyFromParent, + CopyFromParent, CopyFromParent, + CWBackingStore | CWSaveUnder, &attr); + XMapRaised(disp, win); + XDestroyWindow(disp, win); + XFlush(disp); - EDBUG_RETURN(val); + EDBUG_RETURN_; } +#endif /* * The action functions @@ -2837,17 +2144,6 @@ return 0; } -#if 0 -static int -doCreateIconbox(EWin * edummy __UNUSED__, const char *params) -{ - ModuleCommand("ibox", "ibox", params); - SoundPlay("SOUND_NEW_ICONBOX"); - autosave(); - return 0; -} -#endif - static int doShowHideGroup(EWin * ewin, const char *params __UNUSED__) { =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v retrieving revision 1.111.2.19 retrieving revision 1.111.2.20 diff -u -3 -r1.111.2.19 -r1.111.2.20 --- config.c 18 Sep 2004 13:32:26 -0000 1.111.2.19 +++ config.c 19 Sep 2004 08:02:15 -0000 1.111.2.20 @@ -180,44 +180,6 @@ "Outcome is likely not good.\n"), txt); } -static void -Config_Extras(FILE * ConfigFile) -{ - char s[FILEPATH_LEN_MAX]; - char s2[FILEPATH_LEN_MAX]; - int i1; - int fields; - int err; - - while (GetLine(s, sizeof(s), ConfigFile)) - { - s2[0] = 0; - i1 = CONFIG_INVALID; - - fields = sscanf(s, "%i %4000s", &i1, s2); - switch (i1) - { - case CONFIG_IBOX: - err = ModuleConfigLoad("iconbox", ConfigFile); - if (err) - ConfigAlertLoad(_("Iconbox")); - break; - case CONFIG_CLOSE: - return; - break; - default: - Alert(_("Warning: unable to determine what to do with\n" - "the following text in the middle of current " - "Extras definition:\n" - "%s\nWill ignore and continue...\n"), s); - break; - } - } - RecoverUserConfig(); - Alert(_("Warning: Configuration appears to have ended before we were\n" - "Done loading an Extras block. Outcome is likely not good.\n")); -} - static int ConfigFilePreparse(const char *path, const char *dest) { @@ -272,26 +234,15 @@ } /* Split the process of finding the file from the process of loading it */ -static void -ConfigFileRead(const char *name) +static int +ConfigFileRead(FILE * fs) { - FILE *fs; int err; int i1, i2, fields; char s[FILEPATH_LEN_MAX]; int e_cfg_ver = 0; int min_e_cfg_ver = 0; - if (!name) - return; - - if (EventDebug(EDBUG_TYPE_CONFIG)) - Eprintf("ConfigFileRead %s\n", name); - - fs = fopen(name, "r"); - if (!fs) - return; - while (GetLine(s, sizeof(s), fs)) { if (IsWhitespace(s)) @@ -365,9 +316,6 @@ if (err) ConfigAlertLoad(_("Image class")); break; - case CONFIG_EXTRAS: - Config_Extras(fs); - break; case CONFIG_TOOLTIP: err = ModuleConfigLoad("tt", fs); if (err) @@ -406,11 +354,6 @@ ConfigAlertLoad(_("Iconbox")); break; #endif -#if 0 - case CONFIG_CONTROL: - Config_Control(fs); - break; -#endif case CONFIG_WINDOWMATCH: err = WindowMatchConfigLoad(fs); if (err) @@ -422,7 +365,7 @@ #endif break; case CONFIG_ACTIONCLASS: - err = ActionClassConfigLoad(fs); + err = AclassConfigLoad(fs); if (err) ConfigAlertLoad(_("Action class")); break; @@ -439,7 +382,7 @@ } done: - fclose(fs); + return 0; } char * @@ -551,28 +494,6 @@ return err; } -static void -ThemeConfigFileLoad(const char *name) -{ - char *themepath, *file; - - if (EventDebug(EDBUG_TYPE_CONFIG)) - Eprintf("ThemeConfigFileLoad %s\n", name); - - themepath = Mode.theme.path; - - if (strstr(name, "keybindings.cfg")) - themepath = NULL; - - file = ConfigFileFind(name, themepath); - if (!file) - return; - - ConfigFileRead(file); - - Efree(file); -} - int ThemeConfigLoad(void) { @@ -595,10 +516,6 @@ "tooltips.cfg", "backup-tooltips.cfg", "menustyles.cfg", -#if 1 /* FIXME - Remove */ - "keybindings.cfg", - "...e_autosave.cfg", /* FIXME - Don't preparse */ -#endif }; char s[FILEPATH_LEN_MAX]; Progressbar *p = NULL; @@ -625,10 +542,7 @@ } } - if (!strcmp(config_files[i], "...e_autosave.cfg")) - ThemeConfigFileLoad(EGetSavePrefix()); - else - ThemeConfigFileLoad(config_files[i]); + ConfigFileLoad(config_files[i], Mode.theme.path, ConfigFileRead); if (p) ProgressbarSet(p, (i * 100) / @@ -638,6 +552,13 @@ if (p) ProgressbarDestroy(p); + /* Loose ends... */ + ConfigFileLoad("keybindings.cfg", NULL, ConfigFileRead); + ConfigFileLoad(EGetSavePrefix(), NULL, ConfigFileRead); + + /* Make all of our fallback classes */ + SetupFallbackClasses(); + EDBUG_RETURN(0); } @@ -647,102 +568,15 @@ void SaveUserControlConfig(FILE * autosavefile) { - ActionClass *ac; - Action *aa; - int i; - ConfigurationSave(); EDBUG(5, "SaveUserControlConfig"); if (!autosavefile) EDBUG_RETURN_; - fprintf(autosavefile, "0 999\n"); - fprintf(autosavefile, "1000\n"); fprintf(autosavefile, "1001 0\n"); - if (Mode.keybinds_changed) - { - ac = (ActionClass *) FindItem("KEYBINDINGS", 0, LIST_FINDBY_NAME, - LIST_TYPE_ACLASS_GLOBAL); - if ((ac) && (ac->num > 0)) - { - fprintf(autosavefile, "11 999\n"); - fprintf(autosavefile, "100 %s\n", ac->name); - fprintf(autosavefile, "102 7\n"); - for (i = 0; i < ac->num; i++) - { - aa = ac->list[i]; - if ((aa) && (aa->action) && (aa->event == EVENT_KEY_DOWN) - && (aa->key_str)) - { - int mod; - - /* next action */ - if (i > 0) - fprintf(autosavefile, "105\n"); - /* key */ - fprintf(autosavefile, "427 %s\n", aa->key_str); - /* event */ - fprintf(autosavefile, "428 4\n"); - /* modifier */ - mod = 0; - if (aa->modifiers == (ControlMask)) - mod = 902; - else if (aa->modifiers == (Mod1Mask)) - mod = 903; - else if (aa->modifiers == (Mod2Mask)) - mod = 904; - else if (aa->modifiers == (Mod3Mask)) - mod = 905; - else if (aa->modifiers == (Mod4Mask)) - mod = 906; - else if (aa->modifiers == (Mod5Mask)) - mod = 907; - else if (aa->modifiers == (ShiftMask)) - mod = 900; - else if (aa->modifiers == (ControlMask | Mod1Mask)) - mod = 910; - else if (aa->modifiers == (ShiftMask | ControlMask)) - mod = 911; - else if (aa->modifiers == (ShiftMask | Mod1Mask)) - mod = 912; - else if (aa->modifiers == - (ShiftMask | ControlMask | Mod1Mask)) - mod = 913; - else if (aa->modifiers == (ControlMask | Mod4Mask)) - mod = 914; - else if (aa->modifiers == (ShiftMask | Mod4Mask)) - mod = 915; - else if (aa->modifiers == - (ControlMask | ShiftMask | Mod4Mask)) - mod = 916; - else if (aa->modifiers == (ControlMask | Mod5Mask)) - mod = 917; - else if (aa->modifiers == (ShiftMask | Mod5Mask)) - mod = 918; - else if (aa->modifiers == - (ControlMask | ShiftMask | Mod5Mask)) - mod = 919; - else if (aa->modifiers == (Mod2Mask | ShiftMask)) - mod = 920; - else if (aa->modifiers == (Mod2Mask | ControlMask)) - mod = 921; - else if (aa->modifiers == (Mod2Mask | Mod1Mask)) - mod = 922; - fprintf(autosavefile, "101 %i\n", mod); - /* action */ - if (aa->action->params) - fprintf(autosavefile, "104 %i %s\n", - aa->action->Type, (char *)aa->action->params); - else - fprintf(autosavefile, "104 %i\n", aa->action->Type); - } - } - fprintf(autosavefile, "1000\n"); - } - } - + ModuleConfigSave("aclass", autosavefile); ModuleConfigSave("btn", autosavefile); ModuleConfigSave("ibox", autosavefile); ModuleConfigSave("bg", autosavefile); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewins.c,v retrieving revision 1.1.2.14 retrieving revision 1.1.2.15 diff -u -3 -r1.1.2.14 -r1.1.2.15 --- ewins.c 18 Sep 2004 13:32:26 -0000 1.1.2.14 +++ ewins.c 19 Sep 2004 08:02:15 -0000 1.1.2.15 @@ -1842,7 +1842,7 @@ } } -void +static void EwinsInit(void) { ecore_x_grab(); @@ -1851,3 +1851,48 @@ EventCallbackRegister(VRoot.win, 0, EwinHandleEventsRoot, NULL); } + +/* + * Ewins module + * This is the WM. + */ + +static void +EwinsSighan(int sig, void *prm __UNUSED__) +{ + switch (sig) + { + case ESIGNAL_INIT: + EwinsInit(); + break; + case ESIGNAL_CONFIGURE: + if (!Conf.mapslide || Mode.wm.restart) + MapUnmap(1); + break; + case ESIGNAL_START: + if (Conf.mapslide && !Mode.wm.restart) + MapUnmap(1); + break; + } +} + +#if 0 +IpcItem EwinsIpcArray[] = { +}; +#define N_IPC_FUNCS (sizeof(EwinsIpcArray)/sizeof(IpcItem)) +#else +#define N_IPC_FUNCS 0 +#define EwinsIpcArray NULL +#endif + +/* + * Module descriptor + */ +EModule ModEwins = { + "ewins", NULL, + EwinsSighan, + NULL, NULL, + {N_IPC_FUNCS, EwinsIpcArray} + , + {0, NULL} +}; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v retrieving revision 1.174.2.23 retrieving revision 1.174.2.24 diff -u -3 -r1.174.2.23 -r1.174.2.24 --- ipc.c 18 Sep 2004 13:32:27 -0000 1.174.2.23 +++ ipc.c 19 Sep 2004 08:02:15 -0000 1.174.2.24 @@ -458,72 +458,6 @@ } static void -IPC_ActionClass(const char *params, Client * c) -{ - char buf[FILEPATH_LEN_MAX]; - - buf[0] = 0; - - if (params) - { - char param1[FILEPATH_LEN_MAX]; - char param2[FILEPATH_LEN_MAX]; - char param3[FILEPATH_LEN_MAX]; - - param1[0] = 0; - param2[0] = 0; - param3[0] = 0; - - word(params, 1, param1); - word(params, 2, param2); - if (param2[0]) - { - if (!strcmp(param1, "create")) - { - } - else if (!strcmp(param2, "delete")) - { - ActionClass *a; - - a = (ActionClass *) FindItem(param1, 0, LIST_FINDBY_NAME, - LIST_TYPE_ACLASS); - if (a) - RemoveActionClass(a); - } - else if (!strcmp(param2, "modify")) - { - } - else if (!strcmp(param2, "ref_count")) - { - ActionClass *a; - - a = (ActionClass *) FindItem(param1, 0, LIST_FINDBY_NAME, - LIST_TYPE_ACLASS); - if (a) - Esnprintf(buf, sizeof(buf), "%u references remain.", - a->ref_count); - } - else - { - Esnprintf(buf, sizeof(buf), - "Error: unknown operation specified"); - } - } - else - { - Esnprintf(buf, sizeof(buf), "Error: no class specified"); - } - } - else - { - Esnprintf(buf, sizeof(buf), "Error: no operation specified"); - } - - if (buf[0]) - CommsSend(c, buf); -} - -static void IPC_ListClassMembers(const char *params, Client * c) { char *buf = NULL; @@ -532,31 +466,6 @@ if (params) { -#if 0 - if (!strcmp(params, "backgrounds")) - { - - Background **lst; - - lst = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND); - for (i = 0; i < num; i++) - { - buf2[0] = 0; - Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name); - if (buf) - buf = realloc(buf, strlen(buf) + strlen(buf2) + 1); - else - { - buf = malloc(strlen(buf2) + 1); - buf[0] = 0; - } - strcat(buf, buf2); - } - if (lst) - Efree(lst); - } - else -#endif if (!strcmp(params, "actions")) { ActionClass **lst; @@ -2238,197 +2147,6 @@ } static void -IPC_KeybindingsGet(const char *params __UNUSED__, Client * c) -{ - ActionClass *ac; - Action *a; - int i, mod; - char *buf = NULL, buf2[FILEPATH_LEN_MAX]; - - ac = (ActionClass *) FindItem("KEYBINDINGS", 0, LIST_FINDBY_NAME, - LIST_TYPE_ACLASS_GLOBAL); - if (ac) - { - for (i = 0; i < ac->num; i++) - { - a = ac->list[i]; - if ((a) && (a->action) && (a->event == EVENT_KEY_DOWN)) - { - char *key; - - key = XKeysymToString(XKeycodeToKeysym(disp, a->key, 0)); - if (key) - { - mod = 0; - if (a->modifiers == (ControlMask)) - mod = 1; - else if (a->modifiers == (Mod1Mask)) - mod = 2; - else if (a->modifiers == (ShiftMask)) - mod = 3; - else if (a->modifiers == (ControlMask | Mod1Mask)) - mod = 4; - else if (a->modifiers == (ShiftMask | ControlMask)) - mod = 5; - else if (a->modifiers == (ShiftMask | Mod1Mask)) - mod = 6; - else if (a->modifiers == - (ShiftMask | ControlMask | Mod1Mask)) - mod = 7; - else if (a->modifiers == (Mod2Mask)) - mod = 8; - else if (a->modifiers == (Mod3Mask)) - mod = 9; - else if (a->modifiers == (Mod4Mask)) - mod = 10; - else if (a->modifiers == (Mod5Mask)) - mod = 11; - else if (a->modifiers == (Mod2Mask | ShiftMask)) - mod = 12; - else if (a->modifiers == (Mod2Mask | ControlMask)) - mod = 13; - else if (a->modifiers == (Mod2Mask | Mod1Mask)) - mod = 14; - else if (a->modifiers == (Mod4Mask | ShiftMask)) - mod = 15; - else if (a->modifiers == (Mod4Mask | ControlMask)) - mod = 16; - else if (a->modifiers == - (Mod4Mask | ControlMask | ShiftMask)) - mod = 17; - else if (a->modifiers == (Mod5Mask | ShiftMask)) - mod = 18; - else if (a->modifiers == (Mod5Mask | ControlMask)) - mod = 19; - else if (a->modifiers == - (Mod5Mask | ControlMask | ShiftMask)) - mod = 20; - if (a->action->params) - Esnprintf(buf2, sizeof(buf2), "%s %i %i %s\n", - key, mod, a->action->Type, - (char *)a->action->params); - else - Esnprintf(buf2, sizeof(buf2), "%s %i %i\n", key, - mod, a->action->Type); - if (buf) - { - buf = Erealloc(buf, strlen(buf) + strlen(buf2) + 1); - strcat(buf, buf2); - } - else - buf = Estrdup(buf2); - } - } - } - } - - if (buf) - { - CommsSend(c, buf); - Efree(buf); - } - else - CommsSend(c, "\n"); -} - -static void -IPC_KeybindingsSet(const char *params, Client * c __UNUSED__) -{ - ActionClass *ac; - Action *a; - int i, l; - char buf[FILEPATH_LEN_MAX]; - const char *sp, *ss; - - Mode.keybinds_changed = 1; - - ac = (ActionClass *) RemoveItem("KEYBINDINGS", 0, LIST_FINDBY_NAME, - LIST_TYPE_ACLASS_GLOBAL); - if (ac) - RemoveActionClass(ac); - - ac = CreateAclass("KEYBINDINGS"); - AddItem(ac, ac->name, 0, LIST_TYPE_ACLASS_GLOBAL); - - ss = atword(params, 1); - if (ss) - { - i = 0; - l = strlen(ss); - while (i < l) - { - char key[256]; - int mod = 0; - int act_id = 0; - int j = 0; - - /* put line in buf */ - sp = &(ss[i]); - while ((sp[j]) && (sp[j] != '\n')) - { - buf[j] = sp[j]; - j++; - } - buf[j] = 0; - if (sp[j] == '\n') - j++; - i += j; - /* parse the line */ - sscanf(buf, "%250s %i %i", key, &mod, &act_id); - if (mod == 0) - mod = 0; - else if (mod == 1) - mod = ControlMask; - else if (mod == 2) - mod = Mod1Mask; - else if (mod == 3) - mod = ShiftMask; - else if (mod == 4) - mod = ControlMask | Mod1Mask; - else if (mod == 5) - mod = ShiftMask | ControlMask; - else if (mod == 6) - mod = ShiftMask | Mod1Mask; - else if (mod == 7) - mod = ShiftMask | ControlMask | Mod1Mask; - else if (mod == 8) - mod = Mod2Mask; - else if (mod == 9) - mod = Mod3Mask; - else if (mod == 10) - mod = Mod4Mask; - else if (mod == 11) - mod = Mod5Mask; - else if (mod == 12) - mod = Mod2Mask | ShiftMask; - else if (mod == 13) - mod = Mod2Mask | ControlMask; - else if (mod == 14) - mod = Mod2Mask | Mod1Mask; - else if (mod == 15) - mod = Mod4Mask | ShiftMask; - else if (mod == 16) - mod = Mod4Mask | ControlMask; - else if (mod == 17) - mod = Mod4Mask | ControlMask | ShiftMask; - else if (mod == 18) - mod = Mod5Mask | ShiftMask; - else if (mod == 19) - mod = Mod5Mask | ControlMask; - else if (mod == 20) - mod = Mod5Mask | ControlMask | ShiftMask; - a = CreateAction(4, 0, mod, 0, 0, 0, key, NULL); - GrabActionKey(a); - AddAction(ac, a); - if (atword(buf, 4)) - AddToAction(a, act_id, Estrdup(atword(buf, 4))); - else - AddToAction(a, act_id, NULL); - } - } -} - -static void IPC_ColormodifierDelete(const char *params, Client * c __UNUSED__) { char param1[FILEPATH_LEN_MAX], buf[FILEPATH_LEN_MAX]; @@ -3074,11 +2792,6 @@ "available classes are:\n" "sounds\n" "actions\n" "backgrounds\n" "borders\n" "text\n" "images\n" "cursors\n" "buttons"}, { - IPC_ActionClass, - "actionclass", NULL, - "Create/Delete/Modify an ActionClass", - "This doesn't do anything yet."}, - { IPC_ColorModifierClass, "colormod", NULL, "Create/Delete/Modify a ColorModifierClass", @@ -3177,10 +2890,6 @@ { IPC_Reply, "reply", NULL, "TBD", NULL}, { - IPC_KeybindingsGet, "get_keybindings", NULL, "TBD", NULL}, - { - IPC_KeybindingsSet, "set_keybindings", NULL, "TBD", NULL}, - { IPC_ColormodifierDelete, "del_colmod", NULL, "TBD", NULL}, { IPC_ColormodifierGet, "get_colmod", NULL, "TBD", NULL}, =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v retrieving revision 1.99.2.23 retrieving revision 1.99.2.24 diff -u -3 -r1.99.2.23 -r1.99.2.24 --- main.c 18 Sep 2004 13:32:27 -0000 1.99.2.23 +++ main.c 19 Sep 2004 08:02:16 -0000 1.99.2.24 @@ -224,29 +224,25 @@ Esetenv("ECACHEDIR", EDirUserCache(), 1); /* Move elsewhere... */ - LoadSnapInfo(); + HintsInit(); CommsInit(); - EwinsInit(); + SessionInit(); + LoadSnapInfo(); ModulesSignal(ESIGNAL_INIT, NULL); /* Load the theme */ ThemeConfigLoad(); - /* Make all of our fallback classes */ - SetupFallbackClasses(); - /* Do initial configuration */ ModulesSignal(ESIGNAL_CONFIGURE, NULL); - HintsInit(); - SessionInit(); - CheckEvent(); + /* Set root window cursor */ + ECsrApply(ECSR_ROOT, VRoot.win); - if (Conf.mapslide && !Mode.wm.restart) - CreateStartupDisplay(0); + CheckEvent(); - MapUnmap(1); + CreateStartupDisplay(0); #ifdef USE_EXT_INIT_WIN /* Kill the E process owning the "init window" */ @@ -263,52 +259,12 @@ ecore_x_sync(); Mode.queue_up = DRAW_QUEUE_ENABLE; - /* Set root window cursor */ - ECsrApply(ECSR_ROOT, VRoot.win); - -#if 0 - Mode.wm.save_ok = Mode.wm.master; -#else Mode.wm.save_ok = 1; -#endif /* let's make sure we set this up and go to our desk anyways */ GotoDesktop(desks.current); -#if 0 /* Why? */ - if (desks.current < (Conf.desks.num - 1)) - { - char ps = 0; - - if (!Conf.mapslide) - { - ps = Conf.desks.slidein; - Conf.desks.slidein = 0; - } - GotoDesktop(desks.current + 1); - GotoDesktop(desks.current - 1); - if (!Conf.mapslide) - Conf.desks.slidein = ps; - } - else if (desks.current > 0) - { - char ps = 0; - - if (!Conf.mapslide) - { - ps = Conf.desks.slidein; - Conf.desks.slidein = 0; - } - GotoDesktop(desks.current - 1); - GotoDesktop(desks.current + 1); - if (!Conf.mapslide) - Conf.desks.slidein = ps; - } -#endif ecore_x_sync(); - if (!Conf.mapslide && !Mode.wm.restart) - CreateStartupDisplay(0); - #ifdef SIGCONT for (i = 0; i < Mode.wm.child_count; i++) kill(Mode.wm.children[i], SIGCONT); @@ -316,13 +272,9 @@ SpawnSnappedCmds(); - Mode.wm.startup = 0; - ModulesSignal(ESIGNAL_START, NULL); - /* Save current settings to disk */ - if (VRoot.scr == 0) - autosave(); + Mode.wm.startup = 0; /* The primary event loop */ for (;;) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Attic/mod-misc.c,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -u -3 -r1.1.2.15 -r1.1.2.16 --- mod-misc.c 18 Sep 2004 13:32:28 -0000 1.1.2.15 +++ mod-misc.c 19 Sep 2004 08:02:17 -0000 1.1.2.16 @@ -27,11 +27,13 @@ **********************************************************************/ /* Use static module list for now */ +extern EModule ModAclass; extern EModule ModBackgrounds; extern EModule ModButtons; extern EModule ModCursors; extern EModule ModDesktops; extern EModule ModEffects; +extern EModule ModEwins; extern EModule ModGroups; extern EModule ModImageclass; extern EModule ModIconboxes; @@ -47,10 +49,12 @@ extern EModule ModWarplist; const EModule *p_modules[] = { + &ModAclass, &ModBackgrounds, &ModButtons, &ModCursors, &ModDesktops, + &ModEwins, &ModEffects, &ModGroups, &ModIconboxes, =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/sound.c,v retrieving revision 1.25.2.5 retrieving revision 1.25.2.6 diff -u -3 -r1.25.2.5 -r1.25.2.6 --- sound.c 18 Sep 2004 13:32:29 -0000 1.25.2.5 +++ sound.c 19 Sep 2004 08:02:17 -0000 1.25.2.6 @@ -259,14 +259,16 @@ return sclass->name; } -int +void SoundPlay(const char *name) { SoundClass *sclass; + if (!Conf_sound.enable) + return; + sclass = FindItem(name, 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS); SclassApply(sclass); - return sclass != NULL; } static int @@ -389,8 +391,8 @@ sc = SclassCreate(s1, s2); } } - ConfigAlertLoad(_("Sound")); - err = -1; + if (err) + ConfigAlertLoad(_("Sound")); done: return err; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/theme.c,v retrieving revision 1.37.2.6 retrieving revision 1.37.2.7 diff -u -3 -r1.37.2.6 -r1.37.2.7 --- theme.c 18 Sep 2004 13:32:29 -0000 1.37.2.6 +++ theme.c 19 Sep 2004 08:02:17 -0000 1.37.2.7 @@ -428,7 +428,6 @@ switch (sig) { case ESIGNAL_CONFIGURE: - ThemeCleanup(); break; case ESIGNAL_EXIT: ThemeCleanup(); ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs