diff options
Diffstat (limited to 'backend/x11')
-rw-r--r-- | backend/x11/backend.c | 2 | ||||
-rw-r--r-- | backend/x11/meson.build | 44 | ||||
-rw-r--r-- | backend/x11/output.c | 23 |
3 files changed, 62 insertions, 7 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c index e0f5d6e7..0ff2925d 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -163,6 +163,8 @@ static bool backend_start(struct wlr_backend *backend) { 0, 0, 0); + + free(reply); } } #endif diff --git a/backend/x11/meson.build b/backend/x11/meson.build new file mode 100644 index 00000000..1164df1e --- /dev/null +++ b/backend/x11/meson.build @@ -0,0 +1,44 @@ +x11_libs = [] +x11_required = [ + 'xcb', + 'x11-xcb', +] +x11_optional = [ + 'xcb-xkb', +] + +foreach lib : x11_required + dep = dependency(lib, required: get_option('x11-backend')) + if not dep.found() + subdir_done() + endif + + x11_libs += dep +endforeach + +foreach lib : x11_optional + dep = dependency(lib, required: get_option(lib)) + if dep.found() + x11_libs += dep + conf_data.set('WLR_HAS_' + lib.underscorify().to_upper(), true) + endif +endforeach + +lib_wlr_backend_x11 = static_library( + 'wlr_backend_x11', + files( + 'backend.c', + 'input_device.c', + 'output.c', + ), + include_directories: wlr_inc, + dependencies: [ + wayland_server, + pixman, + xkbcommon, + x11_libs, + ], +) + +backend_parts += lib_wlr_backend_x11 +conf_data.set('WLR_HAS_X11_BACKEND', true) diff --git a/backend/x11/output.c b/backend/x11/output.c index 151807dd..b678296d 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -121,6 +121,9 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { struct wlr_output *wlr_output = &output->wlr_output; wlr_output_init(wlr_output, &x11->backend, &output_impl, x11->wl_display); + wlr_output->width = 1024; + wlr_output->height = 768; + output_set_refresh(&output->wlr_output, 0); snprintf(wlr_output->name, sizeof(wlr_output->name), "X11-%d", @@ -137,8 +140,8 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { }; output->win = xcb_generate_id(x11->xcb_conn); xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win, - x11->screen->root, 0, 0, 1024, 768, 1, XCB_WINDOW_CLASS_INPUT_OUTPUT, - x11->screen->root_visual, mask, values); + x11->screen->root, 0, 0, wlr_output->width, wlr_output->height, 1, + XCB_WINDOW_CLASS_INPUT_OUTPUT, x11->screen->root_visual, mask, values); output->surf = wlr_egl_create_surface(&x11->egl, &output->win); if (!output->surf) { @@ -187,11 +190,17 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { void handle_x11_configure_notify(struct wlr_x11_output *output, xcb_configure_notify_event_t *ev) { - wlr_output_update_custom_mode(&output->wlr_output, ev->width, - ev->height, output->wlr_output.refresh); - - // Move the pointer to its new location - update_x11_pointer_position(output, output->x11->time); + // ignore events that set an invalid size: + if (ev->width > 0 && ev->height > 0) { + wlr_output_update_custom_mode(&output->wlr_output, ev->width, + ev->height, output->wlr_output.refresh); + + // Move the pointer to its new location + update_x11_pointer_position(output, output->x11->time); + } else { + wlr_log(WLR_DEBUG,"Ignoring X11 configure event for height=%d, width=%d", + ev->width, ev->height); + } } bool wlr_output_is_x11(struct wlr_output *wlr_output) { |