|
|
@ -64,7 +64,6 @@ struct display { |
|
|
|
struct wl_shm *shm; |
|
|
|
struct wl_shm *shm; |
|
|
|
struct wl_output *output; |
|
|
|
struct wl_output *output; |
|
|
|
struct wl_data_device_manager *data_device_manager; |
|
|
|
struct wl_data_device_manager *data_device_manager; |
|
|
|
struct rectangle screen_allocation; |
|
|
|
|
|
|
|
EGLDisplay dpy; |
|
|
|
EGLDisplay dpy; |
|
|
|
EGLConfig rgb_config; |
|
|
|
EGLConfig rgb_config; |
|
|
|
EGLConfig premultiplied_argb_config; |
|
|
|
EGLConfig premultiplied_argb_config; |
|
|
@ -82,6 +81,7 @@ struct display { |
|
|
|
|
|
|
|
|
|
|
|
struct wl_list window_list; |
|
|
|
struct wl_list window_list; |
|
|
|
struct wl_list input_list; |
|
|
|
struct wl_list input_list; |
|
|
|
|
|
|
|
struct wl_list output_list; |
|
|
|
char *device_name; |
|
|
|
char *device_name; |
|
|
|
cairo_surface_t *active_frame, *inactive_frame, *shadow; |
|
|
|
cairo_surface_t *active_frame, *inactive_frame, *shadow; |
|
|
|
struct xkb_desc *xkb; |
|
|
|
struct xkb_desc *xkb; |
|
|
@ -162,6 +162,13 @@ struct input { |
|
|
|
struct data_offer *selection_offer; |
|
|
|
struct data_offer *selection_offer; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct output { |
|
|
|
|
|
|
|
struct display *display; |
|
|
|
|
|
|
|
struct wl_output *output; |
|
|
|
|
|
|
|
struct rectangle allocation; |
|
|
|
|
|
|
|
struct wl_list link; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
enum { |
|
|
|
POINTER_DEFAULT = 100, |
|
|
|
POINTER_DEFAULT = 100, |
|
|
|
POINTER_UNSET |
|
|
|
POINTER_UNSET |
|
|
@ -1789,15 +1796,17 @@ void |
|
|
|
window_set_fullscreen(struct window *window, int fullscreen) |
|
|
|
window_set_fullscreen(struct window *window, int fullscreen) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int32_t width, height; |
|
|
|
int32_t width, height; |
|
|
|
|
|
|
|
struct output *output; |
|
|
|
|
|
|
|
|
|
|
|
if ((window->type == TYPE_FULLSCREEN) == fullscreen) |
|
|
|
if ((window->type == TYPE_FULLSCREEN) == fullscreen) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (fullscreen) { |
|
|
|
if (fullscreen) { |
|
|
|
|
|
|
|
output = display_get_output(window->display); |
|
|
|
window->type = TYPE_FULLSCREEN; |
|
|
|
window->type = TYPE_FULLSCREEN; |
|
|
|
window->saved_allocation = window->allocation; |
|
|
|
window->saved_allocation = window->allocation; |
|
|
|
width = window->display->screen_allocation.width; |
|
|
|
width = output->allocation.width; |
|
|
|
height = window->display->screen_allocation.height; |
|
|
|
height = output->allocation.height; |
|
|
|
window->decoration = 0; |
|
|
|
window->decoration = 0; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
window->type = TYPE_TOPLEVEL; |
|
|
|
window->type = TYPE_TOPLEVEL; |
|
|
@ -2026,10 +2035,10 @@ display_handle_geometry(void *data, |
|
|
|
const char *make, |
|
|
|
const char *make, |
|
|
|
const char *model) |
|
|
|
const char *model) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct display *display = data; |
|
|
|
struct output *output = data; |
|
|
|
|
|
|
|
|
|
|
|
display->screen_allocation.x = x; |
|
|
|
output->allocation.x = x; |
|
|
|
display->screen_allocation.y = y; |
|
|
|
output->allocation.y = y; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
@ -2040,10 +2049,12 @@ display_handle_mode(void *data, |
|
|
|
int height, |
|
|
|
int height, |
|
|
|
int refresh) |
|
|
|
int refresh) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct display *display = data; |
|
|
|
struct output *output = data; |
|
|
|
|
|
|
|
|
|
|
|
display->screen_allocation.width = width; |
|
|
|
if (flags & WL_OUTPUT_MODE_CURRENT) { |
|
|
|
display->screen_allocation.height = height; |
|
|
|
output->allocation.width = width; |
|
|
|
|
|
|
|
output->allocation.height = height; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static const struct wl_output_listener output_listener = { |
|
|
|
static const struct wl_output_listener output_listener = { |
|
|
@ -2051,6 +2062,30 @@ static const struct wl_output_listener output_listener = { |
|
|
|
display_handle_mode |
|
|
|
display_handle_mode |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
|
|
|
display_add_output(struct display *d, uint32_t id) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
struct output *output; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output = malloc(sizeof *output); |
|
|
|
|
|
|
|
if (output == NULL) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(output, 0, sizeof *output); |
|
|
|
|
|
|
|
output->display = d; |
|
|
|
|
|
|
|
output->output = |
|
|
|
|
|
|
|
wl_display_bind(d->display, id, &wl_output_interface); |
|
|
|
|
|
|
|
wl_list_insert(d->output_list.prev, &output->link); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wl_output_add_listener(output->output, &output_listener, output); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
|
|
|
output_get_allocation(struct output *output, struct rectangle *allocation) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
*allocation = output->allocation; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
display_add_input(struct display *d, uint32_t id) |
|
|
|
display_add_input(struct display *d, uint32_t id) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -2089,8 +2124,7 @@ display_handle_global(struct wl_display *display, uint32_t id, |
|
|
|
d->compositor = |
|
|
|
d->compositor = |
|
|
|
wl_display_bind(display, id, &wl_compositor_interface); |
|
|
|
wl_display_bind(display, id, &wl_compositor_interface); |
|
|
|
} else if (strcmp(interface, "wl_output") == 0) { |
|
|
|
} else if (strcmp(interface, "wl_output") == 0) { |
|
|
|
d->output = wl_display_bind(display, id, &wl_output_interface); |
|
|
|
display_add_output(d, id); |
|
|
|
wl_output_add_listener(d->output, &output_listener, d); |
|
|
|
|
|
|
|
} else if (strcmp(interface, "wl_input_device") == 0) { |
|
|
|
} else if (strcmp(interface, "wl_input_device") == 0) { |
|
|
|
display_add_input(d, id); |
|
|
|
display_add_input(d, id); |
|
|
|
} else if (strcmp(interface, "wl_shell") == 0) { |
|
|
|
} else if (strcmp(interface, "wl_shell") == 0) { |
|
|
@ -2309,6 +2343,7 @@ display_create(int *argc, char **argv[], const GOptionEntry *option_entries) |
|
|
|
|
|
|
|
|
|
|
|
wl_list_init(&d->deferred_list); |
|
|
|
wl_list_init(&d->deferred_list); |
|
|
|
wl_list_init(&d->input_list); |
|
|
|
wl_list_init(&d->input_list); |
|
|
|
|
|
|
|
wl_list_init(&d->output_list); |
|
|
|
|
|
|
|
|
|
|
|
/* Set up listener so we'll catch all events. */ |
|
|
|
/* Set up listener so we'll catch all events. */ |
|
|
|
wl_display_add_global_listener(d->display, |
|
|
|
wl_display_add_global_listener(d->display, |
|
|
@ -2341,6 +2376,12 @@ display_get_display(struct display *display) |
|
|
|
return display->display; |
|
|
|
return display->display; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct output * |
|
|
|
|
|
|
|
display_get_output(struct display *display) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return container_of(display->output_list.next, struct output, link); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
struct wl_compositor * |
|
|
|
struct wl_compositor * |
|
|
|
display_get_compositor(struct display *display) |
|
|
|
display_get_compositor(struct display *display) |
|
|
|
{ |
|
|
|
{ |
|
|
|