Merge branch 'next'
clang-format: don’t define ForeachMacros

Otherwise clang-formatting **/*.h breaks include/queue.h
clang-format-3.5 **/*.h **/*.c

This should be the last commit that formats a big bunch of files. From
here on, whenever I merge patches, I’ll run clang-format like described
in the title.
Implement EWMH number of desktops property

_NET_NUMBER_OF_DESKTOPS:

> This property SHOULD be set and updated by the Window Manager to
> indicate the number of virtual desktops.

We interpret this property as the number of noninternal workspaces.
bugfix: don't set input focus if not accepted

http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7

> Clients using the Globally Active model can only use a SetInputFocus request
> to acquire the input focus when they do not already have it on receipt of one
> of the following events:
> * ButtonPress
> * ButtonRelease
> * Passive-grabbed KeyPress
> * Passive-grabbed KeyRelease

Since managing a window happens on a MapNotify (which is absent from this
list), the window cannot accept input focus, so we should not try to focus
the window at all.

Fixes an issue with xfce4-notifyd which (correctly) declines focus when
we send WM_TAKE_FOCUS, which puts i3 in a state where i3 focus and X
focus are different when a notification appears.
tests: explicitly set input hint

Since i3 honors the “Globally Active Input” focus model, we need to
explicitly state that we are not using that in our testcases :).

This requires X11::XCB from git to work (commit
71b25dcaafc509e710b8fd7de20c97ac3549fc39).
Feature: implement mouse bindings

A configured mouse binding (for example `bindsym button3 kill`) runs
its command when the mouse button is pressed over parts of a container.

If the binding has no modifer, it will only run when the button is
clicked on the window titlebar.

Otherwise if the binding has a modifier, it will run over the titlebar
or any part of the contained window.

fixes #558
Implement the window::close event

The window::close event should be emitted when a window closes.
Implement the window::move event

The window::move event should be emitted when the window moves position
in the tree.
Switch to xcb-xkb and libxkbcommon

This removes our last dependency on Xlib! :)

(Okay, an Xlib dependency still comes in through other libraries that we
 link against, but it’s not us. Our code is simpler by this change and
 uses one less connection to X11.)
DEPENDS: add libxkbcommon{,-x11}, update lkgv (Thanks okraits)
Consistently parse workspace numbers

Use ws_name_to_number() to parse workspace numbers where this
transformation takes place.
Make command `move [direction]` work with criteria

A container selected with criteria should be moved with the `move
[direction]` command, instead of this command always acting on the
focused container.
Implement the window::floating event

The window::floating event should be emitted when a window transitions
to or from the floating state.
fix src/commands.c with clang-format
feature: implement ewmh desktop viewport property

Set and update the _NET_DESKTOP_VIEWPORT property

http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140146176862048

> _NET_DESKTOP_VIEWPORT x, y, CARDINAL[][2]/32
> Array of pairs of cardinals that define the top left corner of each
> desktop's viewport.
Workspace command number selection

If a `workspace {N}` or `move to workspace {N}` command is given with N
as a plain number, the workspace of this number is selected for the
context of the command if one exists and there is no workspace with a
name that exactly matches N.
Bugfix: don't focus unmapped container on manage

A window may become unmapped on manage when an assignment command unmaps
the window, such as moving it to the scratchpad or killing it.

This can cause i3 focus to be an unmapped window and different than X
focus which can lead to complications

fixes #1283
Merge branch 'fix-focus-unmapped'
Merge branch 'master' into next