aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
AgeCommit message (Collapse)AuthorFilesLines
2013-02-18Don't spam with the "Unable to convert ... from nil" messageson-1.3.4Pavel Labath1-3/+7
2013-02-18Add lua::quote function, for safe (and pretty) quoting of stringsPavel Labath2-0/+28
2013-02-18fluxbox-update_configs: add conversion of init filesPavel Labath1-0/+2
2013-02-18More preparation for automatic updating of config filesPavel Labath3-32/+51
2013-02-18Make AutoReloadHelper truly "automatic"Pavel Labath2-1/+15
by adding the ability to automatically check for modifications at specified intervals. Using inotify() would be better, but that's not always present.
2013-02-18Move most of the resource loading code into ResourceManager_basePavel Labath4-42/+45
I mostly do this to avoid code duplication between fluxbox and fluxbox-update_configs.
2013-02-18Automatically save init file when a resource is modifiedPavel Labath3-5/+38
previously, init was autosaved only when a resource was modified using the menu. I have also included modifications through lua code. To avoid wasting resources, the file is not saved immediately, but with a 5 second delay (to enable saving a bunch of changes in one go)
2013-02-18Remove remnants of old menu parsing codePavel Labath3-79/+1
as it's no longed needed
2013-02-18Refactoring: move details if init file loading into LResourceManagerPavel Labath2-0/+36
2013-02-18Create a completely new lua state upon USR2 reconfigurePavel Labath2-15/+40
This way, global variables set by the scripts don't persist between hard reconfigures. I also cleaned up the reconfig-handling code in fluxbox.cc. Instead of three reconfig functions (real_reconfig, timed_reconfig, reconfig) we have just one.
2013-02-18Add checkstring() to lua::statePavel Labath2-4/+21
2013-02-18Add checkudata and checkargno functions to lua::statePavel Labath2-0/+43
These can be used by functions to check the saneness of arguments. They throw an exception on error. In the future, I might add more informative error messages.
2013-02-18Add readOnlySetField to FbTk::LuaPavel Labath2-0/+10
an equivalent of rawsetfield, but for "read only" tables.
2013-02-18luamm: add lua_isuserdata C++ bindingPavel Labath1-0/+1
2013-02-18Attach a modifiedSig handler to the session.cacheMax resourcePavel Labath2-5/+10
2013-02-18Attach a modifiedSig handler to the session.cacheLife resourcePavel Labath2-8/+14
2013-02-18Fix unspecified construction order of Lua::s_init_functionsPavel Labath2-14/+24
2013-02-17Fix a small leak in FbTk::LuaPavel Labath1-1/+7
2013-02-17Emit the "modified" signal when a resource value is changed through C++ codePavel Labath1-2/+6
2013-02-17Add RangeTraits class which automatically clamps the value of resourcesPavel Labath2-0/+39
and start using it.
2013-02-17Enable the resource traits classes to hold non-static membersPavel Labath2-11/+19
ps: the Resource class inherits from the Traits class instead of holding it as a member because it's more size-efficient (base classes can have zero size, members cannot).
2013-02-17Add a "modified" signal to resourcesPavel Labath1-2/+12
This way, an object can be informed when a resource changes (e.g. by a lua function).
2013-02-17Lua: Make global variables read-onlyPavel Labath3-19/+20
This prevents the user from inadvertently overwriting e.g. the session table and then wondering why it does not work. I'm still not sure about this approach, as it's not 100% secure (the script can still use raw access to mess with it) and it adds some overhead to any operation referencing a global variable.
2013-02-17Small optimization of the newindexDeny{Write,Modify} functionsPavel Labath1-3/+20
2013-02-17use Lua::registerInitFunction to simplify some parts of codePavel Labath2-32/+26
2013-02-17A lightweight version of lua::state::pushclosure which handles the simple casesPavel Labath2-3/+12
2013-02-17FbTk::Lua - a class which augments lua::state with additional featuresPavel Labath3-0/+183
2013-02-17Luamm: add lua_istable C++ wrapperPavel Labath1-0/+1
2013-02-17Add a version of lua::state::loadstring which accepts std::stringPavel Labath1-0/+1
2013-02-17Store menus if smart pointers (RefCount)Pavel Labath7-31/+15
This was originally intended to be a bugfix for an memory error reported by valgrind (accessing freed memory). While debugging it, I found the menu ownership semantics confusing (setInternalMenu() et al.), so I decided to get rid of it and store it in smart pointers everywhere. Looking back, I'm not sure if this was worth all the trouble, but the good news is that the valgrind error disappeared. :)
2013-02-17A veeeery rough implementation of lua menu parsersPavel Labath3-4/+4
2013-02-17Fix saving of resources.Pavel Labath1-29/+66
2013-02-16Vector resources can now specify which char to use as delimitersPavel Labath1-2/+2
when saving/loading to/from string representation. This is needed for the next commit.
2013-02-16Add LocaleStringTraits resource classPavel Labath1-2/+19
for resources which need to work with localised strings.
2013-02-16Replace ResourceManager with the lua versionPavel Labath1-0/+8
Loading of an init file with the new manager works ok. Saving and restarting is still not completed. This touches many files because i removed the alternative name of resources. Unlike Xrm, lua does not have native support for alt names. It should be fairly easy to add them, but I think that is unnecessary and would be confusing.
2013-02-16Fix bug in LResources: they were unable to handle resources with numbers in ↵Pavel Labath1-6/+6
names
2013-02-16Make lua resource manager automatically initialize lua state if neededPavel Labath1-0/+5
2013-02-16Add a function for converting from XResources to lua onesPavel Labath3-0/+21
2013-02-16Lua resources: Add support for saving of boolean valuesPavel Labath1-6/+15
2013-02-16Factor out "session." from resource namesPavel Labath4-13/+19
this reduces typing and it makes more sense in lua, since there the resources are implemented as hierarchical tables and the topmost table has to be handled a bit specially.
2013-02-16Move more common stuff of (L)ResourceManagers to their base classPavel Labath4-80/+41
2013-02-16Avoid a "converting to int from foo" compiler warningPavel Labath1-1/+1
2013-02-16Add support for array lua resourcesPavel Labath2-33/+48
2013-02-16Simplify FbTk::Resource template classPavel Labath2-24/+244
by outsourcing the conversion from string/lua to the specific type (and back) to a separate class. This change touches a lot of files because the interface of FbTk::Resource changed slightly. However, the changes are minor.
2013-02-16A rough version of resource implementation in luaPavel Labath6-35/+443
I added a new class, LResourceManager, which should handle loading and saving of resources like the old ResourceManager, only it does that with the help of lua. I moved the common features of the two managers (interface + a few functions) to a common base class ResourceManager_base. I augmented the Resource_base class with two new functions (setFromLua and pushToLua) which are used by the lua RM instead of getString and setFromString. Parts of the new RM are written in lua. To avoid loading scripts from a file at runtime I decided to link compiled lua code straight into the executable. For this purpose I created a small script which converts a binary file into a declaration of a C array of bytes.
2013-02-16convert ResourceManager::{add,remove}Resource from template to a regular ↵Pavel Labath2-34/+31
function
2013-02-16Lua exceptions can now outlive thier lua contextPavel Labath2-5/+18
2013-02-16Luamm: add lua_createtable bindingPavel Labath1-0/+1
2013-02-16luamm: add a version of loadstring which also takes the string length as a ↵Pavel Labath2-3/+22
parameter
2013-02-16Add lua_rawgeti wrapper to luammPavel Labath1-0/+1