## Aim
-[x] Support xwayland
-[ ] Support some of openbox's rc.xml
-[ ] Support openbox themes
-[ ] Support layer-shell's background layer
+- [x] Support xwayland
+- [ ] Support some of openbox's rc.xml
+- [ ] Support openbox themes
+- [ ] Support layer-shell's background layer
## Influenced by
### Debian
- sudo apt install \
- build-essential \
- cmake \
- libwayland-dev \
- wayland-protocols \
- libegl1-mesa-dev \
- libgles2-mesa-dev \
- libdrm-dev libgbm-dev \
- libinput-dev \
- libxkbcommon-dev \
- libudev-dev \
- libpixman-1-dev \
- libsystemd-dev \
- libcap-dev \
- libxcb1-dev \
- libxcb-composite0-dev \
- libxcb-xfixes0-dev \
- libxcb-xinput-dev \
- libxcb-image0-dev \
- libxcb-render-util0-dev \
- libx11-xcb-dev \
- libxcb-icccm4-dev \
- freerdp2-dev \
- libwinpr2-dev \
- libpng-dev \
- libavutil-dev \
- libavcodec-dev \
- libavformat-dev \
- universal-ctags \
- xwayland
-
- # Debian Buster has an old version of meson, so we use pip3
- pip3 install --target=$HOME/bin meson
-
- git clone https://github.com/johanmalm/labwc
- cd labwc
- git clone https://github.com/swaywm/wlroots subprojects/wlroots
-
- # wlroots 0.10.0 is the last version which runs with Wayland 0.16
- # (which is what Buster runs)
- cd subprojects/wlroots && git checkout 0.10.0 && cd ../..
-
- meson build
- ninja -C build
+```
+sudo apt install \
+ build-essential \
+ cmake \
+ libwayland-dev \
+ wayland-protocols \
+ libegl1-mesa-dev \
+ libgles2-mesa-dev \
+ libdrm-dev libgbm-dev \
+ libinput-dev \
+ libxkbcommon-dev \
+ libudev-dev \
+ libpixman-1-dev \
+ libsystemd-dev \
+ libcap-dev \
+ libxcb1-dev \
+ libxcb-composite0-dev \
+ libxcb-xfixes0-dev \
+ libxcb-xinput-dev \
+ libxcb-image0-dev \
+ libxcb-render-util0-dev \
+ libx11-xcb-dev \
+ libxcb-icccm4-dev \
+ freerdp2-dev \
+ libwinpr2-dev \
+ libpng-dev \
+ libavutil-dev \
+ libavcodec-dev \
+ libavformat-dev \
+ universal-ctags \
+ xwayland
+
+# Debian Buster has an old version of meson, so we use pip3
+pip3 install --target=$HOME/bin meson
+
+git clone https://github.com/johanmalm/labwc
+cd labwc
+git clone https://github.com/swaywm/wlroots subprojects/wlroots
+
+# wlroots 0.10.0 is the last version which runs with Wayland 0.16
+# (which is what Buster runs)
+cd subprojects/wlroots && git checkout 0.10.0 && cd ../..
+
+meson build
+ninja -C build
+```
## Debug
To enable ASAN and UBSAN, run meson with `-Db_sanitize=address,undefined`
+
bool view_want_deco(struct view *view);
void view_focus(struct view *view);
-void begin_interactive(struct view *view, enum cursor_mode mode,
- uint32_t edges);
struct view *view_front_toplevel(struct server *server);
struct view *next_toplevel(struct view *current);
struct view *view_at(struct server *server, double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy,
int *view_area);
+void begin_interactive(struct view *view, enum cursor_mode mode,
+ uint32_t edges);
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);
static bool in_alt_tab_mode;
static struct view *alt_tab_view;
+void begin_interactive(struct view *view, enum cursor_mode mode,
+ uint32_t edges)
+{
+ /* This function sets up an interactive move or resize operation, where
+ * the compositor stops propegating pointer events to clients and
+ * instead consumes them itself, to move or resize windows. */
+ struct server *server = view->server;
+ server->grabbed_view = view;
+ server->cursor_mode = mode;
+
+ if (mode == TINYWL_CURSOR_MOVE) {
+ server->grab_x = server->cursor->x - view->x;
+ server->grab_y = server->cursor->y - view->y;
+ } else {
+ struct wlr_box geo_box;
+ switch (view->type) {
+ case LAB_XDG_SHELL_VIEW:
+ wlr_xdg_surface_get_geometry(view->xdg_surface,
+ &geo_box);
+ break;
+ case LAB_XWAYLAND_VIEW:
+ geo_box.x = view->xwayland_surface->x;
+ geo_box.y = view->xwayland_surface->y;
+ geo_box.width = view->xwayland_surface->width;
+ geo_box.height = view->xwayland_surface->height;
+ break;
+ }
+
+ double border_x =
+ (view->x + geo_box.x) +
+ ((edges & WLR_EDGE_RIGHT) ? geo_box.width : 0);
+ double border_y =
+ (view->y + geo_box.y) +
+ ((edges & WLR_EDGE_BOTTOM) ? geo_box.height : 0);
+ server->grab_x = server->cursor->x - border_x;
+ server->grab_y = server->cursor->y - border_y;
+ server->grab_box = geo_box;
+ server->grab_box.x += view->x;
+ server->grab_box.y += view->y;
+ server->resize_edges = edges;
+ }
+}
+
static void keyboard_handle_modifiers(struct wl_listener *listener, void *data)
{
/* This event is raised when a modifier key, such as shift or alt, is
&keyboard->modifiers);
}
-void begin_interactive(struct view *view, enum cursor_mode mode, uint32_t edges)
-{
- /* This function sets up an interactive move or resize operation, where
- * the compositor stops propegating pointer events to clients and
- * instead consumes them itself, to move or resize windows. */
- struct server *server = view->server;
- server->grabbed_view = view;
- server->cursor_mode = mode;
-
- if (mode == TINYWL_CURSOR_MOVE) {
- server->grab_x = server->cursor->x - view->x;
- server->grab_y = server->cursor->y - view->y;
- } else {
- struct wlr_box geo_box;
- switch (view->type) {
- case LAB_XDG_SHELL_VIEW:
- wlr_xdg_surface_get_geometry(view->xdg_surface,
- &geo_box);
- break;
- case LAB_XWAYLAND_VIEW:
- geo_box.x = view->xwayland_surface->x;
- geo_box.y = view->xwayland_surface->y;
- geo_box.width = view->xwayland_surface->width;
- geo_box.height = view->xwayland_surface->height;
- break;
- }
-
- double border_x =
- (view->x + geo_box.x) +
- ((edges & WLR_EDGE_RIGHT) ? geo_box.width : 0);
- double border_y =
- (view->y + geo_box.y) +
- ((edges & WLR_EDGE_BOTTOM) ? geo_box.height : 0);
- server->grab_x = server->cursor->x - border_x;
- server->grab_y = server->cursor->y - border_y;
- server->grab_box = geo_box;
- server->grab_box.x += view->x;
- server->grab_box.y += view->y;
- server->resize_edges = edges;
- }
-}
-
struct view *view_front_toplevel(struct server *server)
{
struct view *view;