- wlroots (>=0.11.0)
- wayland (>=1.16)
- wayland-protocols
-- xwayland
+- xwayland, xcb (optional)
- libinput (>=1.14)
- libxml2
- cairo, pango, glib-2.0
- xcb
- xkbcommon
+Disable xwayland with `meson -Dxwayland=disabled build`
+
For further details see [wiki/Build](https://github.com/johanmalm/labwc/wiki/Build).
## 3. Configure
No acceptance criteria exists, but the following list indicates the inteded high level roadmap:
-- [x] Support xwayland
+- [x] Optionally support xwayland
- [x] Parse openbox config files (rc.xml, autostart, environment)
- [x] Parse openbox themes files and associated xbm icons
- [x] Show maximize, iconify, close buttons
- [x] Catch SIGHUP to re-load config file and theme
- [x] Support layer-shell protocol ('exclusive' not yet implemented)
- [ ] Support root-menu and parse menu.xml (very simple implementation, not submenus yet)
+- [ ] Support damage tracking to reduce CPU usage
- [ ] Support 'maximize'
- [ ] Support wlr-output-management protocol and [kanshi](https://github.com/emersion/kanshi.git)
-- [ ] Show window title
- [ ] Support foreign-toplevel protocol (e.g. to integrate with wlroots panels/bars)
-- [ ] Support damage tracking to reduce CPU usage
- [ ] Implement client-menu
- [ ] Support on-screen display (osd), for example to support alt-tab window list
- [ ] Support HiDPI
+- [ ] Support libinput configuration (tap is enabled for the time being)
## 7. Scope
#ifndef __LABWC_H
#define __LABWC_H
-
+#include "config.h"
#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <wlr/types/wlr_xdg_decoration_v1.h>
#include <wlr/types/wlr_xdg_shell.h>
#include <wlr/util/log.h>
+#if HAVE_XWAYLAND
#include <wlr/xwayland.h>
+#endif
#include <xkbcommon/xkbcommon.h>
#include "common/log.h"
struct wl_listener new_layer_surface;
struct wl_listener xdg_toplevel_decoration;
+#if HAVE_XWAYLAND
struct wlr_xwayland *xwayland;
struct wl_listener new_xwayland_surface;
+#endif
struct wl_list views;
struct wl_list unmanaged_surfaces;
struct wl_listener destroy;
};
-enum view_type { LAB_XDG_SHELL_VIEW, LAB_XWAYLAND_VIEW };
+enum view_type {
+ LAB_XDG_SHELL_VIEW,
+#if HAVE_XWAYLAND
+ LAB_XWAYLAND_VIEW,
+#endif
+};
enum deco_part {
LAB_DECO_NONE = 0,
union {
struct wlr_xdg_surface *xdg_surface;
+#if HAVE_XWAYLAND
struct wlr_xwayland_surface *xwayland_surface;
+#endif
};
struct wlr_surface *surface;
struct wl_listener request_configure;
};
+#if HAVE_XWAYLAND
struct xwayland_unmanaged {
struct server *server;
struct wlr_xwayland_surface *xwayland_surface;
struct wl_listener unmap;
struct wl_listener destroy;
};
+#endif
void xdg_toplevel_decoration(struct wl_listener *listener, void *data);
void xdg_surface_new(struct wl_listener *listener, void *data);
+#if HAVE_XWAYLAND
void xwayland_surface_new(struct wl_listener *listener, void *data);
void xwayland_unmanaged_create(struct server *server,
struct wlr_xwayland_surface *xsurface);
+#endif
void view_move_resize(struct view *view, struct wlr_box geo);
void view_move(struct view *view, double x, double y);
--- /dev/null
+configure_file(output: 'config.h', configuration: conf_data)
if wlroots_proj.found()
wlroots = wlroots_proj.get_variable('wlroots')
+ wlroots_conf = wlroots_proj.get_variable('conf_data')
+ wlroots_has_xwayland = wlroots_conf.get('WLR_HAS_XWAYLAND') == 1
else
- wlroots = dependency('wlroots', version: '>= 0.10.0')
+ wlroots = dependency('wlroots', version: '>= 0.11.0')
+ wlroots_has_xwayland = cc.get_define('WLR_HAS_XWAYLAND', prefix: '#include <wlr/config.h>', dependencies: wlroots) == '1'
endif
wayland_server = dependency('wayland-server')
wayland_protos = dependency('wayland-protocols')
xkbcommon = dependency('xkbcommon')
+xcb = dependency('xcb', required: get_option('xwayland'))
xml2 = dependency('libxml-2.0')
glib = dependency('glib-2.0')
cairo = dependency('cairo')
pangocairo = dependency('pangocairo')
+if get_option('xwayland').enabled() and not wlroots_has_xwayland
+ error('no wlroots Xwayland support')
+endif
+have_xwayland = xcb.found() and wlroots_has_xwayland
+conf_data = configuration_data()
+conf_data.set10('HAVE_XWAYLAND', have_xwayland)
+
labwc_inc = include_directories('include')
subdir('protocols')
cairo, pangocairo
]
+subdir('include')
subdir('src')
subdir('docs')
--- /dev/null
+option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
+#include "config.h"
#include <assert.h>
#include "labwc.h"
wl_list_insert(&view->server->views, &view->link);
}
+#if HAVE_XWAYLAND
static struct wlr_xwayland_surface *
top_parent_of(struct view *view)
{
/* TODO: we should probably focus on these too here */
}
}
+#endif
/* Activate/deactivate toplevel surface */
static void
struct wlr_xdg_surface *s;
s = wlr_xdg_surface_from_wlr_surface(surface);
wlr_xdg_toplevel_set_activated(s, activated);
+#if HAVE_XWAYLAND
} else if (wlr_surface_is_xwayland_surface(surface)) {
struct wlr_xwayland_surface *s;
s = wlr_xwayland_surface_from_wlr_surface(surface);
wlr_xwayland_surface_activate(s, activated);
+#endif
}
}
move_to_front(view);
set_activated(view->surface, true);
seat_focus_surface(seat, view->surface);
+#if HAVE_XWAYLAND
move_xwayland_sub_views_to_front(view);
+#endif
}
}
_surface = wlr_xdg_surface_surface_at(
view->xdg_surface, view_sx, view_sy, &_sx, &_sy);
break;
+#if HAVE_XWAYLAND
case LAB_XWAYLAND_VIEW:
_surface = wlr_surface_surface_at(view->surface, view_sx,
view_sy, &_sx, &_sy);
break;
+#endif
}
if (_surface) {
'server.c',
'view.c',
'xdg.c',
- 'xwayland.c',
- 'xwayland-unmanaged.c',
)
+if have_xwayland
+ labwc_sources += files(
+ 'xwayland.c',
+ 'xwayland-unmanaged.c',
+ )
+endif
+
+
subdir('common')
subdir('config')
subdir('theme')
+#include "config.h"
#include "common/log.h"
#include "config/keybind.h"
#include "config/rcxml.h"
#include "labwc.h"
+#if HAVE_XWAYLAND
static int
xwl_nr_parents(struct view *view)
{
}
return i;
}
+#endif
static void
show_one_xdg_view(struct view *view)
view->h);
}
+#if HAVE_XWAYLAND
static void
show_one_xwl_view(struct view *view)
{
* view->xwayland_surface->surface->sy);
*/
}
+#endif
void
dbg_show_one_view(struct view *view)
}
if (view->type == LAB_XDG_SHELL_VIEW) {
show_one_xdg_view(view);
+#if HAVE_XWAYLAND
} else if (view->type == LAB_XWAYLAND_VIEW) {
show_one_xwl_view(view);
+#endif
}
}
#define _POSIX_C_SOURCE 200809L
+#include "config.h"
#include <wlr/types/wlr_xdg_output_v1.h>
#include "labwc.h"
#include "menu/menu.h"
/* If in cycle (alt-tab) mode, highlight selected view */
render_cycle_box(output);
+#if HAVE_XWAYLAND
/* Render xwayland override_redirect surfaces */
struct xwayland_unmanaged *unmanaged;
wl_list_for_each_reverse (unmanaged,
struct wlr_surface *s = unmanaged->xwayland_surface->surface;
render_surface(s, 0, 0, &rdata);
}
+#endif
render_layer(&now, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
render_layer(&now, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
#define _POSIX_C_SOURCE 200809L
+#include "config.h"
#include <signal.h>
#include <sys/wait.h>
#include <wlr/types/wlr_data_control_v1.h>
layers_init(server);
+#if HAVE_XWAYLAND
/* Init xwayland */
server->xwayland =
wlr_xwayland_create(server->wl_display, compositor, true);
wlr_log(WLR_DEBUG, "xwayland is running on display %s",
server->xwayland->display_name);
}
+#endif
if (!wlr_xcursor_manager_load(server->seat.xcursor_manager, 1)) {
- wlr_log(WLR_ERROR, "cannot load xwayland xcursor theme");
+ wlr_log(WLR_ERROR, "cannot load xcursor theme");
}
+#if HAVE_XWAYLAND
struct wlr_xcursor *xcursor;
xcursor = wlr_xcursor_manager_get_xcursor(server->seat.xcursor_manager,
XCURSOR_DEFAULT, 1);
image->height, image->hotspot_x,
image->hotspot_y);
}
+#endif
}
void
wl_display_init_shm(server->wl_display);
+#if HAVE_XWAYLAND
wlr_xwayland_set_seat(server->xwayland, server->seat.seat);
+#endif
}
void
server_finish(struct server *server)
{
+#if HAVE_XWAYLAND
wlr_xwayland_destroy(server->xwayland);
+#endif
if (sighup_source) {
wl_event_source_remove(sighup_source);
}