finished seperating opengl contexts, apply nishi patch

This commit is contained in:
IoIxD 2025-12-07 19:04:59 -07:00
commit 6f1716151d
12 changed files with 92 additions and 41 deletions

View file

@ -1,6 +1,7 @@
if(system("wayland-scanner -v >/dev/null 2>&1") == 0){
if (system("wayland-scanner -v >/dev/null 2>&1") == 0) {
use_backend("wayland", "x11");
} else {
}
else {
use_backend("x11");
}

View file

@ -29,12 +29,19 @@ if (grep(/^gdi$/, @backends)) {
if (grep(/^wayland$/, @backends)) {
add_cflags("-DUSE_WAYLAND");
new_object("src/backend/wayland.c");
add_libs("-lGL -lEGL -lwayland-egl -lwayland-client -lxkbcommon");
if ($cross) {
add_libs("-lGL -lEGL -lwayland-egl -lwayland-client -lxkbcommon");
}
else {
add_libs("-lGL -lEGL");
add_cflags(`pkg-config --cflags wayland-egl wayland-client xkbcommon`);
add_libs(`pkg-config --libs wayland-egl wayland-client xkbcommon`);
}
scan_wayland_protocol("stable", "xdg-shell","");
scan_wayland_protocol("stable", "tablet","-v2");
scan_wayland_protocol("staging", "cursor-shape","-v1");
scan_wayland_protocol("unstable", "xdg-decoration","-unstable-v1");
scan_wayland_protocol("stable", "xdg-shell", "");
scan_wayland_protocol("stable", "tablet", "-v2");
scan_wayland_protocol("staging", "cursor-shape", "-v1");
scan_wayland_protocol("unstable", "xdg-decoration", "-unstable-v1");
$gl_libs = "-lGL -lGLU";
}
@ -47,7 +54,10 @@ if (param_get("stb-truetype")) {
}
if (param_get("freetype2")) {
add_cflags("-DUSE_FREETYPE2");
if (not($cross)) {
if ($cross) {
add_libs("-lfreetype");
}
else {
add_cflags(`pkg-config --cflags freetype2`);
add_libs(`pkg-config --libs freetype2`);
}

View file

@ -55,20 +55,35 @@ sub use_backend {
}
sub scan_wayland_protocol {
my $tier = $_[0];
my $tier = $_[0];
my $proto = $_[1];
my $ver = $_[2];
my $ver = $_[2];
my $proto_c = "src/backend/wayland-${proto}-protocol.c";
if(system("wayland-scanner private-code /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml ${proto_c}") != 0) {
print("^ Error on getting private code for /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml\n");
} else {
if (
system(
"wayland-scanner private-code /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml ${proto_c}"
) != 0
)
{
print(
"^ Error on getting private code for /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml\n"
);
}
else {
new_object($proto_c);
};
if(system("wayland-scanner client-header /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml include/Mw/LowLevel/Wayland/${proto}-client-protocol.h")) {
print("^ Error on getting client header for /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml\n");
};
}
if (
system(
"wayland-scanner client-header /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml include/Mw/LowLevel/Wayland/${proto}-client-protocol.h"
)
)
{
print(
"^ Error on getting client header for /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml\n"
);
}
}
our %params = ();