Handle compositors without wl_shell

dev
Kristian Høgsberg 13 years ago
parent 41abb2865e
commit e4fb78de8f
  1. 49
      clients/window.c

@ -720,6 +720,28 @@ window_get_resize_dx_dy(struct window *window, int *x, int *y)
window->resize_edges = 0; window->resize_edges = 0;
} }
static void
window_set_type(struct window *window)
{
struct display *display = window->display;
switch (window->type) {
case TYPE_FULLSCREEN:
wl_shell_set_fullscreen(display->shell, window->surface);
break;
case TYPE_TOPLEVEL:
wl_shell_set_toplevel(display->shell, window->surface);
break;
case TYPE_TRANSIENT:
wl_shell_set_transient(display->shell, window->surface,
window->parent->surface,
window->x, window->y, 0);
break;
case TYPE_CUSTOM:
break;
}
}
static void static void
window_attach_surface(struct window *window) window_attach_surface(struct window *window)
{ {
@ -731,6 +753,9 @@ window_attach_surface(struct window *window)
#endif #endif
int32_t x, y; int32_t x, y;
if (display->shell)
window_set_type(window);
switch (window->buffer_type) { switch (window->buffer_type) {
#ifdef HAVE_CAIRO_EGL #ifdef HAVE_CAIRO_EGL
case WINDOW_BUFFER_TYPE_EGL_WINDOW: case WINDOW_BUFFER_TYPE_EGL_WINDOW:
@ -766,22 +791,6 @@ window_attach_surface(struct window *window)
return; return;
} }
switch (window->type) {
case TYPE_FULLSCREEN:
wl_shell_set_fullscreen(display->shell, window->surface);
break;
case TYPE_TOPLEVEL:
wl_shell_set_toplevel(display->shell, window->surface);
break;
case TYPE_TRANSIENT:
wl_shell_set_transient(display->shell, window->surface,
window->parent->surface,
window->x, window->y, 0);
break;
case TYPE_CUSTOM:
break;
}
wl_surface_damage(window->surface, 0, 0, wl_surface_damage(window->surface, 0, 0,
window->allocation.width, window->allocation.width,
window->allocation.height); window->allocation.height);
@ -1213,7 +1222,8 @@ window_handle_button(void *data,
location = get_pointer_location(window, input->sx, input->sy); location = get_pointer_location(window, input->sx, input->sy);
if (button == BTN_LEFT && state == 1) { if (window->display->shell &&
button == BTN_LEFT && state == 1) {
switch (location) { switch (location) {
case WINDOW_TITLEBAR: case WINDOW_TITLEBAR:
wl_shell_move(window->display->shell, wl_shell_move(window->display->shell,
@ -1407,8 +1417,9 @@ window_create_drag(struct window *window)
void void
window_move(struct window *window, struct input *input, uint32_t time) window_move(struct window *window, struct input *input, uint32_t time)
{ {
wl_shell_move(window->display->shell, if (window->display->shell)
window->surface, input->input_device, time); wl_shell_move(window->display->shell,
window->surface, input->input_device, time);
} }
void void

Loading…
Cancel
Save