enlightenment/src/util.c

103 lines
1.7 KiB
C
Raw Normal View History

Alright, I spent some time now reading e17's code. Here's what I've changed, this is big, so read this carefully :) * I've added debugging macros for messages and function call tracing. Usage: D("Creating item %i %i %i\n", x, y, z); Define DEBUG to use the D macro. D_ENTER; D_RETURN; D_RETURN_(x); These are for call tracing. Use D_RETURN_(x) when returning something from a function. Define DEBUG_NEST to use this. * added iconbar header file to Makefile.am * added proper new()/cleanup() calls for E_Delayed_Action; * I've completely rewritten the object and observer handling. Bye bye macros, this was nasty. It'll be hard enough to avoid leaks with usecounting in C. We now basically have the same system as gtk. There's a clear separation of observer and object code now. An E_Object by itself has nothing to do with observing or being observed, therefore, there are now E_Observers and E_Observees that are derived from E_Object. IMPORTANT: The cleanup system now reflects the reference count system, therefore, all ..._free() calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling now is as follows: - The cleanup functions clean up everything that is contained in a struct, but NOT the struct itself. Instead of the final free() call, they call the destructor of the base class. The calls will walk up the hierarchy and clean up what's contained in every struct, and the final e_object_cleanup() will free the structure itself. E_Delayed_Action is a good example. - The only calls that influence the reference count are e_object_ref() and e_object_unref(). If you need to do things before an object gets destroyed, you can query the use count using e_object_get_usecount() and check if it's equal to 1. So this: OBJ_UNREF(b); OBJ_IF_FREE(b) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); OBJ_FREE(b); } now is this: if (e_object_get_usecount(E_OBJECT(b)) == 1) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); } e_object_unref(E_OBJECT(b)); object.h and observer.h are completely commented, it shouldn't be too hard to understand. This'll need to be documented in the manual anyway. * E_Objects are now used in lots of places where void* were used as pointers to objects before, especially in the actions code. This is obviously better, as it will generate compiler warnings when people want to pass things to functions that expect E_Objects. This could probably be more restrictive. * Added typedefs for the function prototypes in E_Action_Impl. Those fat signatures were just painful to read in the function declarations/implementations. * I've also tried to give parameters more useful names. Calling an object "o" is a lot of fun when you want to grep for it. * Included is also Graham's latest menu.c patch. Sorry for the delay, Graham. * I've added checks to the menu code that make sure that menus don't pop up when they're empty (which resulted in a little useless rectangle). I guess that's it for now. Sorry if I broke anything, but this was necessary imho. SVN revision: 5605
2001-11-02 09:07:52 -08:00
#include "debug.h"
#include "util.h"
2000-12-08 14:54:42 -08:00
Sorry guys.. I had to revert a bunch of changes.. that's life.. but READ the following (it's in the README now) ------------------------------------------------------------------------------- Enlightenment 0.17.0 CVS Code.... ------------------------------------------------------------------------------- The Rasterman - raster@valinux.com, raster@rasterman.com ******************************************************************************* **************** READ THIS! It is of the UTMOST IMPORTANCE! ******************* ******************************************************************************* This is the source code for Enlightenment 0.17 - If you got this you got it from Enlightenment's CVS repository - or from someone who took it out of the CVS repository. The CVS repository is full of code *IN DEVELOPMENT* - that often means it's in the middle of being worked on and may install strange things in strange places, make a mess, and may not even be compatible with a final release. If you at all use this code, you are HEAVILY URGED, when it is finally released, to remove all traces of anything this CVS code base has installed on your system (it is COMPLETELY up to you to keep track of that - do NOT expect any help), and then install the full release on a cleaned system. Don't come asking "can I just keep using CVS" oonce things are released - thqat is the reason I pu this paragraph here - so you don't ask. The asnwer is the same as above - if there is a proper final release use that. CVS is really only for those havily hacking on the code. Now we have that warning over and done with. How to build and install from CVS? $ ./autogen.sh && make $ su Password: <- as root -> # make install You should be able to use the binary of enlightenment as a window manager. you might be advised for cleanliness to do $ ./autogen.sh --prefix=/usr/local/e-17 so it installs relative to the /usr/local/e-17 directory and keeps all the e-17 development code and data in that tree so it is easily removed when the time codes. NOTES: Read these carefully! Enlightenment does not check for previously running Window Managers right now - so you need to make sure no other WM is running - E will not do that for you. Enlightenment has no menus or keybindings or any way of launching applications right now - you'll have to figure out an alternative way of doing it. Enlightenment only handles a small subset of ICCCM and thus will have bugs - some applications will not behave correctly and may apear in odd spots or not resize or place themselves properly etc. Expect this - it's code being worked on. Just be happy it does as much as it already does. Enlightenment RELIES on lots of libraires that have been written. Ecore, Ebits, Evas, Edb, Imlib2 just to mention a few. Especially Ebits, Ecore and Evas change in CVS often - you will need the absolute latest of these if you wish Enlightenment 0.17 code to run properly or compile. If you update Enlightenment from CVS update these too to get any changes they have in their trees. If you plan on working on the code... STOP! don't rush in and work on it - even if you have CVS commit access - EXPECT me (Raster) to revert any changes you make if you do this - regardless of the changes and how much work you put into them. First read the code well and LEARN it. If you have questions about some of the more obscure hidden program flow - ASK - but don't go tampering with it - Enlightenment 0.17's code is much more complex and intricate than E 0.16 - but at the same time it's much cleaner and more object oriented. Learn it well first. Some parts of E 0.17 are "hacked" with hard-coded stuff, just so, for now, it works. They will be virtualized and imporved over time. If you have plans - tell me about them first - discuss them before you go impliment them. I know I already have a lot of the components of E 0.17's code planned in my head - but I won't get to them for a while - and if people go impliment or hack bad stuff in, it means I have to spend lots of time fixing something that is bad in the first place, or we end up doing duplicate work. There *IS* a plan - believe it or not - but to be honest - it's more complex and large than I can just write down in a README, so talk about your ideas first. I'm going to be ruthless in keeping the code neat, clean and free of nasty hacks (except ones I put in as temporary stop-gap measures to make the thing work - since I know where those are and what I need to do to do it right). If you can't find me or I don't reply to your e-mail - don't get impatient - just wait. I currently have no network access at home, so I'm doing a chunk of code offline. I'll get to your mail and queries as time allows. If you have problems with the code or bugs to report, kindly forward them to /dev/null (the code is in now way or form ready for bug reports - I don't want crap filling my mailbox). I hope that clears things up for now. SVN revision: 3976
2000-12-11 12:08:38 -08:00
void
e_util_set_env(char *variable, char *content)
Sorry guys.. I had to revert a bunch of changes.. that's life.. but READ the following (it's in the README now) ------------------------------------------------------------------------------- Enlightenment 0.17.0 CVS Code.... ------------------------------------------------------------------------------- The Rasterman - raster@valinux.com, raster@rasterman.com ******************************************************************************* **************** READ THIS! It is of the UTMOST IMPORTANCE! ******************* ******************************************************************************* This is the source code for Enlightenment 0.17 - If you got this you got it from Enlightenment's CVS repository - or from someone who took it out of the CVS repository. The CVS repository is full of code *IN DEVELOPMENT* - that often means it's in the middle of being worked on and may install strange things in strange places, make a mess, and may not even be compatible with a final release. If you at all use this code, you are HEAVILY URGED, when it is finally released, to remove all traces of anything this CVS code base has installed on your system (it is COMPLETELY up to you to keep track of that - do NOT expect any help), and then install the full release on a cleaned system. Don't come asking "can I just keep using CVS" oonce things are released - thqat is the reason I pu this paragraph here - so you don't ask. The asnwer is the same as above - if there is a proper final release use that. CVS is really only for those havily hacking on the code. Now we have that warning over and done with. How to build and install from CVS? $ ./autogen.sh && make $ su Password: <- as root -> # make install You should be able to use the binary of enlightenment as a window manager. you might be advised for cleanliness to do $ ./autogen.sh --prefix=/usr/local/e-17 so it installs relative to the /usr/local/e-17 directory and keeps all the e-17 development code and data in that tree so it is easily removed when the time codes. NOTES: Read these carefully! Enlightenment does not check for previously running Window Managers right now - so you need to make sure no other WM is running - E will not do that for you. Enlightenment has no menus or keybindings or any way of launching applications right now - you'll have to figure out an alternative way of doing it. Enlightenment only handles a small subset of ICCCM and thus will have bugs - some applications will not behave correctly and may apear in odd spots or not resize or place themselves properly etc. Expect this - it's code being worked on. Just be happy it does as much as it already does. Enlightenment RELIES on lots of libraires that have been written. Ecore, Ebits, Evas, Edb, Imlib2 just to mention a few. Especially Ebits, Ecore and Evas change in CVS often - you will need the absolute latest of these if you wish Enlightenment 0.17 code to run properly or compile. If you update Enlightenment from CVS update these too to get any changes they have in their trees. If you plan on working on the code... STOP! don't rush in and work on it - even if you have CVS commit access - EXPECT me (Raster) to revert any changes you make if you do this - regardless of the changes and how much work you put into them. First read the code well and LEARN it. If you have questions about some of the more obscure hidden program flow - ASK - but don't go tampering with it - Enlightenment 0.17's code is much more complex and intricate than E 0.16 - but at the same time it's much cleaner and more object oriented. Learn it well first. Some parts of E 0.17 are "hacked" with hard-coded stuff, just so, for now, it works. They will be virtualized and imporved over time. If you have plans - tell me about them first - discuss them before you go impliment them. I know I already have a lot of the components of E 0.17's code planned in my head - but I won't get to them for a while - and if people go impliment or hack bad stuff in, it means I have to spend lots of time fixing something that is bad in the first place, or we end up doing duplicate work. There *IS* a plan - believe it or not - but to be honest - it's more complex and large than I can just write down in a README, so talk about your ideas first. I'm going to be ruthless in keeping the code neat, clean and free of nasty hacks (except ones I put in as temporary stop-gap measures to make the thing work - since I know where those are and what I need to do to do it right). If you can't find me or I don't reply to your e-mail - don't get impatient - just wait. I currently have no network access at home, so I'm doing a chunk of code offline. I'll get to your mail and queries as time allows. If you have problems with the code or bugs to report, kindly forward them to /dev/null (the code is in now way or form ready for bug reports - I don't want crap filling my mailbox). I hope that clears things up for now. SVN revision: 3976
2000-12-11 12:08:38 -08:00
{
char env[PATH_MAX];
Sorry guys.. I had to revert a bunch of changes.. that's life.. but READ the following (it's in the README now) ------------------------------------------------------------------------------- Enlightenment 0.17.0 CVS Code.... ------------------------------------------------------------------------------- The Rasterman - raster@valinux.com, raster@rasterman.com ******************************************************************************* **************** READ THIS! It is of the UTMOST IMPORTANCE! ******************* ******************************************************************************* This is the source code for Enlightenment 0.17 - If you got this you got it from Enlightenment's CVS repository - or from someone who took it out of the CVS repository. The CVS repository is full of code *IN DEVELOPMENT* - that often means it's in the middle of being worked on and may install strange things in strange places, make a mess, and may not even be compatible with a final release. If you at all use this code, you are HEAVILY URGED, when it is finally released, to remove all traces of anything this CVS code base has installed on your system (it is COMPLETELY up to you to keep track of that - do NOT expect any help), and then install the full release on a cleaned system. Don't come asking "can I just keep using CVS" oonce things are released - thqat is the reason I pu this paragraph here - so you don't ask. The asnwer is the same as above - if there is a proper final release use that. CVS is really only for those havily hacking on the code. Now we have that warning over and done with. How to build and install from CVS? $ ./autogen.sh && make $ su Password: <- as root -> # make install You should be able to use the binary of enlightenment as a window manager. you might be advised for cleanliness to do $ ./autogen.sh --prefix=/usr/local/e-17 so it installs relative to the /usr/local/e-17 directory and keeps all the e-17 development code and data in that tree so it is easily removed when the time codes. NOTES: Read these carefully! Enlightenment does not check for previously running Window Managers right now - so you need to make sure no other WM is running - E will not do that for you. Enlightenment has no menus or keybindings or any way of launching applications right now - you'll have to figure out an alternative way of doing it. Enlightenment only handles a small subset of ICCCM and thus will have bugs - some applications will not behave correctly and may apear in odd spots or not resize or place themselves properly etc. Expect this - it's code being worked on. Just be happy it does as much as it already does. Enlightenment RELIES on lots of libraires that have been written. Ecore, Ebits, Evas, Edb, Imlib2 just to mention a few. Especially Ebits, Ecore and Evas change in CVS often - you will need the absolute latest of these if you wish Enlightenment 0.17 code to run properly or compile. If you update Enlightenment from CVS update these too to get any changes they have in their trees. If you plan on working on the code... STOP! don't rush in and work on it - even if you have CVS commit access - EXPECT me (Raster) to revert any changes you make if you do this - regardless of the changes and how much work you put into them. First read the code well and LEARN it. If you have questions about some of the more obscure hidden program flow - ASK - but don't go tampering with it - Enlightenment 0.17's code is much more complex and intricate than E 0.16 - but at the same time it's much cleaner and more object oriented. Learn it well first. Some parts of E 0.17 are "hacked" with hard-coded stuff, just so, for now, it works. They will be virtualized and imporved over time. If you have plans - tell me about them first - discuss them before you go impliment them. I know I already have a lot of the components of E 0.17's code planned in my head - but I won't get to them for a while - and if people go impliment or hack bad stuff in, it means I have to spend lots of time fixing something that is bad in the first place, or we end up doing duplicate work. There *IS* a plan - believe it or not - but to be honest - it's more complex and large than I can just write down in a README, so talk about your ideas first. I'm going to be ruthless in keeping the code neat, clean and free of nasty hacks (except ones I put in as temporary stop-gap measures to make the thing work - since I know where those are and what I need to do to do it right). If you can't find me or I don't reply to your e-mail - don't get impatient - just wait. I currently have no network access at home, so I'm doing a chunk of code offline. I'll get to your mail and queries as time allows. If you have problems with the code or bugs to report, kindly forward them to /dev/null (the code is in now way or form ready for bug reports - I don't want crap filling my mailbox). I hope that clears things up for now. SVN revision: 3976
2000-12-11 12:08:38 -08:00
Alright, I spent some time now reading e17's code. Here's what I've changed, this is big, so read this carefully :) * I've added debugging macros for messages and function call tracing. Usage: D("Creating item %i %i %i\n", x, y, z); Define DEBUG to use the D macro. D_ENTER; D_RETURN; D_RETURN_(x); These are for call tracing. Use D_RETURN_(x) when returning something from a function. Define DEBUG_NEST to use this. * added iconbar header file to Makefile.am * added proper new()/cleanup() calls for E_Delayed_Action; * I've completely rewritten the object and observer handling. Bye bye macros, this was nasty. It'll be hard enough to avoid leaks with usecounting in C. We now basically have the same system as gtk. There's a clear separation of observer and object code now. An E_Object by itself has nothing to do with observing or being observed, therefore, there are now E_Observers and E_Observees that are derived from E_Object. IMPORTANT: The cleanup system now reflects the reference count system, therefore, all ..._free() calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling now is as follows: - The cleanup functions clean up everything that is contained in a struct, but NOT the struct itself. Instead of the final free() call, they call the destructor of the base class. The calls will walk up the hierarchy and clean up what's contained in every struct, and the final e_object_cleanup() will free the structure itself. E_Delayed_Action is a good example. - The only calls that influence the reference count are e_object_ref() and e_object_unref(). If you need to do things before an object gets destroyed, you can query the use count using e_object_get_usecount() and check if it's equal to 1. So this: OBJ_UNREF(b); OBJ_IF_FREE(b) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); OBJ_FREE(b); } now is this: if (e_object_get_usecount(E_OBJECT(b)) == 1) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); } e_object_unref(E_OBJECT(b)); object.h and observer.h are completely commented, it shouldn't be too hard to understand. This'll need to be documented in the manual anyway. * E_Objects are now used in lots of places where void* were used as pointers to objects before, especially in the actions code. This is obviously better, as it will generate compiler warnings when people want to pass things to functions that expect E_Objects. This could probably be more restrictive. * Added typedefs for the function prototypes in E_Action_Impl. Those fat signatures were just painful to read in the function declarations/implementations. * I've also tried to give parameters more useful names. Calling an object "o" is a lot of fun when you want to grep for it. * Included is also Graham's latest menu.c patch. Sorry for the delay, Graham. * I've added checks to the menu code that make sure that menus don't pop up when they're empty (which resulted in a little useless rectangle). I guess that's it for now. Sorry if I broke anything, but this was necessary imho. SVN revision: 5605
2001-11-02 09:07:52 -08:00
D_ENTER;
Sorry guys.. I had to revert a bunch of changes.. that's life.. but READ the following (it's in the README now) ------------------------------------------------------------------------------- Enlightenment 0.17.0 CVS Code.... ------------------------------------------------------------------------------- The Rasterman - raster@valinux.com, raster@rasterman.com ******************************************************************************* **************** READ THIS! It is of the UTMOST IMPORTANCE! ******************* ******************************************************************************* This is the source code for Enlightenment 0.17 - If you got this you got it from Enlightenment's CVS repository - or from someone who took it out of the CVS repository. The CVS repository is full of code *IN DEVELOPMENT* - that often means it's in the middle of being worked on and may install strange things in strange places, make a mess, and may not even be compatible with a final release. If you at all use this code, you are HEAVILY URGED, when it is finally released, to remove all traces of anything this CVS code base has installed on your system (it is COMPLETELY up to you to keep track of that - do NOT expect any help), and then install the full release on a cleaned system. Don't come asking "can I just keep using CVS" oonce things are released - thqat is the reason I pu this paragraph here - so you don't ask. The asnwer is the same as above - if there is a proper final release use that. CVS is really only for those havily hacking on the code. Now we have that warning over and done with. How to build and install from CVS? $ ./autogen.sh && make $ su Password: <- as root -> # make install You should be able to use the binary of enlightenment as a window manager. you might be advised for cleanliness to do $ ./autogen.sh --prefix=/usr/local/e-17 so it installs relative to the /usr/local/e-17 directory and keeps all the e-17 development code and data in that tree so it is easily removed when the time codes. NOTES: Read these carefully! Enlightenment does not check for previously running Window Managers right now - so you need to make sure no other WM is running - E will not do that for you. Enlightenment has no menus or keybindings or any way of launching applications right now - you'll have to figure out an alternative way of doing it. Enlightenment only handles a small subset of ICCCM and thus will have bugs - some applications will not behave correctly and may apear in odd spots or not resize or place themselves properly etc. Expect this - it's code being worked on. Just be happy it does as much as it already does. Enlightenment RELIES on lots of libraires that have been written. Ecore, Ebits, Evas, Edb, Imlib2 just to mention a few. Especially Ebits, Ecore and Evas change in CVS often - you will need the absolute latest of these if you wish Enlightenment 0.17 code to run properly or compile. If you update Enlightenment from CVS update these too to get any changes they have in their trees. If you plan on working on the code... STOP! don't rush in and work on it - even if you have CVS commit access - EXPECT me (Raster) to revert any changes you make if you do this - regardless of the changes and how much work you put into them. First read the code well and LEARN it. If you have questions about some of the more obscure hidden program flow - ASK - but don't go tampering with it - Enlightenment 0.17's code is much more complex and intricate than E 0.16 - but at the same time it's much cleaner and more object oriented. Learn it well first. Some parts of E 0.17 are "hacked" with hard-coded stuff, just so, for now, it works. They will be virtualized and imporved over time. If you have plans - tell me about them first - discuss them before you go impliment them. I know I already have a lot of the components of E 0.17's code planned in my head - but I won't get to them for a while - and if people go impliment or hack bad stuff in, it means I have to spend lots of time fixing something that is bad in the first place, or we end up doing duplicate work. There *IS* a plan - believe it or not - but to be honest - it's more complex and large than I can just write down in a README, so talk about your ideas first. I'm going to be ruthless in keeping the code neat, clean and free of nasty hacks (except ones I put in as temporary stop-gap measures to make the thing work - since I know where those are and what I need to do to do it right). If you can't find me or I don't reply to your e-mail - don't get impatient - just wait. I currently have no network access at home, so I'm doing a chunk of code offline. I'll get to your mail and queries as time allows. If you have problems with the code or bugs to report, kindly forward them to /dev/null (the code is in now way or form ready for bug reports - I don't want crap filling my mailbox). I hope that clears things up for now. SVN revision: 3976
2000-12-11 12:08:38 -08:00
sprintf(env, "%s=%s", variable, content);
putenv(env);
Alright, I spent some time now reading e17's code. Here's what I've changed, this is big, so read this carefully :) * I've added debugging macros for messages and function call tracing. Usage: D("Creating item %i %i %i\n", x, y, z); Define DEBUG to use the D macro. D_ENTER; D_RETURN; D_RETURN_(x); These are for call tracing. Use D_RETURN_(x) when returning something from a function. Define DEBUG_NEST to use this. * added iconbar header file to Makefile.am * added proper new()/cleanup() calls for E_Delayed_Action; * I've completely rewritten the object and observer handling. Bye bye macros, this was nasty. It'll be hard enough to avoid leaks with usecounting in C. We now basically have the same system as gtk. There's a clear separation of observer and object code now. An E_Object by itself has nothing to do with observing or being observed, therefore, there are now E_Observers and E_Observees that are derived from E_Object. IMPORTANT: The cleanup system now reflects the reference count system, therefore, all ..._free() calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling now is as follows: - The cleanup functions clean up everything that is contained in a struct, but NOT the struct itself. Instead of the final free() call, they call the destructor of the base class. The calls will walk up the hierarchy and clean up what's contained in every struct, and the final e_object_cleanup() will free the structure itself. E_Delayed_Action is a good example. - The only calls that influence the reference count are e_object_ref() and e_object_unref(). If you need to do things before an object gets destroyed, you can query the use count using e_object_get_usecount() and check if it's equal to 1. So this: OBJ_UNREF(b); OBJ_IF_FREE(b) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); OBJ_FREE(b); } now is this: if (e_object_get_usecount(E_OBJECT(b)) == 1) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); } e_object_unref(E_OBJECT(b)); object.h and observer.h are completely commented, it shouldn't be too hard to understand. This'll need to be documented in the manual anyway. * E_Objects are now used in lots of places where void* were used as pointers to objects before, especially in the actions code. This is obviously better, as it will generate compiler warnings when people want to pass things to functions that expect E_Objects. This could probably be more restrictive. * Added typedefs for the function prototypes in E_Action_Impl. Those fat signatures were just painful to read in the function declarations/implementations. * I've also tried to give parameters more useful names. Calling an object "o" is a lot of fun when you want to grep for it. * Included is also Graham's latest menu.c patch. Sorry for the delay, Graham. * I've added checks to the menu code that make sure that menus don't pop up when they're empty (which resulted in a little useless rectangle). I guess that's it for now. Sorry if I broke anything, but this was necessary imho. SVN revision: 5605
2001-11-02 09:07:52 -08:00
D_RETURN;
Sorry guys.. I had to revert a bunch of changes.. that's life.. but READ the following (it's in the README now) ------------------------------------------------------------------------------- Enlightenment 0.17.0 CVS Code.... ------------------------------------------------------------------------------- The Rasterman - raster@valinux.com, raster@rasterman.com ******************************************************************************* **************** READ THIS! It is of the UTMOST IMPORTANCE! ******************* ******************************************************************************* This is the source code for Enlightenment 0.17 - If you got this you got it from Enlightenment's CVS repository - or from someone who took it out of the CVS repository. The CVS repository is full of code *IN DEVELOPMENT* - that often means it's in the middle of being worked on and may install strange things in strange places, make a mess, and may not even be compatible with a final release. If you at all use this code, you are HEAVILY URGED, when it is finally released, to remove all traces of anything this CVS code base has installed on your system (it is COMPLETELY up to you to keep track of that - do NOT expect any help), and then install the full release on a cleaned system. Don't come asking "can I just keep using CVS" oonce things are released - thqat is the reason I pu this paragraph here - so you don't ask. The asnwer is the same as above - if there is a proper final release use that. CVS is really only for those havily hacking on the code. Now we have that warning over and done with. How to build and install from CVS? $ ./autogen.sh && make $ su Password: <- as root -> # make install You should be able to use the binary of enlightenment as a window manager. you might be advised for cleanliness to do $ ./autogen.sh --prefix=/usr/local/e-17 so it installs relative to the /usr/local/e-17 directory and keeps all the e-17 development code and data in that tree so it is easily removed when the time codes. NOTES: Read these carefully! Enlightenment does not check for previously running Window Managers right now - so you need to make sure no other WM is running - E will not do that for you. Enlightenment has no menus or keybindings or any way of launching applications right now - you'll have to figure out an alternative way of doing it. Enlightenment only handles a small subset of ICCCM and thus will have bugs - some applications will not behave correctly and may apear in odd spots or not resize or place themselves properly etc. Expect this - it's code being worked on. Just be happy it does as much as it already does. Enlightenment RELIES on lots of libraires that have been written. Ecore, Ebits, Evas, Edb, Imlib2 just to mention a few. Especially Ebits, Ecore and Evas change in CVS often - you will need the absolute latest of these if you wish Enlightenment 0.17 code to run properly or compile. If you update Enlightenment from CVS update these too to get any changes they have in their trees. If you plan on working on the code... STOP! don't rush in and work on it - even if you have CVS commit access - EXPECT me (Raster) to revert any changes you make if you do this - regardless of the changes and how much work you put into them. First read the code well and LEARN it. If you have questions about some of the more obscure hidden program flow - ASK - but don't go tampering with it - Enlightenment 0.17's code is much more complex and intricate than E 0.16 - but at the same time it's much cleaner and more object oriented. Learn it well first. Some parts of E 0.17 are "hacked" with hard-coded stuff, just so, for now, it works. They will be virtualized and imporved over time. If you have plans - tell me about them first - discuss them before you go impliment them. I know I already have a lot of the components of E 0.17's code planned in my head - but I won't get to them for a while - and if people go impliment or hack bad stuff in, it means I have to spend lots of time fixing something that is bad in the first place, or we end up doing duplicate work. There *IS* a plan - believe it or not - but to be honest - it's more complex and large than I can just write down in a README, so talk about your ideas first. I'm going to be ruthless in keeping the code neat, clean and free of nasty hacks (except ones I put in as temporary stop-gap measures to make the thing work - since I know where those are and what I need to do to do it right). If you can't find me or I don't reply to your e-mail - don't get impatient - just wait. I currently have no network access at home, so I'm doing a chunk of code offline. I'll get to your mail and queries as time allows. If you have problems with the code or bugs to report, kindly forward them to /dev/null (the code is in now way or form ready for bug reports - I don't want crap filling my mailbox). I hope that clears things up for now. SVN revision: 3976
2000-12-11 12:08:38 -08:00
}
2000-12-14 11:36:33 -08:00
char *
e_util_get_user_home(void)
2000-12-14 11:36:33 -08:00
{
static char *home = NULL;
Alright, I spent some time now reading e17's code. Here's what I've changed, this is big, so read this carefully :) * I've added debugging macros for messages and function call tracing. Usage: D("Creating item %i %i %i\n", x, y, z); Define DEBUG to use the D macro. D_ENTER; D_RETURN; D_RETURN_(x); These are for call tracing. Use D_RETURN_(x) when returning something from a function. Define DEBUG_NEST to use this. * added iconbar header file to Makefile.am * added proper new()/cleanup() calls for E_Delayed_Action; * I've completely rewritten the object and observer handling. Bye bye macros, this was nasty. It'll be hard enough to avoid leaks with usecounting in C. We now basically have the same system as gtk. There's a clear separation of observer and object code now. An E_Object by itself has nothing to do with observing or being observed, therefore, there are now E_Observers and E_Observees that are derived from E_Object. IMPORTANT: The cleanup system now reflects the reference count system, therefore, all ..._free() calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling now is as follows: - The cleanup functions clean up everything that is contained in a struct, but NOT the struct itself. Instead of the final free() call, they call the destructor of the base class. The calls will walk up the hierarchy and clean up what's contained in every struct, and the final e_object_cleanup() will free the structure itself. E_Delayed_Action is a good example. - The only calls that influence the reference count are e_object_ref() and e_object_unref(). If you need to do things before an object gets destroyed, you can query the use count using e_object_get_usecount() and check if it's equal to 1. So this: OBJ_UNREF(b); OBJ_IF_FREE(b) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); OBJ_FREE(b); } now is this: if (e_object_get_usecount(E_OBJECT(b)) == 1) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); } e_object_unref(E_OBJECT(b)); object.h and observer.h are completely commented, it shouldn't be too hard to understand. This'll need to be documented in the manual anyway. * E_Objects are now used in lots of places where void* were used as pointers to objects before, especially in the actions code. This is obviously better, as it will generate compiler warnings when people want to pass things to functions that expect E_Objects. This could probably be more restrictive. * Added typedefs for the function prototypes in E_Action_Impl. Those fat signatures were just painful to read in the function declarations/implementations. * I've also tried to give parameters more useful names. Calling an object "o" is a lot of fun when you want to grep for it. * Included is also Graham's latest menu.c patch. Sorry for the delay, Graham. * I've added checks to the menu code that make sure that menus don't pop up when they're empty (which resulted in a little useless rectangle). I guess that's it for now. Sorry if I broke anything, but this was necessary imho. SVN revision: 5605
2001-11-02 09:07:52 -08:00
D_ENTER;
if (home) D_RETURN_(home);
2000-12-14 11:36:33 -08:00
home = getenv("HOME");
if (!home) home = getenv("TMPDIR");
if (!home) home = "/tmp";
Alright, I spent some time now reading e17's code. Here's what I've changed, this is big, so read this carefully :) * I've added debugging macros for messages and function call tracing. Usage: D("Creating item %i %i %i\n", x, y, z); Define DEBUG to use the D macro. D_ENTER; D_RETURN; D_RETURN_(x); These are for call tracing. Use D_RETURN_(x) when returning something from a function. Define DEBUG_NEST to use this. * added iconbar header file to Makefile.am * added proper new()/cleanup() calls for E_Delayed_Action; * I've completely rewritten the object and observer handling. Bye bye macros, this was nasty. It'll be hard enough to avoid leaks with usecounting in C. We now basically have the same system as gtk. There's a clear separation of observer and object code now. An E_Object by itself has nothing to do with observing or being observed, therefore, there are now E_Observers and E_Observees that are derived from E_Object. IMPORTANT: The cleanup system now reflects the reference count system, therefore, all ..._free() calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling now is as follows: - The cleanup functions clean up everything that is contained in a struct, but NOT the struct itself. Instead of the final free() call, they call the destructor of the base class. The calls will walk up the hierarchy and clean up what's contained in every struct, and the final e_object_cleanup() will free the structure itself. E_Delayed_Action is a good example. - The only calls that influence the reference count are e_object_ref() and e_object_unref(). If you need to do things before an object gets destroyed, you can query the use count using e_object_get_usecount() and check if it's equal to 1. So this: OBJ_UNREF(b); OBJ_IF_FREE(b) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); OBJ_FREE(b); } now is this: if (e_object_get_usecount(E_OBJECT(b)) == 1) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); } e_object_unref(E_OBJECT(b)); object.h and observer.h are completely commented, it shouldn't be too hard to understand. This'll need to be documented in the manual anyway. * E_Objects are now used in lots of places where void* were used as pointers to objects before, especially in the actions code. This is obviously better, as it will generate compiler warnings when people want to pass things to functions that expect E_Objects. This could probably be more restrictive. * Added typedefs for the function prototypes in E_Action_Impl. Those fat signatures were just painful to read in the function declarations/implementations. * I've also tried to give parameters more useful names. Calling an object "o" is a lot of fun when you want to grep for it. * Included is also Graham's latest menu.c patch. Sorry for the delay, Graham. * I've added checks to the menu code that make sure that menus don't pop up when they're empty (which resulted in a little useless rectangle). I guess that's it for now. Sorry if I broke anything, but this was necessary imho. SVN revision: 5605
2001-11-02 09:07:52 -08:00
D_RETURN_(home);
2000-12-14 11:36:33 -08:00
}
void *
e_util_memdup(void *data, int size)
{
void *data_dup;
Alright, I spent some time now reading e17's code. Here's what I've changed, this is big, so read this carefully :) * I've added debugging macros for messages and function call tracing. Usage: D("Creating item %i %i %i\n", x, y, z); Define DEBUG to use the D macro. D_ENTER; D_RETURN; D_RETURN_(x); These are for call tracing. Use D_RETURN_(x) when returning something from a function. Define DEBUG_NEST to use this. * added iconbar header file to Makefile.am * added proper new()/cleanup() calls for E_Delayed_Action; * I've completely rewritten the object and observer handling. Bye bye macros, this was nasty. It'll be hard enough to avoid leaks with usecounting in C. We now basically have the same system as gtk. There's a clear separation of observer and object code now. An E_Object by itself has nothing to do with observing or being observed, therefore, there are now E_Observers and E_Observees that are derived from E_Object. IMPORTANT: The cleanup system now reflects the reference count system, therefore, all ..._free() calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling now is as follows: - The cleanup functions clean up everything that is contained in a struct, but NOT the struct itself. Instead of the final free() call, they call the destructor of the base class. The calls will walk up the hierarchy and clean up what's contained in every struct, and the final e_object_cleanup() will free the structure itself. E_Delayed_Action is a good example. - The only calls that influence the reference count are e_object_ref() and e_object_unref(). If you need to do things before an object gets destroyed, you can query the use count using e_object_get_usecount() and check if it's equal to 1. So this: OBJ_UNREF(b); OBJ_IF_FREE(b) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); OBJ_FREE(b); } now is this: if (e_object_get_usecount(E_OBJECT(b)) == 1) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); } e_object_unref(E_OBJECT(b)); object.h and observer.h are completely commented, it shouldn't be too hard to understand. This'll need to be documented in the manual anyway. * E_Objects are now used in lots of places where void* were used as pointers to objects before, especially in the actions code. This is obviously better, as it will generate compiler warnings when people want to pass things to functions that expect E_Objects. This could probably be more restrictive. * Added typedefs for the function prototypes in E_Action_Impl. Those fat signatures were just painful to read in the function declarations/implementations. * I've also tried to give parameters more useful names. Calling an object "o" is a lot of fun when you want to grep for it. * Included is also Graham's latest menu.c patch. Sorry for the delay, Graham. * I've added checks to the menu code that make sure that menus don't pop up when they're empty (which resulted in a little useless rectangle). I guess that's it for now. Sorry if I broke anything, but this was necessary imho. SVN revision: 5605
2001-11-02 09:07:52 -08:00
D_ENTER;
data_dup = malloc(size);
Alright, I spent some time now reading e17's code. Here's what I've changed, this is big, so read this carefully :) * I've added debugging macros for messages and function call tracing. Usage: D("Creating item %i %i %i\n", x, y, z); Define DEBUG to use the D macro. D_ENTER; D_RETURN; D_RETURN_(x); These are for call tracing. Use D_RETURN_(x) when returning something from a function. Define DEBUG_NEST to use this. * added iconbar header file to Makefile.am * added proper new()/cleanup() calls for E_Delayed_Action; * I've completely rewritten the object and observer handling. Bye bye macros, this was nasty. It'll be hard enough to avoid leaks with usecounting in C. We now basically have the same system as gtk. There's a clear separation of observer and object code now. An E_Object by itself has nothing to do with observing or being observed, therefore, there are now E_Observers and E_Observees that are derived from E_Object. IMPORTANT: The cleanup system now reflects the reference count system, therefore, all ..._free() calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling now is as follows: - The cleanup functions clean up everything that is contained in a struct, but NOT the struct itself. Instead of the final free() call, they call the destructor of the base class. The calls will walk up the hierarchy and clean up what's contained in every struct, and the final e_object_cleanup() will free the structure itself. E_Delayed_Action is a good example. - The only calls that influence the reference count are e_object_ref() and e_object_unref(). If you need to do things before an object gets destroyed, you can query the use count using e_object_get_usecount() and check if it's equal to 1. So this: OBJ_UNREF(b); OBJ_IF_FREE(b) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); OBJ_FREE(b); } now is this: if (e_object_get_usecount(E_OBJECT(b)) == 1) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); } e_object_unref(E_OBJECT(b)); object.h and observer.h are completely commented, it shouldn't be too hard to understand. This'll need to be documented in the manual anyway. * E_Objects are now used in lots of places where void* were used as pointers to objects before, especially in the actions code. This is obviously better, as it will generate compiler warnings when people want to pass things to functions that expect E_Objects. This could probably be more restrictive. * Added typedefs for the function prototypes in E_Action_Impl. Those fat signatures were just painful to read in the function declarations/implementations. * I've also tried to give parameters more useful names. Calling an object "o" is a lot of fun when you want to grep for it. * Included is also Graham's latest menu.c patch. Sorry for the delay, Graham. * I've added checks to the menu code that make sure that menus don't pop up when they're empty (which resulted in a little useless rectangle). I guess that's it for now. Sorry if I broke anything, but this was necessary imho. SVN revision: 5605
2001-11-02 09:07:52 -08:00
if (!data_dup) D_RETURN_(NULL);
memcpy(data_dup, data, size);
Alright, I spent some time now reading e17's code. Here's what I've changed, this is big, so read this carefully :) * I've added debugging macros for messages and function call tracing. Usage: D("Creating item %i %i %i\n", x, y, z); Define DEBUG to use the D macro. D_ENTER; D_RETURN; D_RETURN_(x); These are for call tracing. Use D_RETURN_(x) when returning something from a function. Define DEBUG_NEST to use this. * added iconbar header file to Makefile.am * added proper new()/cleanup() calls for E_Delayed_Action; * I've completely rewritten the object and observer handling. Bye bye macros, this was nasty. It'll be hard enough to avoid leaks with usecounting in C. We now basically have the same system as gtk. There's a clear separation of observer and object code now. An E_Object by itself has nothing to do with observing or being observed, therefore, there are now E_Observers and E_Observees that are derived from E_Object. IMPORTANT: The cleanup system now reflects the reference count system, therefore, all ..._free() calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling now is as follows: - The cleanup functions clean up everything that is contained in a struct, but NOT the struct itself. Instead of the final free() call, they call the destructor of the base class. The calls will walk up the hierarchy and clean up what's contained in every struct, and the final e_object_cleanup() will free the structure itself. E_Delayed_Action is a good example. - The only calls that influence the reference count are e_object_ref() and e_object_unref(). If you need to do things before an object gets destroyed, you can query the use count using e_object_get_usecount() and check if it's equal to 1. So this: OBJ_UNREF(b); OBJ_IF_FREE(b) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); OBJ_FREE(b); } now is this: if (e_object_get_usecount(E_OBJECT(b)) == 1) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); } e_object_unref(E_OBJECT(b)); object.h and observer.h are completely commented, it shouldn't be too hard to understand. This'll need to be documented in the manual anyway. * E_Objects are now used in lots of places where void* were used as pointers to objects before, especially in the actions code. This is obviously better, as it will generate compiler warnings when people want to pass things to functions that expect E_Objects. This could probably be more restrictive. * Added typedefs for the function prototypes in E_Action_Impl. Those fat signatures were just painful to read in the function declarations/implementations. * I've also tried to give parameters more useful names. Calling an object "o" is a lot of fun when you want to grep for it. * Included is also Graham's latest menu.c patch. Sorry for the delay, Graham. * I've added checks to the menu code that make sure that menus don't pop up when they're empty (which resulted in a little useless rectangle). I guess that's it for now. Sorry if I broke anything, but this was necessary imho. SVN revision: 5605
2001-11-02 09:07:52 -08:00
D_RETURN_(data_dup);
}
int
e_util_glob_matches(char *str, char *glob)
{
Alright, I spent some time now reading e17's code. Here's what I've changed, this is big, so read this carefully :) * I've added debugging macros for messages and function call tracing. Usage: D("Creating item %i %i %i\n", x, y, z); Define DEBUG to use the D macro. D_ENTER; D_RETURN; D_RETURN_(x); These are for call tracing. Use D_RETURN_(x) when returning something from a function. Define DEBUG_NEST to use this. * added iconbar header file to Makefile.am * added proper new()/cleanup() calls for E_Delayed_Action; * I've completely rewritten the object and observer handling. Bye bye macros, this was nasty. It'll be hard enough to avoid leaks with usecounting in C. We now basically have the same system as gtk. There's a clear separation of observer and object code now. An E_Object by itself has nothing to do with observing or being observed, therefore, there are now E_Observers and E_Observees that are derived from E_Object. IMPORTANT: The cleanup system now reflects the reference count system, therefore, all ..._free() calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling now is as follows: - The cleanup functions clean up everything that is contained in a struct, but NOT the struct itself. Instead of the final free() call, they call the destructor of the base class. The calls will walk up the hierarchy and clean up what's contained in every struct, and the final e_object_cleanup() will free the structure itself. E_Delayed_Action is a good example. - The only calls that influence the reference count are e_object_ref() and e_object_unref(). If you need to do things before an object gets destroyed, you can query the use count using e_object_get_usecount() and check if it's equal to 1. So this: OBJ_UNREF(b); OBJ_IF_FREE(b) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); OBJ_FREE(b); } now is this: if (e_object_get_usecount(E_OBJECT(b)) == 1) { ecore_window_reparent(e->win, 0, 0, 0); e_icccm_release(e->win); } e_object_unref(E_OBJECT(b)); object.h and observer.h are completely commented, it shouldn't be too hard to understand. This'll need to be documented in the manual anyway. * E_Objects are now used in lots of places where void* were used as pointers to objects before, especially in the actions code. This is obviously better, as it will generate compiler warnings when people want to pass things to functions that expect E_Objects. This could probably be more restrictive. * Added typedefs for the function prototypes in E_Action_Impl. Those fat signatures were just painful to read in the function declarations/implementations. * I've also tried to give parameters more useful names. Calling an object "o" is a lot of fun when you want to grep for it. * Included is also Graham's latest menu.c patch. Sorry for the delay, Graham. * I've added checks to the menu code that make sure that menus don't pop up when they're empty (which resulted in a little useless rectangle). I guess that's it for now. Sorry if I broke anything, but this was necessary imho. SVN revision: 5605
2001-11-02 09:07:52 -08:00
D_ENTER;
if (!fnmatch(glob, str, 0)) D_RETURN_(1);
D_RETURN_(0);
}
/*
* Function to take a URL of the form
* file://hostname/dir1/dir2/file
*
* Test that 'file://' exists.
* Test that hostname matches passed value
* Return a pointer to /dir1/...
*
* todo:
* - dir or filename which matches hostname will
* fool the hostname match
* - file://dir1/dir2/file is also legal but rejected by
* this presently
*/
char *
e_util_de_url_and_verify( const char *fi, const char *hostn )
{
char *wk;
D_ENTER;
wk = strstr( fi, "file://" );
/* Valid URL contains "file://" */
if( !wk )
D_RETURN_ (NULL);
/* Need some form of hostname to continue */
if( !hostn )
D_RETURN_ (NULL);
/* Do we contain hostname? */
wk = strstr( fi, hostn );
/* Hostname mismatch, reject file */
if( !wk )
D_RETURN_ (NULL);
/* Local file name starts after "hostname" */
wk = strchr( wk, '/' );
if( !wk )
D_RETURN_ (NULL);
D_RETURN( wk );
}