Support application internal mouse grabbing for popup windows

Mouse grabbing is used to close a popup window when the user clicks on
another window. Wayland doesn't support mouse grabbing by
design and sends an event when the user clicks on a window of another
application. This patch fakes mouse grabbing for the windows of the
application the popup belongs to, so that it closes when the user
clicks on a window of the same application.

Change-Id: Iac210bed0ca0fc6d3ffdbdb76d069886de51cf04
Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>