|
|
@ -15,7 +15,8 @@ static int signal_frame(void *data) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void parse_xcb_setup(struct wlr_output *output, xcb_connection_t *xcb_conn) {
|
|
|
|
static void parse_xcb_setup(struct wlr_output *output,
|
|
|
|
|
|
|
|
xcb_connection_t *xcb_conn) {
|
|
|
|
const xcb_setup_t *xcb_setup = xcb_get_setup(xcb_conn);
|
|
|
|
const xcb_setup_t *xcb_setup = xcb_get_setup(xcb_conn);
|
|
|
|
|
|
|
|
|
|
|
|
snprintf(output->make, sizeof(output->make), "%.*s",
|
|
|
|
snprintf(output->make, sizeof(output->make), "%.*s",
|
|
|
@ -26,8 +27,14 @@ static void parse_xcb_setup(struct wlr_output *output, xcb_connection_t *xcb_con
|
|
|
|
xcb_setup->protocol_minor_version);
|
|
|
|
xcb_setup->protocol_minor_version);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static struct wlr_x11_output *get_x11_output_from_output(
|
|
|
|
|
|
|
|
struct wlr_output *wlr_output) {
|
|
|
|
|
|
|
|
assert(wlr_output_is_x11(wlr_output));
|
|
|
|
|
|
|
|
return (struct wlr_x11_output *)wlr_output;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void output_set_refresh(struct wlr_output *wlr_output, int32_t refresh) {
|
|
|
|
static void output_set_refresh(struct wlr_output *wlr_output, int32_t refresh) {
|
|
|
|
struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output;
|
|
|
|
struct wlr_x11_output *output = get_x11_output_from_output(wlr_output);
|
|
|
|
|
|
|
|
|
|
|
|
if (refresh <= 0) {
|
|
|
|
if (refresh <= 0) {
|
|
|
|
refresh = X11_DEFAULT_REFRESH;
|
|
|
|
refresh = X11_DEFAULT_REFRESH;
|
|
|
@ -41,18 +48,20 @@ static void output_set_refresh(struct wlr_output *wlr_output, int32_t refresh) {
|
|
|
|
|
|
|
|
|
|
|
|
static bool output_set_custom_mode(struct wlr_output *wlr_output,
|
|
|
|
static bool output_set_custom_mode(struct wlr_output *wlr_output,
|
|
|
|
int32_t width, int32_t height, int32_t refresh) {
|
|
|
|
int32_t width, int32_t height, int32_t refresh) {
|
|
|
|
struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output;
|
|
|
|
struct wlr_x11_output *output = get_x11_output_from_output(wlr_output);
|
|
|
|
struct wlr_x11_backend *x11 = output->x11;
|
|
|
|
struct wlr_x11_backend *x11 = output->x11;
|
|
|
|
|
|
|
|
|
|
|
|
output_set_refresh(&output->wlr_output, refresh);
|
|
|
|
output_set_refresh(&output->wlr_output, refresh);
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t values[] = { width, height };
|
|
|
|
const uint32_t values[] = { width, height };
|
|
|
|
xcb_void_cookie_t cookie = xcb_configure_window_checked(x11->xcb_conn, output->win,
|
|
|
|
xcb_void_cookie_t cookie = xcb_configure_window_checked(
|
|
|
|
|
|
|
|
x11->xcb_conn, output->win,
|
|
|
|
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values);
|
|
|
|
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values);
|
|
|
|
|
|
|
|
|
|
|
|
xcb_generic_error_t *error;
|
|
|
|
xcb_generic_error_t *error;
|
|
|
|
if ((error = xcb_request_check(x11->xcb_conn, cookie))) {
|
|
|
|
if ((error = xcb_request_check(x11->xcb_conn, cookie))) {
|
|
|
|
wlr_log(WLR_ERROR, "Could not set window size to %dx%d\n", width, height);
|
|
|
|
wlr_log(WLR_ERROR, "Could not set window size to %dx%d\n",
|
|
|
|
|
|
|
|
width, height);
|
|
|
|
free(error);
|
|
|
|
free(error);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -62,12 +71,12 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output,
|
|
|
|
|
|
|
|
|
|
|
|
static void output_transform(struct wlr_output *wlr_output,
|
|
|
|
static void output_transform(struct wlr_output *wlr_output,
|
|
|
|
enum wl_output_transform transform) {
|
|
|
|
enum wl_output_transform transform) {
|
|
|
|
struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output;
|
|
|
|
struct wlr_x11_output *output = get_x11_output_from_output(wlr_output);
|
|
|
|
output->wlr_output.transform = transform;
|
|
|
|
output->wlr_output.transform = transform;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void output_destroy(struct wlr_output *wlr_output) {
|
|
|
|
static void output_destroy(struct wlr_output *wlr_output) {
|
|
|
|
struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output;
|
|
|
|
struct wlr_x11_output *output = get_x11_output_from_output(wlr_output);
|
|
|
|
struct wlr_x11_backend *x11 = output->x11;
|
|
|
|
struct wlr_x11_backend *x11 = output->x11;
|
|
|
|
|
|
|
|
|
|
|
|
wlr_input_device_destroy(&output->pointer_dev);
|
|
|
|
wlr_input_device_destroy(&output->pointer_dev);
|
|
|
@ -80,8 +89,9 @@ static void output_destroy(struct wlr_output *wlr_output) {
|
|
|
|
free(output);
|
|
|
|
free(output);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool output_make_current(struct wlr_output *wlr_output, int *buffer_age) {
|
|
|
|
static bool output_make_current(struct wlr_output *wlr_output,
|
|
|
|
struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output;
|
|
|
|
int *buffer_age) {
|
|
|
|
|
|
|
|
struct wlr_x11_output *output = get_x11_output_from_output(wlr_output);
|
|
|
|
struct wlr_x11_backend *x11 = output->x11;
|
|
|
|
struct wlr_x11_backend *x11 = output->x11;
|
|
|
|
|
|
|
|
|
|
|
|
return wlr_egl_make_current(&x11->egl, output->surf, buffer_age);
|
|
|
|
return wlr_egl_make_current(&x11->egl, output->surf, buffer_age);
|
|
|
@ -104,8 +114,7 @@ static const struct wlr_output_impl output_impl = {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
|
|
|
|
struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
|
|
|
|
assert(wlr_backend_is_x11(backend));
|
|
|
|
struct wlr_x11_backend *x11 = get_x11_backend_from_backend(backend);
|
|
|
|
struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!x11->started) {
|
|
|
|
if (!x11->started) {
|
|
|
|
++x11->requested_outputs;
|
|
|
|
++x11->requested_outputs;
|
|
|
@ -198,7 +207,8 @@ void handle_x11_configure_notify(struct wlr_x11_output *output,
|
|
|
|
// Move the pointer to its new location
|
|
|
|
// Move the pointer to its new location
|
|
|
|
update_x11_pointer_position(output, output->x11->time);
|
|
|
|
update_x11_pointer_position(output, output->x11->time);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
wlr_log(WLR_DEBUG,"Ignoring X11 configure event for height=%d, width=%d",
|
|
|
|
wlr_log(WLR_DEBUG,
|
|
|
|
|
|
|
|
"Ignoring X11 configure event for height=%d, width=%d",
|
|
|
|
ev->width, ev->height);
|
|
|
|
ev->width, ev->height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|