Merge pull request #307 from blueyed/minor-style

Various minor style / doc / comment fixes
This commit is contained in:
Daniel Hahler 2015-07-12 20:53:39 +02:00
commit f37a3544de
9 changed files with 28 additions and 18 deletions

View File

@ -44,4 +44,4 @@ distclean:
$(MAKE) -C ${builddir} $@ $(MAKE) -C ${builddir} $@
$(and $(filter clean,$@),$(RM) $(BUILDLN) $(TARGETS)) $(and $(filter clean,$@),$(RM) $(BUILDLN) $(TARGETS))
.PHONY: cmake-build cmake install distclean $(BUILDLN) .PHONY: cmake-build cmake install distclean $(BUILDLN) tags

View File

@ -395,13 +395,13 @@ client.connect_signal("manage", function (c)
-- i.e. put it at the end of others instead of setting it master. -- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c) -- awful.client.setslave(c)
-- Put windows in a smart way, only if they does not set an initial position. -- Put windows in a smart way, only if they do not set an initial position.
if not c.size_hints.user_position and not c.size_hints.program_position then if not c.size_hints.user_position and not c.size_hints.program_position then
awful.placement.no_overlap(c) awful.placement.no_overlap(c)
awful.placement.no_offscreen(c) awful.placement.no_offscreen(c)
end end
elseif not c.size_hints.user_position and not c.size_hints.program_position then elseif not c.size_hints.user_position and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count change -- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c) awful.placement.no_offscreen(c)
end end

View File

@ -26,7 +26,7 @@
#include "common/util.h" #include "common/util.h"
/** Lua function to call on dofuction() error */ /** Lua function to call on dofunction() error */
lua_CFunction lualib_dofunction_on_error; lua_CFunction lualib_dofunction_on_error;
void luaA_checkfunction(lua_State *, int); void luaA_checkfunction(lua_State *, int);

View File

@ -14,26 +14,31 @@ Imitate the existing code style. For concrete rules:
- Use 4 spaces indentation, do not use tabulator characters; - Use 4 spaces indentation, do not use tabulator characters;
- Place braces alone on new lines, and do not place braces for single - Place braces alone on new lines, and do not place braces for single
line statement where it is not needed, i.e. no: line statement where it is not needed, i.e.:
if(bla) { if(foo)
x = 1; x = 1;
if(foo)
{
x = 1;
bar();
} }
- Do not put a space after if, for, while or function call statements; - Do not put a space after if, for, while or function call statements;
- The preferred line length is 80 characters; - The preferred maximum line length is 80 characters;
- Use `/* */` for comments; - Use `/* */` for comments;
- Use the API: there's a list of `a_*()` functions you should use instead - Use the API: there is a list of `a_*()` functions you should use instead
of the standard libc ones. There is also a common API for linked lists, of the standard libc ones. There is also a common API for linked lists,
tabulars, etc.; tabulars, etc.;
- Be *clear* in what you do; - Be *clear* in what you do;
- Prefix your function name with the module they are enhancing, - Prefix your function names with the module they are enhancing,
i.e. if you add a function to manipulate a tag prefix it with `tag_`; i.e. if you add a function to manipulate a tag, prefix it with `tag_`;
- Write documentation for any new functions, options, whatever. - Write documentation for any new functions, options, whatever.

View File

@ -75,7 +75,7 @@ is_control(char *buf)
/** Handle keypress event. /** Handle keypress event.
* \param L Lua stack to push the key pressed. * \param L Lua stack to push the key pressed.
* \param e Received XKeyEvent. * \param e Received XKeyEvent.
* \return True if a key was successfully get, false otherwise. * \return True if a key was successfully retrieved, false otherwise.
*/ */
bool bool
keygrabber_handlekpress(lua_State *L, xcb_key_press_event_t *e) keygrabber_handlekpress(lua_State *L, xcb_key_press_event_t *e)

View File

@ -80,11 +80,11 @@ end
-- end) -- end)
-- end -- end
function keygrabber.run(g) function keygrabber.run(g)
-- Remove the grabber if its in stack -- Remove the grabber if it is in the stack.
keygrabber.stop(g) keygrabber.stop(g)
-- Record the grabber has latest added -- Record the grabber that has been added most recently.
table.insert(grabbers, 1, g) table.insert(grabbers, 1, g)
-- start the keygrabber if its not running already -- Start the keygrabber if it is not running already.
if not keygrabbing then if not keygrabbing then
keygrabbing = true keygrabbing = true
capi.keygrabber.run(grabber) capi.keygrabber.run(grabber)

View File

@ -214,8 +214,7 @@ function rules.execute(c, props, callbacks)
end end
end end
-- Do this at last so we do not erase things done by the focus -- Do this at last so we do not erase things done by the focus signal.
-- signal.
if props.focus and (type(props.focus) ~= "function" or props.focus(c)) then if props.focus and (type(props.focus) ~= "function" or props.focus(c)) then
c:emit_signal('request::activate', "rules", {raise=true}) c:emit_signal('request::activate', "rules", {raise=true})
end end

View File

@ -445,6 +445,8 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool doresize)
/* move / resize the client */ /* move / resize the client */
client_resize(c, new_geometry, false); client_resize(c, new_geometry, false);
/* emit signal */
luaA_object_push(L, c); luaA_object_push(L, c);
if(old_screen_idx != 0) if(old_screen_idx != 0)
lua_pushinteger(L, old_screen_idx); lua_pushinteger(L, old_screen_idx);
@ -452,6 +454,7 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool doresize)
lua_pushnil(L); lua_pushnil(L);
luaA_object_emit_signal(L, -2, "property::screen", 1); luaA_object_emit_signal(L, -2, "property::screen", 1);
lua_pop(L, 1); lua_pop(L, 1);
if(had_focus) if(had_focus)
client_focus(c); client_focus(c);
} }

7
xrdb.c
View File

@ -39,7 +39,7 @@ static void xrdb_init(void) {
/**/ /**/
if (!(globalconf.xrmdb = XrmGetDatabase(globalconf.display))) if (!(globalconf.xrmdb = XrmGetDatabase(globalconf.display)))
warn("Can't open xrdb\n"); warn("Cannot open xrdb.");
} }
} }
@ -67,7 +67,10 @@ int luaA_xrdb_get_value(lua_State *L) {
lua_pushstring(L, (char *)resource_value.addr); lua_pushstring(L, (char *)resource_value.addr);
return 1; return 1;
} else { } else {
luaA_warn(L, "Failed to get xrdb value"); if (strlen(resource_class))
luaA_warn(L, "Failed to get xrdb value '%s' (class '%s').", resource_name, resource_class);
else
luaA_warn(L, "Failed to get xrdb value '%s'.", resource_name);
return 0; return 0;
} }
} }