forked from pyrite-dev/milsko
Compare commits
No commits in common. "49a0f08f61837c05750d81e94251f6d1546c1c5f" and "6f331d613d194c592ffcd0b6e15072a543df75ca" have entirely different histories.
49a0f08f61
...
6f331d613d
19 changed files with 12 additions and 1424 deletions
1
.clangd
1
.clangd
|
|
@ -1 +0,0 @@
|
||||||
header-insertion: never
|
|
||||||
|
|
@ -25,8 +25,7 @@ typedef void* MwLLPixmap;
|
||||||
|
|
||||||
enum MwLLBackends {
|
enum MwLLBackends {
|
||||||
MwLLBackendX11 = 0,
|
MwLLBackendX11 = 0,
|
||||||
MwLLBackendGDI,
|
MwLLBackendGDI
|
||||||
MwLLBackendWayland,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MwLLCommon {
|
struct _MwLLCommon {
|
||||||
|
|
@ -56,9 +55,6 @@ struct _MwLLCommonPixmap {
|
||||||
#ifdef USE_GDI
|
#ifdef USE_GDI
|
||||||
#include <Mw/LowLevel/GDI.h>
|
#include <Mw/LowLevel/GDI.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
#include <Mw/LowLevel/Wayland.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
union _MwLL {
|
union _MwLL {
|
||||||
struct _MwLLCommon common;
|
struct _MwLLCommon common;
|
||||||
|
|
@ -68,9 +64,6 @@ union _MwLL {
|
||||||
#ifdef USE_GDI
|
#ifdef USE_GDI
|
||||||
struct _MwLLGDI gdi;
|
struct _MwLLGDI gdi;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
struct _MwLLWayland wayland;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
union _MwLLColor {
|
union _MwLLColor {
|
||||||
|
|
@ -81,9 +74,6 @@ union _MwLLColor {
|
||||||
#ifdef USE_GDI
|
#ifdef USE_GDI
|
||||||
struct _MwLLGDIColor gdi;
|
struct _MwLLGDIColor gdi;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
struct _MwLLWaylandColor wayland;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
union _MwLLPixmap {
|
union _MwLLPixmap {
|
||||||
|
|
@ -94,9 +84,6 @@ union _MwLLPixmap {
|
||||||
#ifdef USE_GDI
|
#ifdef USE_GDI
|
||||||
struct _MwLLGDIPixmap gdi;
|
struct _MwLLGDIPixmap gdi;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
struct _MwLLWaylandPixmap wayland;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#include <Mw/TypeDefs.h>
|
#include <Mw/TypeDefs.h>
|
||||||
|
|
@ -162,8 +149,6 @@ MWDECL void (*MwLLDestroy)(MwLL handle);
|
||||||
|
|
||||||
MWDECL void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
|
MWDECL void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
|
||||||
MWDECL void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color);
|
MWDECL void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color);
|
||||||
MWDECL void (*MwLLBeginDraw)(MwLL handle);
|
|
||||||
MWDECL void (*MwLLEndDraw)(MwLL handle);
|
|
||||||
|
|
||||||
MWDECL MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b);
|
MWDECL MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b);
|
||||||
MWDECL void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b);
|
MWDECL void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b);
|
||||||
|
|
|
||||||
|
|
@ -1,120 +0,0 @@
|
||||||
/*!
|
|
||||||
* @file Mw/LowLevel/Wayland.h
|
|
||||||
* @brief Wayland Backend
|
|
||||||
* @warning This is used internally
|
|
||||||
*/
|
|
||||||
#ifndef __MW_LOWLEVEL_WAYLAND_H__
|
|
||||||
#define __MW_LOWLEVEL_WAYLAND_H__
|
|
||||||
|
|
||||||
#include <Mw/MachDep.h>
|
|
||||||
#include <Mw/TypeDefs.h>
|
|
||||||
#include <Mw/LowLevel.h>
|
|
||||||
|
|
||||||
#include <wayland-client-protocol.h>
|
|
||||||
#include <wayland-egl.h>
|
|
||||||
#include <EGL/egl.h>
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glext.h>
|
|
||||||
|
|
||||||
#include <wayland-client.h>
|
|
||||||
#include <xkbcommon/xkbcommon.h>
|
|
||||||
|
|
||||||
MWDECL int MwLLWaylandCallInit(void);
|
|
||||||
|
|
||||||
#ifndef WL_PROTOCOLS_DEFINED
|
|
||||||
#define WL_PROTOCOLS_DEFINED
|
|
||||||
#include "Wayland/xdg-shell-client-protocol.h"
|
|
||||||
#include "Wayland/xdg-decoration-client-protocol.h"
|
|
||||||
#include "Wayland/cursor-shape-client-protocol.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct _MwLLWayland;
|
|
||||||
|
|
||||||
typedef struct wayland_protocol {
|
|
||||||
void* listener;
|
|
||||||
void* context;
|
|
||||||
} wayland_protocol_t;
|
|
||||||
|
|
||||||
typedef wayland_protocol_t*(wl_setup_func)(MwU32, struct _MwLLWayland*);
|
|
||||||
|
|
||||||
struct _MwLLWaylandTopLevel {
|
|
||||||
struct xdg_surface* xdg_surface;
|
|
||||||
struct xdg_toplevel* xdg_top_level;
|
|
||||||
struct xdg_toplevel_listener xdg_toplevel_listener;
|
|
||||||
struct xdg_surface_listener xdg_surface_listener;
|
|
||||||
|
|
||||||
struct xkb_context* xkb_context;
|
|
||||||
struct xkb_keymap* xkb_keymap;
|
|
||||||
struct xkb_state* xkb_state;
|
|
||||||
|
|
||||||
MwBool compositor_created;
|
|
||||||
MwBool xdg_wm_base_created;
|
|
||||||
MwBool xdg_surface_created;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MwLLWayland {
|
|
||||||
struct _MwLLCommon common;
|
|
||||||
|
|
||||||
/* Pointer for data that's only loaded if the widget is a toplevel */
|
|
||||||
struct _MwLLWaylandTopLevel* toplevel;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
MWLL_WAYLAND_TOPLEVEL = 0,
|
|
||||||
MWLL_WAYLAND_SUBLEVEL = 1, /* Sublevels are surfaces that have the toplevel as a parent. They could be implemented as subsurfaces if we ever switch away from OpenGL. Some parts of the code also call them subwidgets. */
|
|
||||||
} type;
|
|
||||||
|
|
||||||
/* Map of Wayland interfaces to their relevant setup functions. */
|
|
||||||
struct {
|
|
||||||
const char* key;
|
|
||||||
wl_setup_func* value;
|
|
||||||
}* wl_protocol_setup_map;
|
|
||||||
|
|
||||||
/* Map of Wayland interfaces to any information we keep about them once we've registered them. */
|
|
||||||
struct {
|
|
||||||
const char* key;
|
|
||||||
wayland_protocol_t* value;
|
|
||||||
}* wl_protocol_map;
|
|
||||||
|
|
||||||
struct wl_display* display;
|
|
||||||
struct wl_registry* registry;
|
|
||||||
struct wl_compositor* compositor;
|
|
||||||
struct wl_subcompositor* subcompositor;
|
|
||||||
struct wl_surface* surface;
|
|
||||||
struct wl_registry_listener registry_listener;
|
|
||||||
struct wl_event_queue* event_queue;
|
|
||||||
|
|
||||||
EGLNativeWindowType egl_window_native;
|
|
||||||
EGLDisplay egl_display;
|
|
||||||
EGLContext egl_context;
|
|
||||||
EGLSurface egl_surface;
|
|
||||||
EGLConfig egl_config;
|
|
||||||
|
|
||||||
MwLL* sublevels; /* stb_ds managed array of any sublevels */
|
|
||||||
MwBool configured; /* Whether or not xdg_toplevel_configure has run once */
|
|
||||||
MwBool egl_setup; /* Whether or not EGL has been set up */
|
|
||||||
MwBool has_set_xy /* Whether or not MwSetXY has been called */;
|
|
||||||
|
|
||||||
int resize_counter; /* Counter that's for a hack in event_loop */
|
|
||||||
MwU32 x, y, ww, wh; /* Window position */
|
|
||||||
MwU32 lw, lh; /* Last known window position */
|
|
||||||
MwPoint cur_mouse_pos; /* Currently known mouse position */
|
|
||||||
|
|
||||||
struct timeval timer;
|
|
||||||
MwU64 cooldown_timer;
|
|
||||||
MwU64 cooldown_timer_epoch;
|
|
||||||
|
|
||||||
MwLL parent;
|
|
||||||
MwLL topmost_parent; /* The parent at the top of all the other parents. Usually a toplevel. */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MwLLWaylandColor {
|
|
||||||
struct _MwLLCommonColor common;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MwLLWaylandPixmap {
|
|
||||||
struct _MwLLCommonPixmap common;
|
|
||||||
GLuint texture;
|
|
||||||
MwBool texture_deleted;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
1
include/Mw/LowLevel/Wayland/.gitignore
vendored
1
include/Mw/LowLevel/Wayland/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
*protocol.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Folder for wayland-scanner to place any of its files.
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
@ -44,7 +43,6 @@
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
|
|
|
||||||
25
pl/rules.pl
25
pl/rules.pl
|
|
@ -26,26 +26,6 @@ if (grep(/^gdi$/, @backends)) {
|
||||||
$gl_libs = "-lopengl32 -lglu32";
|
$gl_libs = "-lopengl32 -lglu32";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grep(/^wayland$/, @backends)) {
|
|
||||||
add_cflags("-DUSE_WAYLAND");
|
|
||||||
new_object("src/backend/wayland.c");
|
|
||||||
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");
|
|
||||||
|
|
||||||
$gl_libs = "-lGL -lGLU";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (param_get("stb-image")) {
|
if (param_get("stb-image")) {
|
||||||
add_cflags("-DUSE_STB_IMAGE");
|
add_cflags("-DUSE_STB_IMAGE");
|
||||||
}
|
}
|
||||||
|
|
@ -54,10 +34,7 @@ if (param_get("stb-truetype")) {
|
||||||
}
|
}
|
||||||
if (param_get("freetype2")) {
|
if (param_get("freetype2")) {
|
||||||
add_cflags("-DUSE_FREETYPE2");
|
add_cflags("-DUSE_FREETYPE2");
|
||||||
if ($cross) {
|
if (not($cross)) {
|
||||||
add_libs("-lfreetype");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
add_cflags(`pkg-config --cflags freetype2`);
|
add_cflags(`pkg-config --cflags freetype2`);
|
||||||
add_libs(`pkg-config --libs freetype2`);
|
add_libs(`pkg-config --libs freetype2`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
32
pl/utils.pl
32
pl/utils.pl
|
|
@ -54,38 +54,6 @@ sub use_backend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub scan_wayland_protocol {
|
|
||||||
my $tier = $_[0];
|
|
||||||
my $proto = $_[1];
|
|
||||||
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 {
|
|
||||||
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"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
our %params = ();
|
our %params = ();
|
||||||
|
|
||||||
sub param_set {
|
sub param_set {
|
||||||
|
|
|
||||||
1
src/backend/.gitignore
vendored
1
src/backend/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
wayland*protocol.c
|
|
||||||
|
|
@ -10,8 +10,6 @@
|
||||||
\
|
\
|
||||||
MwLLPolygon = MwLLPolygonImpl; \
|
MwLLPolygon = MwLLPolygonImpl; \
|
||||||
MwLLLine = MwLLLineImpl; \
|
MwLLLine = MwLLLineImpl; \
|
||||||
MwLLBeginDraw = MwLLBeginDrawImpl; \
|
|
||||||
MwLLEndDraw = MwLLEndDrawImpl; \
|
|
||||||
\
|
\
|
||||||
MwLLAllocColor = MwLLAllocColorImpl; \
|
MwLLAllocColor = MwLLAllocColorImpl; \
|
||||||
MwLLColorUpdate = MwLLColorUpdateImpl; \
|
MwLLColorUpdate = MwLLColorUpdateImpl; \
|
||||||
|
|
|
||||||
|
|
@ -280,14 +280,6 @@ static void MwLLDestroyImpl(MwLL handle) {
|
||||||
free(handle);
|
free(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLBeginDrawImpl(MwLL handle) {
|
|
||||||
(void)handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MwLLEndDrawImpl(MwLL handle) {
|
|
||||||
(void)handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
|
static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
|
||||||
POINT* p = malloc(sizeof(*p) * points_count);
|
POINT* p = malloc(sizeof(*p) * points_count);
|
||||||
HPEN pen = CreatePen(PS_NULL, 0, RGB(0, 0, 0));
|
HPEN pen = CreatePen(PS_NULL, 0, RGB(0, 0, 0));
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -259,14 +259,6 @@ static void MwLLDestroyImpl(MwLL handle) {
|
||||||
free(handle);
|
free(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLBeginDrawImpl(MwLL handle) {
|
|
||||||
(void)handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MwLLEndDrawImpl(MwLL handle) {
|
|
||||||
(void)handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
|
static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
|
||||||
int i;
|
int i;
|
||||||
XPoint* p = malloc(sizeof(*p) * points_count);
|
XPoint* p = malloc(sizeof(*p) * points_count);
|
||||||
|
|
@ -1036,6 +1028,7 @@ static void MwLLEndStateChangeImpl(MwLL handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int MwLLX11CallInitImpl(void) {
|
static int MwLLX11CallInitImpl(void) {
|
||||||
|
/* TODO: check properly */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
src/core.c
12
src/core.c
|
|
@ -1,20 +1,16 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
#include "../external/stb_ds.h"
|
#include "../external/stb_ds.h"
|
||||||
#include "Mw/LowLevel.h"
|
|
||||||
|
|
||||||
static void lldrawhandler(MwLL handle, void* data) {
|
static void lldrawhandler(MwLL handle, void* data) {
|
||||||
MwWidget h = (MwWidget)handle->common.user;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
|
|
||||||
(void)data;
|
(void)data;
|
||||||
MwLLBeginDraw(handle);
|
|
||||||
|
|
||||||
h->bgcolor = NULL;
|
h->bgcolor = NULL;
|
||||||
MwDispatch(h, draw);
|
MwDispatch(h, draw);
|
||||||
if(h->draw_inject != NULL) h->draw_inject(h);
|
if(h->draw_inject != NULL) h->draw_inject(h);
|
||||||
MwDispatchUserHandler(h, MwNdrawHandler, NULL);
|
MwDispatchUserHandler(h, MwNdrawHandler, NULL);
|
||||||
|
|
||||||
MwLLEndDraw(handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lluphandler(MwLL handle, void* data) {
|
static void lluphandler(MwLL handle, void* data) {
|
||||||
|
|
@ -307,10 +303,7 @@ int MwStep(MwWidget handle) {
|
||||||
arrfree(widgets);
|
arrfree(widgets);
|
||||||
|
|
||||||
handle->prop_event = 0;
|
handle->prop_event = 0;
|
||||||
|
if(handle->lowlevel != NULL && MwLLPending(handle->lowlevel)) MwLLNextEvent(handle->lowlevel);
|
||||||
if(handle->lowlevel != NULL && MwLLPending(handle->lowlevel))
|
|
||||||
MwLLNextEvent(handle->lowlevel);
|
|
||||||
|
|
||||||
handle->prop_event = 1;
|
handle->prop_event = 1;
|
||||||
|
|
||||||
clean_destroy_queue(handle);
|
clean_destroy_queue(handle);
|
||||||
|
|
@ -701,9 +694,6 @@ MwWidget MwGetParent(MwWidget handle) {
|
||||||
typedef int (*call_t)(void);
|
typedef int (*call_t)(void);
|
||||||
int MwLibraryInit(void) {
|
int MwLibraryInit(void) {
|
||||||
call_t calls[] = {
|
call_t calls[] = {
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
MwLLWaylandCallInit,
|
|
||||||
#endif
|
|
||||||
#ifdef USE_X11
|
#ifdef USE_X11
|
||||||
MwLLX11CallInit,
|
MwLLX11CallInit,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -491,7 +491,6 @@ void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert,
|
||||||
p4[2].y = rect->y + s * border;
|
p4[2].y = rect->y + s * border;
|
||||||
}
|
}
|
||||||
MwLLPolygon(handle->lowlevel, p4, 3, col);
|
MwLLPolygon(handle->lowlevel, p4, 3, col);
|
||||||
|
|
||||||
if(color != col) MwLLFreeColor(col);
|
if(color != col) MwLLFreeColor(col);
|
||||||
|
|
||||||
MwLLFreeColor(lighter);
|
MwLLFreeColor(lighter);
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@ void (*MwLLDestroy)(MwLL handle);
|
||||||
void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
|
void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
|
||||||
void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color);
|
void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color);
|
||||||
|
|
||||||
void (*MwLLBeginDraw)(MwLL handle);
|
|
||||||
void (*MwLLEndDraw)(MwLL handle);
|
|
||||||
|
|
||||||
MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b);
|
MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b);
|
||||||
void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b);
|
void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b);
|
||||||
void (*MwLLFreeColor)(MwLLColor color);
|
void (*MwLLFreeColor)(MwLLColor color);
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
#include <Mw/Widget/OpenGL.h>
|
#include <Mw/Widget/OpenGL.h>
|
||||||
|
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
#include <stb_ds.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_GDI
|
#ifdef USE_GDI
|
||||||
typedef HGLRC(WINAPI* MWwglCreateContext)(HDC);
|
typedef HGLRC(WINAPI* MWwglCreateContext)(HDC);
|
||||||
typedef BOOL(WINAPI* MWwglMakeCurrent)(HDC, HGLRC);
|
typedef BOOL(WINAPI* MWwglMakeCurrent)(HDC, HGLRC);
|
||||||
|
|
@ -109,12 +103,6 @@ static int create(MwWidget handle) {
|
||||||
o->gl = o->glXCreateContext(handle->lowlevel->x11.display, o->visual, NULL, GL_TRUE);
|
o->gl = o->glXCreateContext(handle->lowlevel->x11.display, o->visual, NULL, GL_TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
/* Wayland uses OpenGL as its backend so its already initialized */
|
|
||||||
if(handle->lowlevel->common.type == MwLLBackendWayland) {
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
handle->internal = r;
|
handle->internal = r;
|
||||||
handle->lowlevel->common.copy_buffer = 0;
|
handle->lowlevel->common.copy_buffer = 0;
|
||||||
|
|
||||||
|
|
@ -145,10 +133,6 @@ static void destroy(MwWidget handle) {
|
||||||
MwDynamicClose(o->lib);
|
MwDynamicClose(o->lib);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
/* Wayland uses OpenGL as its backend so its destroyed accordingly */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
free(handle->internal);
|
free(handle->internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,10 +151,6 @@ static void mwOpenGLMakeCurrentImpl(MwWidget handle) {
|
||||||
o->glXMakeCurrent(handle->lowlevel->x11.display, handle->lowlevel->x11.window, o->gl);
|
o->glXMakeCurrent(handle->lowlevel->x11.display, handle->lowlevel->x11.window, o->gl);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
if(handle->lowlevel->common.type == MwLLBackendWayland) {
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mwOpenGLSwapBufferImpl(MwWidget handle) {
|
static void mwOpenGLSwapBufferImpl(MwWidget handle) {
|
||||||
|
|
@ -188,16 +168,6 @@ static void mwOpenGLSwapBufferImpl(MwWidget handle) {
|
||||||
o->glXSwapBuffers(handle->lowlevel->x11.display, handle->lowlevel->x11.window);
|
o->glXSwapBuffers(handle->lowlevel->x11.display, handle->lowlevel->x11.window);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
#define tp handle->lowlevel->wayland.topmost_parent->wayland
|
|
||||||
if(handle->lowlevel->common.type == MwLLBackendWayland) {
|
|
||||||
if(!eglSwapBuffers(
|
|
||||||
tp.egl_display, tp.egl_surface)) {
|
|
||||||
printf("Userland error: eglSwapBuffers, %0X\n", eglGetError());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#undef topmost_parent
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* mwOpenGLGetProcAddressImpl(MwWidget handle, const char* name) {
|
static void* mwOpenGLGetProcAddressImpl(MwWidget handle, const char* name) {
|
||||||
|
|
@ -214,11 +184,6 @@ static void* mwOpenGLGetProcAddressImpl(MwWidget handle, const char* name) {
|
||||||
|
|
||||||
return o->glXGetProcAddress((const GLubyte*)name);
|
return o->glXGetProcAddress((const GLubyte*)name);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef USE_WAYLAND
|
|
||||||
if(handle->lowlevel->common.type == MwLLBackendWayland) {
|
|
||||||
return eglGetProcAddress(name);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue