diff options
Diffstat (limited to 'tinywl')
-rw-r--r-- | tinywl/Makefile | 4 | ||||
-rw-r--r-- | tinywl/tinywl.c | 32 |
2 files changed, 17 insertions, 19 deletions
diff --git a/tinywl/Makefile b/tinywl/Makefile index 92d2a516..505666f0 100644 --- a/tinywl/Makefile +++ b/tinywl/Makefile @@ -20,8 +20,8 @@ tinywl: tinywl.c xdg-shell-protocol.h xdg-shell-protocol.c $(CC) $(CFLAGS) \ -g -Werror -I. \ -DWLR_USE_UNSTABLE \ - $(LIBS) \ - -o $@ $< + -o $@ $< \ + $(LIBS) clean: rm -f tinywl xdg-shell-protocol.h xdg-shell-protocol.c diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index 069f6451..14a1d08b 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -13,7 +13,6 @@ #include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_input_device.h> #include <wlr/types/wlr_keyboard.h> -#include <wlr/types/wlr_linux_dmabuf_v1.h> #include <wlr/types/wlr_matrix.h> #include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output_layout.h> @@ -91,12 +90,6 @@ struct tinywl_keyboard { struct wl_listener key; }; -struct tinywl_pointer { - struct wl_list link; - struct tinywl_server *server; - struct wlr_input_device *device; -}; - static void focus_view(struct tinywl_view *view, struct wlr_surface *surface) { /* Note: this function only deals with keyboard focus. */ if (view == NULL) { @@ -475,7 +468,7 @@ static void server_cursor_button(struct wl_listener *listener, void *data) { struct tinywl_server *server = wl_container_of(listener, server, cursor_button); struct wlr_event_pointer_button *event = data; - /* Notify the client with pointer focus that a button press has occured */ + /* Notify the client with pointer focus that a button press has occurred */ wlr_seat_pointer_notify_button(server->seat, event->time_msec, event->button, event->state); double sx, sy; @@ -552,7 +545,7 @@ static void render_surface(struct wlr_surface *surface, * Those familiar with OpenGL are also familiar with the role of matricies * in graphics programming. We need to prepare a matrix to render the view * with. wlr_matrix_project_box is a helper which takes a box with a desired - * x, y coodrinates, width and height, and an output geometry, then + * x, y coordinates, width and height, and an output geometry, then * prepares an orthographic projection and multiplies the necessary * transforms to produce a model-view-projection matrix. * @@ -617,6 +610,14 @@ static void output_frame(struct wl_listener *listener, void *data) { render_surface, &rdata); } + /* Hardware cursors are rendered by the GPU on a separate plane, and can be + * moved around without re-rendering what's beneath them - which is more + * efficient. However, not all hardware supports hardware cursors. For this + * reason, wlroots provides a software fallback, which we ask it to render + * here. wlr_cursor handles configuring hardware vs software cursors for you, + * and this function is a no-op when hardware cursors are in use. */ + wlr_output_render_software_cursors(output->wlr_output, NULL); + /* Conclude rendering and swap the buffers, showing the final frame * on-screen. */ wlr_renderer_end(renderer); @@ -717,7 +718,7 @@ static void xdg_toplevel_request_move( * move, typically because the user clicked on their client-side * decorations. Note that a more sophisticated compositor should check the * provied serial against a list of button press serials sent to this - * client, to prevent the client from requesting this whenver they want. */ + * client, to prevent the client from requesting this whenever they want. */ struct tinywl_view *view = wl_container_of(listener, view, request_move); begin_interactive(view, TINYWL_CURSOR_MOVE, 0); } @@ -728,7 +729,7 @@ static void xdg_toplevel_request_resize( * resize, typically because the user clicked on their client-side * decorations. Note that a more sophisticated compositor should check the * provied serial against a list of button press serials sent to this - * client, to prevent the client from requesting this whenver they want. */ + * client, to prevent the client from requesting this whenever they want. */ struct wlr_xdg_toplevel_resize_event *event = data; struct tinywl_view *view = wl_container_of(listener, view, request_resize); begin_interactive(view, TINYWL_CURSOR_RESIZE, event->edges); @@ -810,13 +811,10 @@ int main(int argc, char *argv[]) { wlr_renderer_init_wl_display(server.renderer, server.wl_display); /* This creates some hands-off wlroots interfaces. The compositor is - * necessary for clients to allocate surfaces, dmabuf allows them to use - * opaque GPU handles for buffers to avoid copying pixels on the CPU, and - * the data device manager handles the clipboard. Each of these wlroots - * interfaces has room for you to dig your fingers in and play with their - * behavior if you want. */ + * necessary for clients to allocate surfaces and the data device manager + * handles the clipboard. Each of these wlroots interfaces has room for you + * to dig your fingers in and play with their behavior if you want. */ wlr_compositor_create(server.wl_display, server.renderer); - wlr_linux_dmabuf_v1_create(server.wl_display, server.renderer); wlr_data_device_manager_create(server.wl_display); /* Creates an output layout, which a wlroots utility for working with an |