maocs wip

This commit is contained in:
Stefano D'Angelo 2025-03-18 14:53:57 +01:00
parent 1a4d158bc0
commit 44b21010f3
5 changed files with 83 additions and 6 deletions

View File

@ -20,6 +20,7 @@
#if defined(_WIN32) || defined(__CYGWIN__)
#elif defined(__APPLE__)
# include "ui_apple.h"
#else
# include <X11/Xlib.h>
#endif
@ -59,6 +60,7 @@ static plugin_ui *plugin_ui_create(char has_parent, void *parent, plugin_ui_call
return NULL;
#if defined(_WIN32) || defined(__CYGWIN__)
#elif defined(__APPLE__)
instance->widget = (void *)ui_create(has_parent, parent, WIDTH, HEIGHT);
#else
instance->display = XOpenDisplay(NULL);
if (instance->display == NULL) {
@ -82,8 +84,12 @@ static plugin_ui *plugin_ui_create(char has_parent, void *parent, plugin_ui_call
}
static void plugin_ui_free(plugin_ui *instance) {
#if defined(_WIN32) || defined(__CYGWIN__)
#elif defined(__APPLE__)
#else
XDestroyWindow(instance->display, (Window)instance->widget);
XCloseDisplay(instance->display);
#endif
free(instance);
}

View File

@ -6,12 +6,12 @@ $dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/api $dir/../
$dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json $dir/../templates/vst3 $dir/../out/vst3
$dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json $dir/../templates/vst3-make $dir/../out/vst3
cp $dir/plugin.h $dir/plugin_ui.h $dir/../out/vst3/src
cp $dir/plugin.h $dir/plugin_ui.h $dir/ui_apple.h $dir/ui_apple.m $dir/../out/vst3/src
cp $dir/vars-pre.mk $dir/../out/vst3
$dir/../tibia $dir/product.json,$dir/company.json,$dir/lv2.json $dir/../templates/lv2 $dir/../out/lv2
$dir/../tibia $dir/product.json,$dir/company.json,$dir/lv2.json $dir/../templates/lv2-make $dir/../out/lv2
cp $dir/plugin.h $dir/plugin_ui.h $dir/../out/lv2/src
cp $dir/plugin.h $dir/plugin_ui.h $dir/ui_apple.h $dir/ui_apple.m $dir/../out/lv2/src
cp $dir/vars-pre.mk $dir/../out/lv2
$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/web $dir/../out/web

21
test/ui_apple.h Normal file
View File

@ -0,0 +1,21 @@
/*
* Tibia
*
* Copyright (C) 2025 Orastron Srl unipersonale
*
* Tibia is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Tibia is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tibia. If not, see <http://www.gnu.org/licenses/>.
*
* File author: Stefano D'Angelo
*/
void *ui_create(char has_parent, void *parent, int width, int height);

32
test/ui_apple.m Normal file
View File

@ -0,0 +1,32 @@
/*
* Tibia
*
* Copyright (C) 2025 Orastron Srl unipersonale
*
* Tibia is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Tibia is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tibia. If not, see <http://www.gnu.org/licenses/>.
*
* File author: Stefano D'Angelo
*/
#import <Cocoa/Cocoa.h>
void *ui_create(char has_parent, void *parent, int width, int height) {
NSView *v = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, width, height)];
/* WRONG
if (has_parent) {
NSView *p = (NSView *)parent;
[p addSubview:v positioned:NSWindowAbove relativeTo:nil];
}
*/
return (void *)v;
}

View File

@ -6,13 +6,31 @@ ifeq ($(TEMPLATE), cmd)
endif
ifeq ($(TEMPLATE), lv2)
CFLAGS_EXTRA := $(shell pkg-config --cflags x11)
LDFLAGS_EXTRA := $(shell pkg-config --libs x11) -Wl,-rpath,$(shell pkg-config --variable=libdir x11)
ifeq ($(OS), Windows_NT)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
M_SRCS_EXTRA := $(PLUGIN_DIR)/ui_apple.m
LDFLAGS_EXTRA := -framework Cocoa -framework WebKit
else
CFLAGS_EXTRA := $(shell pkg-config --cflags x11)
LDFLAGS_EXTRA := $(shell pkg-config --libs x11) -Wl,-rpath,$(shell pkg-config --variable=libdir x11)
endif
endif
endif
ifeq ($(TEMPLATE), vst3)
CFLAGS_EXTRA := $(shell pkg-config --cflags x11)
LDFLAGS_EXTRA := $(shell pkg-config --libs x11) -Wl,-rpath,$(shell pkg-config --variable=libdir x11)
ifeq ($(OS), Windows_NT)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
M_SRCS_EXTRA := $(PLUGIN_DIR)/ui_apple.m
LDFLAGS_EXTRA := -framework Cocoa -framework WebKit
else
CFLAGS_EXTRA := $(shell pkg-config --cflags x11)
LDFLAGS_EXTRA := $(shell pkg-config --libs x11) -Wl,-rpath,$(shell pkg-config --variable=libdir x11)
endif
endif
endif
ifeq ($(TEMPLATE), daisy-seed)