window: fix invalid read in computing the input shape

If we are reported only one rectangle in the input shape, we should
not try to read more.

https://bugzilla.gnome.org/show_bug.cgi?id=724257
window: don't set _NET_WM_FULLSCREEN_MONITORS to bogus values

Prior to the DisplayConfig merge, we would set _NET_WM_FULLSCREEN_MONITORS
to (unsigned)-1 when unset. After that, we would have invalid
reads inside meta_screen_monitor_index_to_xinerama_index() (called
with -1).
The way I read the specification, the proper way to indicate
that the window is back to fullscreen on all monitors is to
remove the property, so do that.

Also, add an assertion that meta_screne_monitor_index_to_xinerama_index()
is doing the right thing.

https://bugzilla.gnome.org/show_bug.cgi?id=724258
Always map the client and frame windows

Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.

However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.

I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.

Remove this now.

The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.

At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
compositor: Delay meta_compositor_add_window until the first show

In order for the compositor to properly determine whether a client
is an X11 client or not, we need to wait until XWayland calls
set_window_id to mark the surface as an XWayland client. To prevent
the compositor from getting tripped up over this, make sure that
the window has been fully initialized by the time we call
meta_compositor_add_window.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
Move position-changed / size-changed signals to the MetaWindow

They fit more appropriately over here...

https://bugzilla.gnome.org/show_bug.cgi?id=720631
idle-monitor: avoid XSyncBadAlarm X error

If we fail to find the IDLETIME counter, then the alarm variable will be
uninitialised.  Most code paths are careful to check this before
submitting XSync calls, but there is one check missing.

https://bugzilla.gnome.org/show_bug.cgi?id=724364
wayland-surface: Don't crash when someone tries to run a native app using old gtk

This ends up calling set_dbus_properties with a NULL
window, instead of segfaulting the compositor return so that the broken
app dies instead.

https://bugzilla.gnome.org/show_bug.cgi?id=724472
wayland-surface: Prefix xdg-shell methods with "xdg_shell_"
wayland-surface: Don't require we manually bump the version for xdg-shell

It's in the protocol as an enum.
Revert "Move window pings to MetaWindow"

This was a bad idea, as ping/pong has moved to a client-specific
request/event pair, rather than a surface-specific one. Revert
the changes we made here and correct the code to make up for it.

This reverts commit aa3643cdde4277a26e5730a0f6335c76a1a22d4f.
Update to new xdg-shell pinging standards
wayland-surface: Destroy the right thing

data is the wl_client, which we don't want to destroy. Destroy
our XdgShell pointer instead.
default: Don't wait to show the stage

We can show it immediately now...
default: Use a consistent rand() for monitor backgrounds

g_random_int() is seeded with /dev/urandom, so it's not consistent.
xwayland: Don't -retro

This means we see black instead of checkerboard for now when resizing,
but that's better.
default: Don't use anchor points

It doesn't work now that we set the pivot point. This breaks the
maximize effect, but it fixes the destroy effect. The maximize effect
looks bad anyway, so it's not too important to me.
wayland: Rename resource_destroy_cb to wl_surface_destructor

So it doesn't seem like a wl_listener callback.
pointer/keyboard: Do a series of renames to our listener as well
pointer/keyboard: Put the destroy listener on the right resource

We care about when the surface is destroyed, not when the wl_pointer
slash wl_keyboard resource is destroyed.
default: Improve the destroy effect as well