about summary refs log tree commit diff stats
path: root/dwm.h
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.h')
-rw-r--r--dwm.h35
1 files changed, 15 insertions, 20 deletions
diff --git a/dwm.h b/dwm.h
index ee7ced1..8e665ea 100644
--- a/dwm.h
+++ b/dwm.h
@@ -6,19 +6,14 @@
  * driven through handling X events. In contrast to other X clients, a window
  * manager like dwm selects for SubstructureRedirectMask on the root window, to
  * receive events about child window appearance and disappearance.  Only one X
- * connection at a time is allowed to select for this event mask by any X
- * server, thus only one window manager instance can be executed at a time.
- * Any attempt to select for SubstructureRedirectMask by any connection after
- * another connection already selected for those events, will result in an
- * error generated by the server. Such errors are reported through calling the
- * current X error handler.
+ * connection at a time is allowed to select for this event mask.
  *
- * Calls to pop an X event from the event queue of the X connection are
+ * Calls to fetch an X event from the event queue of the X connection are
  * blocking.  Due the fact, that dwm reads status text from standard input, a
  * select-driven main loop has been implemented which selects for reads on the
  * X connection and STDIN_FILENO to handle all data smoothly and without
- * busy-loop quirks..  The event handlers of dwm are organized in an array
- * which is accessed whenever a new event has been popped. This allows event
+ * busy-loop quirks. The event handlers of dwm are organized in an array which
+ * is accessed whenever a new event has been fetched. This allows event
  * dispatching in O(1) time.
  *
  * Each child window of the root window is called a client in window manager
@@ -27,20 +22,20 @@
  * history is remembered through a global stack list. Each client contains an
  * array of Bools of the same size as the global tags array to indicate the
  * tags of a client. There are no other data structures to organize the clients
- * in tag lists, because a single global list is most simple. All clients which
- * have at least one tag enabled of the current tags viewed, will be visible on
- * the screen, all other clients are banned to the x-location 2 * screen width.
- * This avoids having additional layers of workspace handling.
+ * in tag lists. All clients which have at least one tag enabled of the current
+ * tags viewed, will be visible on the screen, all other clients are banned to
+ * the x-location x + 2 * screen width.  This avoids having additional layers
+ * of workspace handling.
  *
  * For each client dwm creates a small title window which is resized whenever
- * the WM_NAME or _NET_WM_NAME properties are updated.
+ * the WM_NAME or _NET_WM_NAME properties are updated or the client is resized.
+ * Keys and tagging rules are organized as arrays and defined in the config.h
+ * file. These arrays are kept static in event.o and tag.o respectively,
+ * because no other part of dwm needs access to them.  The current mode is
+ * represented by the arrange function pointer which wether points to dofloat
+ * or dotile. 
  *
- * Keys and tagging rules are organized as arrays as well and defined in the
- * config.h file. These arrays are kept static in event.o and tag.o
- * respectively, because no other part of dwm needs access to them.
- *
- * The current mode is represented by the arrange function pointer which wether
- * points to dofloat or dotile. 
+ * To understand everything else, start with reading main.c:main().
  */
 
 #include "config.h"
t .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*=========================================================================*\
* LuaSocket toolkit
* Networking support for the Lua language
* Diego Nehab
* 26/11/1999
*
* This library is part of an  effort to progressively increase the network
* connectivity  of  the Lua  language.  The  Lua interface  to  networking
* functions follows the Sockets API  closely, trying to simplify all tasks
* involved in setting up both  client and server connections. The provided
* IO routines, however, follow the Lua  style, being very similar  to the
* standard Lua read and write functions.
\*=========================================================================*/

#include "luasocket.h"
#include "auxiliar.h"
#include "except.h"
#include "timeout.h"
#include "buffer.h"
#include "inet.h"
#include "tcp.h"
#include "udp.h"
#include "select.h"

/*-------------------------------------------------------------------------*\
* Internal function prototypes
\*-------------------------------------------------------------------------*/
static int global_skip(lua_State *L);
static int global_unload(lua_State *L);
static int base_open(lua_State *L);

/*-------------------------------------------------------------------------*\
* Modules and functions
\*-------------------------------------------------------------------------*/
static const luaL_Reg mod[] = {
    {"auxiliar", auxiliar_open},
    {"except", except_open},
    {"timeout", timeout_open},
    {"buffer", buffer_open},
    {"inet", inet_open},
    {"tcp", tcp_open},
    {"udp", udp_open},
    {"select", select_open},
    {NULL, NULL}
};

static luaL_Reg func[] = {
    {"skip",      global_skip},
    {"__unload",  global_unload},
    {NULL,        NULL}
};

/*-------------------------------------------------------------------------*\
* Skip a few arguments
\*-------------------------------------------------------------------------*/
static int global_skip(lua_State *L) {
    int amount = (int) luaL_checkinteger(L, 1);
    int ret = lua_gettop(L) - amount - 1;
    return ret >= 0 ? ret : 0;
}

/*-------------------------------------------------------------------------*\
* Unloads the library
\*-------------------------------------------------------------------------*/
static int global_unload(lua_State *L) {
    (void) L;
    socket_close();
    return 0;
}

/*-------------------------------------------------------------------------*\
* Setup basic stuff.
\*-------------------------------------------------------------------------*/
static int base_open(lua_State *L) {
    if (socket_open()) {
        /* export functions (and leave namespace table on top of stack) */
        lua_newtable(L);
        luaL_setfuncs(L, func, 0);
#ifdef LUASOCKET_DEBUG
        lua_pushstring(L, "_DEBUG");
        lua_pushboolean(L, 1);
        lua_rawset(L, -3);
#endif
        /* make version string available to scripts */
        lua_pushstring(L, "_VERSION");
        lua_pushstring(L, LUASOCKET_VERSION);
        lua_rawset(L, -3);
        return 1;
    } else {
        lua_pushstring(L, "unable to initialize library");
        lua_error(L);
        return 0;
    }
}

/*-------------------------------------------------------------------------*\
* Initializes all library modules.
\*-------------------------------------------------------------------------*/
LUASOCKET_API int luaopen_socket_core(lua_State *L) {
    int i;
    base_open(L);
    for (i = 0; mod[i].name; i++) mod[i].func(L);
    lua_setglobal(L, "socket");
    return 1;
}