int margin;
int fullscreen;
int decoration;
+ int transparent;
struct input *grab_device;
struct input *keyboard_device;
uint32_t name;
static cairo_surface_t *
display_create_egl_window_surface(struct display *display,
struct wl_surface *surface,
+ struct wl_visual *visual,
struct rectangle *rectangle)
{
cairo_surface_t *cairo_surface;
struct egl_window_surface_data *data;
- struct wl_visual *visual;
data = malloc(sizeof *data);
if (data == NULL)
data->display = display;
data->surface = surface;
- visual = display->premultiplied_argb_visual;
-
data->window = wl_egl_window_create(surface,
rectangle->width,
rectangle->height,
static cairo_surface_t *
display_create_egl_image_surface(struct display *display,
+ struct wl_visual *visual,
struct rectangle *rectangle)
{
struct egl_image_surface_data *data;
EGLDisplay dpy = display->dpy;
cairo_surface_t *surface;
- struct wl_visual *visual;
data = malloc(sizeof *data);
if (data == NULL)
data->display = display;
- visual = display->premultiplied_argb_visual;
data->pixmap = wl_egl_pixmap_create(rectangle->width,
rectangle->height,
visual, 0);
int stride, i;
unsigned char *pixels, *p, *end;
struct egl_image_surface_data *data;
+ struct wl_visual *visual;
pixbuf = gdk_pixbuf_new_from_file_at_scale(filename,
rect->width, rect->height,
}
}
- surface = display_create_egl_image_surface(display, rect);
+ visual = display->premultiplied_argb_visual;
+ surface = display_create_egl_image_surface(display, visual, rect);
if (surface == NULL) {
g_object_unref(pixbuf);
return NULL;
static cairo_surface_t *
display_create_shm_surface(struct display *display,
- struct rectangle *rectangle)
+ struct rectangle *rectangle, uint32_t flags)
{
struct shm_surface_data *data;
- cairo_surface_t *surface;
struct wl_visual *visual;
+ cairo_surface_t *surface;
int stride, fd;
char filename[] = "/tmp/wayland-shm-XXXXXX";
cairo_surface_set_user_data (surface, &surface_data_key,
data, shm_surface_data_destroy);
- visual = display->premultiplied_argb_visual;
+ if (flags & SURFACE_OPAQUE)
+ visual = display->rgb_visual;
+ else
+ visual = display->premultiplied_argb_visual;
+
data->data.buffer = wl_shm_create_buffer(display->shm,
fd,
rectangle->width,
stride = gdk_pixbuf_get_rowstride(pixbuf);
pixels = gdk_pixbuf_get_pixels(pixbuf);
- surface = display_create_shm_surface(display, rect);
+ surface = display_create_shm_surface(display, rect, 0);
if (surface == NULL) {
g_object_unref(pixbuf);
return NULL;
cairo_surface_t *
display_create_surface(struct display *display,
struct wl_surface *surface,
- struct rectangle *rectangle)
+ struct rectangle *rectangle,
+ uint32_t flags)
{
+ struct wl_visual *visual;
+
+ if (flags & SURFACE_OPAQUE)
+ visual = display->rgb_visual;
+ else
+ visual = display->premultiplied_argb_visual;
+
if (check_size(rectangle) < 0)
return NULL;
#ifdef HAVE_CAIRO_EGL
if (surface)
return display_create_egl_window_surface(display,
surface,
+ visual,
rectangle);
else
return display_create_egl_image_surface(display,
+ visual,
rectangle);
}
#endif
- return display_create_shm_surface(display, rectangle);
+ return display_create_shm_surface(display, rectangle, flags);
}
static cairo_surface_t *
window_create_surface(struct window *window)
{
cairo_surface_t *surface;
-
+ uint32_t flags = 0;
+
+ if (!window->transparent)
+ flags = SURFACE_OPAQUE;
+
switch (window->buffer_type) {
#ifdef HAVE_CAIRO_EGL
case WINDOW_BUFFER_TYPE_EGL_WINDOW:
}
surface = display_create_surface(window->display,
window->surface,
- &window->allocation);
+ &window->allocation, flags);
break;
case WINDOW_BUFFER_TYPE_EGL_IMAGE:
surface = display_create_surface(window->display,
NULL,
- &window->allocation);
+ &window->allocation, flags);
break;
#endif
case WINDOW_BUFFER_TYPE_SHM:
surface = display_create_shm_surface(window->display,
- &window->allocation);
+ &window->allocation, flags);
break;
default:
surface = NULL;
}
void
+window_set_transparent(struct window *window, int transparent)
+{
+ window->transparent = transparent;
+}
+
+void
window_set_title(struct window *window, const char *title)
{
free(window->title);
window->saved_allocation = window->allocation;
window->margin = 16;
window->decoration = 1;
+ window->transparent = 1;
if (display->dpy)
/* FIXME: make TYPE_EGL_IMAGE choosable for testing */