Some cleanup,
This commit is contained in:
parent
4a1550b7b0
commit
2bdbd01902
9 changed files with 60 additions and 64 deletions
|
@ -55,7 +55,6 @@ executable(
|
|||
'src/main.cpp',
|
||||
'src/main.c',
|
||||
'src/wlserver.c',
|
||||
'src/xwayland.c',
|
||||
dependencies : [
|
||||
dep_x11, dep_xdamage, dep_xcomposite, dep_xrender, dep_xext, dep_gl,
|
||||
dep_xxf86vm, pixman_dep, drm_dep, wlroots_dep, wayland_server,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "wlserver.h"
|
||||
|
||||
|
||||
#define C_SIDE
|
||||
|
||||
#include "main.hpp"
|
||||
#include "wlserver.h"
|
||||
|
||||
|
||||
static void xwayland_ready(struct wl_listener *listener,
|
||||
void *data) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "rootston.h"
|
||||
#include "wlserver.h"
|
||||
#include "steamcompmgr.h"
|
||||
|
||||
#include "main.hpp"
|
||||
|
@ -54,11 +54,11 @@ int main(int argc, char **argv)
|
|||
|
||||
initOutput();
|
||||
|
||||
rootston_init(argc, argv);
|
||||
wlserver_init(argc, argv);
|
||||
|
||||
register_signal();
|
||||
|
||||
rootston_run();
|
||||
wlserver_run();
|
||||
}
|
||||
|
||||
void steamCompMgrThreadRun(void)
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
extern "C" {
|
||||
|
||||
int rootston_init(int argc, char **argv);
|
||||
|
||||
int rootston_run(void);
|
||||
}
|
|
@ -57,12 +57,10 @@
|
|||
#include "GL/gl.h"
|
||||
#include "glext.h"
|
||||
|
||||
#include "wlr/xwayland.h"
|
||||
#include "wlserver.h"
|
||||
#include "xwayland.h"
|
||||
|
||||
#define C_SIDE
|
||||
|
||||
#include "main.hpp"
|
||||
#include "wlserver.h"
|
||||
|
||||
#define WAFFLE_API_VERSION 0x0106
|
||||
#include <waffle.h>
|
||||
|
|
|
@ -18,7 +18,38 @@
|
|||
|
||||
struct wlserver_t wlserver;
|
||||
|
||||
int rootston_init(int argc, char **argv) {
|
||||
static void xwayland_surface_role_commit(struct wlr_surface *wlr_surface) {
|
||||
assert(wlr_surface->role == &xwayland_surface_role);
|
||||
|
||||
struct wlr_texture *tex = wlr_surface_get_texture( wlr_surface );
|
||||
|
||||
struct wlr_dmabuf_attributes dmabuf_attribs = {};
|
||||
bool result = False;
|
||||
result = wlr_texture_to_dmabuf( tex, &dmabuf_attribs );
|
||||
|
||||
if (result == False)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
wayland_PushSurface( wlr_surface, &dmabuf_attribs );
|
||||
}
|
||||
|
||||
static void xwayland_surface_role_precommit(struct wlr_surface *wlr_surface) {
|
||||
assert(wlr_surface->role == &xwayland_surface_role);
|
||||
struct wlr_xwayland_surface *surface = wlr_surface->role_data;
|
||||
if (surface == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const struct wlr_surface_role xwayland_surface_role = {
|
||||
.name = "wlr_xwayland_surface",
|
||||
.commit = xwayland_surface_role_commit,
|
||||
.precommit = xwayland_surface_role_precommit,
|
||||
};
|
||||
|
||||
int wlserver_init(int argc, char **argv) {
|
||||
bool bIsDRM = False;
|
||||
|
||||
if ( getenv("DISPLAY") == NULL )
|
||||
|
@ -102,7 +133,7 @@ int rootston_init(int argc, char **argv) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rootston_run(void)
|
||||
int wlserver_run(void)
|
||||
{
|
||||
wl_display_run(wlserver.wl_display);
|
||||
// We need to shutdown Xwayland before disconnecting all clients, otherwise
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
// Only define wlserver_t on the C side, as wlroots can't build as C++
|
||||
#ifdef C_SIDE
|
||||
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/session.h>
|
||||
|
@ -28,3 +31,19 @@ struct wlserver_t {
|
|||
};
|
||||
|
||||
extern struct wlserver_t wlserver;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef C_SIDE
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const struct wlr_surface_role xwayland_surface_role;
|
||||
|
||||
int wlserver_init(int argc, char **argv);
|
||||
|
||||
int wlserver_run(void);
|
||||
|
||||
#ifndef C_SIDE
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/config.h>
|
||||
#include <wlr/types/wlr_box.h>
|
||||
#include <wlr/types/wlr_surface.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include <wlr/xwayland.h>
|
||||
#include "wlserver.h"
|
||||
#include "xwayland.h"
|
||||
|
||||
#define C_SIDE
|
||||
#include "main.hpp"
|
||||
|
||||
static void xwayland_surface_role_commit(struct wlr_surface *wlr_surface) {
|
||||
assert(wlr_surface->role == &xwayland_surface_role);
|
||||
|
||||
struct wlr_texture *tex = wlr_surface_get_texture( wlr_surface );
|
||||
|
||||
struct wlr_dmabuf_attributes dmabuf_attribs = {};
|
||||
bool result = False;
|
||||
result = wlr_texture_to_dmabuf( tex, &dmabuf_attribs );
|
||||
|
||||
if (result == False)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
wayland_PushSurface( wlr_surface, &dmabuf_attribs );
|
||||
}
|
||||
|
||||
static void xwayland_surface_role_precommit(struct wlr_surface *wlr_surface) {
|
||||
assert(wlr_surface->role == &xwayland_surface_role);
|
||||
struct wlr_xwayland_surface *surface = wlr_surface->role_data;
|
||||
if (surface == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const struct wlr_surface_role xwayland_surface_role = {
|
||||
.name = "wlr_xwayland_surface",
|
||||
.commit = xwayland_surface_role_commit,
|
||||
.precommit = xwayland_surface_role_precommit,
|
||||
};
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
extern const struct wlr_surface_role xwayland_surface_role;
|
Loading…
Reference in a new issue