#
# This file is part of devilspie2
# Copyright (C) 2011-2014 Andreas Rönnquist
#
# devilspie2 is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# devilspie2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with devilspie2.
# If not, see <http://www.gnu.org/licenses/>.
#

Devilspie2 development
======================

Git is used for version control for devilpsie2. If you would like to provide
code to devilspie2, the first thing to do is - learn git.

Number two to think about is if you are willing to release your code as
GPL. Devilspie2 is released under the GPL license version 3, and I will
only accept code under that license.

As with any C program, program execution starts in the main function - which
is placed in devilspie2.c in this case. The main function interprets the 
command line options, sets up a list of script files that should be 
interpreted, and registers the signal for window_opened to the proper callback
function.


Adding a new script function
============================

Add it in script.c in the function "register_cfunctions", using a 
lua_register call - To add a function having the lua name "center", and connect
it with the C function c_center, do this:

lua_register(lua,"center",c_center);

This registers a center function, that will call the c_center function in the
C code. The C function should be placed in script_functions.c & its header,
with the following prototype:

int c_center(lua_State *lua);

What is returned is an integer represeting the amount of return values that the
LUA function returns. These return values are pushed to the stack using a
lua_push for the correct type - for example lua_pushboolean(lua, TRUE);

And logically if there are nothing to return, we simply do a "return 0;".

If we need something that isn't directly implemented in libwnck, we can add
a function implementing it to the file "xutils.c" - please separate stuff from
script_functions if it has no need to be there, and simply call it from your
function in script_functions.c. The point is to keep input and LUA interpreting
to script_functions, while the actual wnck and/or X work is in the xutils files.




