mirror of
https://github.com/labwc/labwc.git
synced 2026-02-08 10:06:59 -05:00
Make xwayland support optional
This commit is contained in:
parent
cd9fe2900e
commit
cfc6e18cdc
10 changed files with 75 additions and 10 deletions
|
|
@ -1,3 +1,4 @@
|
|||
#include "config.h"
|
||||
#include <assert.h>
|
||||
#include "labwc.h"
|
||||
|
||||
|
|
@ -8,6 +9,7 @@ move_to_front(struct view *view)
|
|||
wl_list_insert(&view->server->views, &view->link);
|
||||
}
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
static struct wlr_xwayland_surface *
|
||||
top_parent_of(struct view *view)
|
||||
{
|
||||
|
|
@ -44,6 +46,7 @@ move_xwayland_sub_views_to_front(struct view *parent)
|
|||
/* TODO: we should probably focus on these too here */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Activate/deactivate toplevel surface */
|
||||
static void
|
||||
|
|
@ -56,10 +59,12 @@ set_activated(struct wlr_surface *surface, bool activated)
|
|||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +92,9 @@ desktop_focus_view(struct seat *seat, struct view *view)
|
|||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -200,10 +207,12 @@ _view_at(struct view *view, double lx, double ly, struct wlr_surface **surface,
|
|||
_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) {
|
||||
|
|
|
|||
|
|
@ -13,10 +13,16 @@ labwc_sources = files(
|
|||
'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')
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
#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)
|
||||
{
|
||||
|
|
@ -19,6 +21,7 @@ xwl_nr_parents(struct view *view)
|
|||
}
|
||||
return i;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
show_one_xdg_view(struct view *view)
|
||||
|
|
@ -41,6 +44,7 @@ show_one_xdg_view(struct view *view)
|
|||
view->h);
|
||||
}
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
static void
|
||||
show_one_xwl_view(struct view *view)
|
||||
{
|
||||
|
|
@ -69,6 +73,7 @@ show_one_xwl_view(struct view *view)
|
|||
* view->xwayland_surface->surface->sy);
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
dbg_show_one_view(struct view *view)
|
||||
|
|
@ -81,8 +86,10 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include "config.h"
|
||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||
#include "labwc.h"
|
||||
#include "menu/menu.h"
|
||||
|
|
@ -367,6 +368,7 @@ output_frame_notify(struct wl_listener *listener, void *data)
|
|||
/* 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,
|
||||
|
|
@ -383,6 +385,7 @@ output_frame_notify(struct wl_listener *listener, void *data)
|
|||
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]);
|
||||
|
|
|
|||
11
src/server.c
11
src/server.c
|
|
@ -1,4 +1,5 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include "config.h"
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
#include <wlr/types/wlr_data_control_v1.h>
|
||||
|
|
@ -175,6 +176,7 @@ server_init(struct server *server)
|
|||
|
||||
layers_init(server);
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
/* Init xwayland */
|
||||
server->xwayland =
|
||||
wlr_xwayland_create(server->wl_display, compositor, true);
|
||||
|
|
@ -192,11 +194,13 @@ server_init(struct server *server)
|
|||
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);
|
||||
|
|
@ -207,6 +211,7 @@ server_init(struct server *server)
|
|||
image->height, image->hotspot_x,
|
||||
image->hotspot_y);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -237,13 +242,17 @@ server_start(struct server *server)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue