compositor: Implement surface global alpha

Just a small tweak to the shader and we can control the overall surface alpha.
diff --git a/compositor/compositor.c b/compositor/compositor.c
index 220f51c..cb9b41f 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -225,6 +225,7 @@
 	surface->y = y;
 	surface->width = width;
 	surface->height = height;
+	surface->alpha = 255;
 
 	surface->fullscreen_output = NULL;
 	surface->buffer = NULL;
@@ -548,6 +549,12 @@
 		break;
 	}
 
+	if (es->alpha != ec->current_alpha) {
+		glUniform1f(ec->texture_shader.alpha_uniform,
+			    es->alpha / 255.0);
+		ec->current_alpha = es->alpha;
+	}
+
 	if (es->transform == NULL) {
 		filter = GL_NEAREST;
 		n = texture_region(es, &repaint);
@@ -1626,9 +1633,11 @@
 	"precision mediump float;\n"
 	"varying vec2 v_texcoord;\n"
 	"uniform sampler2D tex;\n"
+	"uniform float alpha;\n"
 	"void main()\n"
 	"{\n"
 	"   gl_FragColor = texture2D(tex, v_texcoord)\n;"
+	"   gl_FragColor = alpha * gl_FragColor;\n"
 	"}\n";
 
 static const char solid_fragment_shader[] =
@@ -1687,6 +1696,7 @@
 
 	shader->proj_uniform = glGetUniformLocation(shader->program, "proj");
 	shader->tex_uniform = glGetUniformLocation(shader->program, "tex");
+	shader->alpha_uniform = glGetUniformLocation(shader->program, "alpha");
 
 	return 0;
 }