{
struct wlr_box box = { .x = 0, .y = 0, .width = 0, .height = 0 };
if (!view)
- return;
+ return box;
switch (deco_part) {
case LAB_DECO_PART_TOP:
box.x = view->x - XWL_WINDOW_BORDER;
box.y = view->y - XWL_TITLEBAR_HEIGHT - XWL_WINDOW_BORDER;
- box.width = view->surface->current.width + 2 * XWL_WINDOW_BORDER;
+ box.width =
+ view->surface->current.width + 2 * XWL_WINDOW_BORDER;
box.height = XWL_TITLEBAR_HEIGHT + XWL_WINDOW_BORDER;
break;
+ default:
+ break;
}
return box;
}
return LAB_DECO_PART_TOP;
return LAB_DECO_NONE;
}
-
struct wlr_seat *seat;
struct wl_listener new_input;
struct wl_listener request_cursor;
+ struct wl_listener request_set_selection;
struct wl_list keyboards;
enum cursor_mode cursor_mode;
struct view *grabbed_view;
enum view_type { LAB_XDG_SHELL_VIEW, LAB_XWAYLAND_VIEW };
-enum deco_part {
- LAB_DECO_NONE,
- LAB_DECO_PART_TOP
-};
+enum deco_part { LAB_DECO_NONE, LAB_DECO_PART_TOP };
struct view {
enum view_type type;
void server_new_input(struct wl_listener *listener, void *data);
void seat_request_cursor(struct wl_listener *listener, void *data);
+void seat_request_set_selection(struct wl_listener *listener, void *data);
void server_cursor_motion(struct wl_listener *listener, void *data);
void server_cursor_motion_absolute(struct wl_listener *listener, void *data);
void server_cursor_button(struct wl_listener *listener, void *data);
* room for you to dig your fingers in and play with their behavior if
* you want.
*/
- server.compositor = wlr_compositor_create(server.wl_display,
- server.renderer);
+ server.compositor =
+ wlr_compositor_create(server.wl_display, server.renderer);
if (!server.compositor) {
wlr_log(WLR_ERROR, "unable to create the wlroots compositor");
return 1;
server.request_cursor.notify = seat_request_cursor;
wl_signal_add(&server.seat->events.request_set_cursor,
&server.request_cursor);
+ server.request_set_selection.notify = seat_request_set_selection;
+ wl_signal_add(&server.seat->events.request_set_selection,
+ &server.request_set_selection);
/* Init xdg-shell */
server.xdg_shell = wlr_xdg_shell_create(server.wl_display);
wl_signal_add(&server.xwayland->events.new_surface,
&server.new_xwayland_surface);
- server.cursor_mgr = wlr_xcursor_manager_create(XCURSOR_DEFAULT,
- XCURSOR_SIZE);
+ server.cursor_mgr =
+ wlr_xcursor_manager_create(XCURSOR_DEFAULT, XCURSOR_SIZE);
if (!server.cursor_mgr) {
wlr_log(WLR_ERROR, "cannot create xwayland xcursor manager");
return 1;
}
if (setenv("DISPLAY", server.xwayland->display_name, true) < 0)
- wlr_log_errno(WLR_ERROR, "Unable to set DISPLAY for XWayland."
- " Clients may not be able to connect");
+ wlr_log_errno(WLR_ERROR, "unable to set DISPLAY for xwayland");
else
- wlr_log(WLR_DEBUG, "XWayland is running on display %s",
+ wlr_log(WLR_DEBUG, "xwayland is running on display %s",
server.xwayland->display_name);
if (wlr_xcursor_manager_load(server.cursor_mgr, 1))
wlr_log(WLR_ERROR, "cannot load xwayland xcursor theme");
struct wlr_xcursor *xcursor;
- xcursor = wlr_xcursor_manager_get_xcursor(server.cursor_mgr,
+ xcursor = wlr_xcursor_manager_get_xcursor(server.cursor_mgr,
XCURSOR_DEFAULT, 1);
if (xcursor) {
struct wlr_xcursor_image *image = xcursor->images[0];
}
}
+void seat_request_set_selection(struct wl_listener *listener, void *data)
+{
+ struct server *server =
+ wl_container_of(listener, server, request_set_selection);
+ struct wlr_seat_request_set_selection_event *event = data;
+ wlr_seat_set_selection(server->seat, event->source, event->serial);
+}
+
static void process_cursor_move(struct server *server, uint32_t time)
{
/* Move the grabbed view to the new position. */
server->grabbed_view->y,
view->xwayland_surface->width,
view->xwayland_surface->height);
-
}
}
* TODO: support user configuration
*/
if (!wl_list_empty(&wlr_output->modes)) {
- struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output);
+ struct wlr_output_mode *mode =
+ wlr_output_preferred_mode(wlr_output);
wlr_output_set_mode(wlr_output, mode);
wlr_output_enable(wlr_output, true);
if (!wlr_output_commit(wlr_output)) {
* sophisticated compositor would let the user configure the arrangement
* of outputs in the layout.
*
- * The output layout utility automatically adds a wl_output global to the
- * display, which Wayland clients can see to find out information about the
- * output (such as DPI, scale factor, manufacturer, etc).
+ * The output layout utility automatically adds a wl_output global to
+ * the display, which Wayland clients can see to find out information
+ * about the output (such as DPI, scale factor, manufacturer, etc).
*/
wlr_output_layout_add_auto(server->output_layout, wlr_output);
}