mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
Updated for wlroots 0.15.0
This commit is contained in:
parent
309ccd2faf
commit
87c32d58ab
8 changed files with 36 additions and 13 deletions
|
|
@ -9,7 +9,7 @@ packages:
|
||||||
- libxkbcommon
|
- libxkbcommon
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/wizbright/waybox
|
- https://github.com/wizbright/waybox
|
||||||
- https://github.com/swaywm/wlroots
|
- https://gitlab.freedesktop.org/wlroots/wlroots
|
||||||
tasks:
|
tasks:
|
||||||
- wlroots: |
|
- wlroots: |
|
||||||
cd wlroots
|
cd wlroots
|
||||||
|
|
@ -21,4 +21,4 @@ tasks:
|
||||||
meson build
|
meson build
|
||||||
- build: |
|
- build: |
|
||||||
cd waybox
|
cd waybox
|
||||||
ninja -C build
|
ninja -C build
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Contributing to waybox
|
# Contributing to Waybox
|
||||||
|
|
||||||
Contributing just involves sending a pull request. You will probably be more
|
Contributing just involves sending a pull request. You will probably be more
|
||||||
successful with your contribution if you visit
|
successful with your contribution if you visit
|
||||||
|
|
@ -8,7 +8,8 @@ irc.freenode.net upfront and discuss your plans.
|
||||||
Note: rules are made to be broken. Adjust or ignore any/all of these as you see
|
Note: rules are made to be broken. Adjust or ignore any/all of these as you see
|
||||||
fit, but be prepared to justify it to your peers.
|
fit, but be prepared to justify it to your peers.
|
||||||
|
|
||||||
This was amended from [wlroots](https://github.com/swaywm/wlroots) for the most part
|
This was amended from [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
|
for the most part.
|
||||||
|
|
||||||
## Pull Requests
|
## Pull Requests
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ contributing.](https://github.com/wizbright/waybox/blob/master/CONTRIBUTING.md)
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
* meson
|
* [Meson](https://mesonbuild.com/)
|
||||||
* wlroots
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots/)
|
||||||
* wayland
|
* [Wayland](https://wayland.freedesktop.org/)
|
||||||
* xkbcommon
|
* [xkbcommon](https://xkbcommon.org/)
|
||||||
|
|
||||||
### Build instructions
|
### Build instructions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
|
#include <wlr/render/allocator.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
#include <wlr/render/wlr_texture.h>
|
#include <wlr/render/wlr_texture.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
|
|
@ -34,6 +35,7 @@ struct wb_server {
|
||||||
struct wlr_backend *backend;
|
struct wlr_backend *backend;
|
||||||
struct wlr_compositor *compositor;
|
struct wlr_compositor *compositor;
|
||||||
struct wlr_renderer *renderer;
|
struct wlr_renderer *renderer;
|
||||||
|
struct wlr_allocator *allocator;
|
||||||
|
|
||||||
struct wlr_output_layout *layout;
|
struct wlr_output_layout *layout;
|
||||||
struct wb_cursor *cursor;
|
struct wb_cursor *cursor;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ cc = meson.get_compiler('c')
|
||||||
# Adding include directory
|
# Adding include directory
|
||||||
inc_dir = include_directories('include')
|
inc_dir = include_directories('include')
|
||||||
|
|
||||||
wlroots = dependency('wlroots', version: '>=0.13.0')
|
# Due to the planned refactor of xdg_shell in wlroots 0.16.0, I doubt this will
|
||||||
|
# build when it's released
|
||||||
|
wlroots = dependency('wlroots', version: ['>=0.15.0', '<0.16.0'])
|
||||||
wayland_server = dependency('wayland-server', version: '>=1.15')
|
wayland_server = dependency('wayland-server', version: '>=1.15')
|
||||||
wayland_protos = dependency('wayland-protocols', version: '>=1.17')
|
wayland_protos = dependency('wayland-protocols', version: '>=1.17')
|
||||||
xkbcommon = dependency('xkbcommon')
|
xkbcommon = dependency('xkbcommon')
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,10 @@ void new_output_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_output *wlr_output = data;
|
struct wlr_output *wlr_output = data;
|
||||||
wlr_log(WLR_INFO, "%s: %s", _("New output device detected"), wlr_output->name);
|
wlr_log(WLR_INFO, "%s: %s", _("New output device detected"), wlr_output->name);
|
||||||
|
|
||||||
|
/* Configures the output created by the backend to use our allocator
|
||||||
|
* and our renderer */
|
||||||
|
wlr_output_init_render(wlr_output, server->allocator, server->renderer);
|
||||||
|
|
||||||
if (!wl_list_empty(&wlr_output->modes)) {
|
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_set_mode(wlr_output, mode);
|
||||||
|
|
|
||||||
|
|
@ -2,22 +2,36 @@
|
||||||
#include "waybox/xdg_shell.h"
|
#include "waybox/xdg_shell.h"
|
||||||
|
|
||||||
bool wb_create_backend(struct wb_server* server) {
|
bool wb_create_backend(struct wb_server* server) {
|
||||||
// create display
|
/* The Wayland display is managed by libwayland. It handles accepting
|
||||||
|
* clients from the Unix socket, manging Wayland globals, and so on. */
|
||||||
server->wl_display = wl_display_create();
|
server->wl_display = wl_display_create();
|
||||||
if (server->wl_display == NULL) {
|
if (server->wl_display == NULL) {
|
||||||
wlr_log(WLR_ERROR, "%s", _("Failed to connect to a Wayland display"));
|
wlr_log(WLR_ERROR, "%s", _("Failed to connect to a Wayland display"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create backend
|
/* The backend is a wlroots feature which abstracts the underlying input and
|
||||||
|
* output hardware. The autocreate option will choose the most suitable
|
||||||
|
* backend based on the current environment, such as opening an X11 window
|
||||||
|
* if an X11 server is running. */
|
||||||
server->backend = wlr_backend_autocreate(server->wl_display);
|
server->backend = wlr_backend_autocreate(server->wl_display);
|
||||||
if (server->backend == NULL) {
|
if (server->backend == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
server->renderer = wlr_backend_get_renderer(server->backend);
|
/* Autocreates a renderer, either Pixman, GLES2 or Vulkan for us. The user
|
||||||
|
* can also specify a renderer using the WLR_RENDERER env var.
|
||||||
|
* The renderer is responsible for defining the various pixel formats it
|
||||||
|
* supports for shared memory, this configures that for clients. */
|
||||||
|
server->renderer = wlr_renderer_autocreate(server->backend);
|
||||||
wlr_renderer_init_wl_display(server->renderer, server->wl_display);
|
wlr_renderer_init_wl_display(server->renderer, server->wl_display);
|
||||||
|
|
||||||
|
/* Autocreates an allocator for us.
|
||||||
|
* The allocator is the bridge between the renderer and the backend. It
|
||||||
|
* handles the buffer creation, allowing wlroots to render onto the
|
||||||
|
* screen */
|
||||||
|
server->allocator = wlr_allocator_autocreate(server->backend, server->renderer);
|
||||||
|
|
||||||
server->compositor = wlr_compositor_create(server->wl_display,
|
server->compositor = wlr_compositor_create(server->wl_display,
|
||||||
server->renderer);
|
server->renderer);
|
||||||
server->layout = wlr_output_layout_create();
|
server->layout = wlr_output_layout_create();
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ void focus_view(struct wb_view *view, struct wlr_surface *surface) {
|
||||||
struct wlr_xdg_surface *xdg_surface = wlr_xdg_surface_from_wlr_surface(surface);
|
struct wlr_xdg_surface *xdg_surface = wlr_xdg_surface_from_wlr_surface(surface);
|
||||||
if (xdg_surface)
|
if (xdg_surface)
|
||||||
wlr_log(WLR_INFO, "%s: %s", _("Keyboard focus is now on surface"),
|
wlr_log(WLR_INFO, "%s: %s", _("Keyboard focus is now on surface"),
|
||||||
wlr_xdg_surface_from_wlr_surface(surface)->toplevel->app_id);
|
xdg_surface->toplevel->app_id);
|
||||||
struct wb_server *server = view->server;
|
struct wb_server *server = view->server;
|
||||||
struct wlr_seat *seat = server->seat->seat;
|
struct wlr_seat *seat = server->seat->seat;
|
||||||
struct wlr_surface *prev_surface = seat->keyboard_state.focused_surface;
|
struct wlr_surface *prev_surface = seat->keyboard_state.focused_surface;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue