mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-09 19:03:29 +00:00
remove xcursor
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@641 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
74
Makefile.pl
74
Makefile.pl
@@ -5,7 +5,8 @@ $target =~ s/\r?\n$//;
|
||||
|
||||
foreach my $l (@ARGV) {
|
||||
if ($l =~ /^--.+$/) {
|
||||
}elsif($l =~ /^(.+)=(.+)$/){
|
||||
}
|
||||
elsif ($l =~ /^(.+)=(.+)$/) {
|
||||
$ENV{$1} = $2;
|
||||
}
|
||||
}
|
||||
@@ -47,18 +48,26 @@ my %features = (
|
||||
"vulkan" => "build Vulkan widget",
|
||||
"vulkan-string-helper" => "use Vulkan string helper"
|
||||
);
|
||||
my @features_keys = ("1stb-image", "1stb-truetype", "1freetype2", "1opengl", "1vulkan", "2vulkan-string-helper");
|
||||
my @features_keys = (
|
||||
"1stb-image", "1stb-truetype",
|
||||
"1freetype2", "1opengl",
|
||||
"1vulkan", "2vulkan-string-helper"
|
||||
);
|
||||
|
||||
foreach my $l (@ARGV) {
|
||||
if ($l =~ /^--(with|enable)-(.+)$/) {
|
||||
param_set($2, 1);
|
||||
}elsif($l =~ /^--(without|disable)-(.+)$/){
|
||||
}
|
||||
elsif ($l =~ /^--(without|disable)-(.+)$/) {
|
||||
param_set($2, 0);
|
||||
}elsif($l =~ /^--target=(.+)$/){
|
||||
}
|
||||
elsif ($l =~ /^--target=(.+)$/) {
|
||||
$target = $1;
|
||||
}elsif($l eq "--cross"){
|
||||
}
|
||||
elsif ($l eq "--cross") {
|
||||
$cross = 1;
|
||||
}elsif(($l eq "-h") or ($l eq "--help")){
|
||||
}
|
||||
elsif (($l eq "-h") or ($l eq "--help")) {
|
||||
print("Milsko Toolkit Configuration Utility\n");
|
||||
print("\n");
|
||||
print("Usage: $0 [options]\n");
|
||||
@@ -73,8 +82,13 @@ foreach my $l (@ARGV){
|
||||
print(" --with-FEATURE Use FEATURE\n");
|
||||
print(" --disable-FEATURE Do not use FEATURE\n");
|
||||
print(" --without-FEATURE Do not use FEATURE\n");
|
||||
|
||||
foreach my $l (@features_keys) {
|
||||
my $flag = ((substr($l, 0, 1) eq '1') ? (param_get(substr($l, 1)) ? "--disable-" : "--enable-") : (param_get(substr($l, 1)) ? "--without-" : "--with-")) . substr($l, 1);
|
||||
my $flag =
|
||||
( (substr($l, 0, 1) eq '1')
|
||||
? (param_get(substr($l, 1)) ? "--disable-" : "--enable-")
|
||||
: (param_get(substr($l, 1)) ? "--without-" : "--with-"))
|
||||
. substr($l, 1);
|
||||
my $do = param_get(substr($l, 1)) ? "Do not " : "";
|
||||
my $feat = $features{ substr($l, 1) };
|
||||
if (not(param_get($l))) {
|
||||
@@ -88,8 +102,11 @@ foreach my $l (@ARGV){
|
||||
|
||||
if (-f "./pl/ostype/${target}.pl") {
|
||||
require("./pl/ostype/${target}.pl");
|
||||
}else{
|
||||
print("Perl file (pl/ostype/${target}.pl) was not found for your target. Please add one.\n");
|
||||
}
|
||||
else {
|
||||
print(
|
||||
"Perl file (pl/ostype/${target}.pl) was not found for your target. Please add one.\n"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -101,7 +118,8 @@ my @l = ();
|
||||
foreach my $e (param_list()) {
|
||||
if (($e eq "vulkan-string-helper") and param_get("vulkan")) {
|
||||
push(@l, $e);
|
||||
}elsif(not($e eq "vulkan-string-helper") and param_get($e)){
|
||||
}
|
||||
elsif (not($e eq "vulkan-string-helper") and param_get($e)) {
|
||||
push(@l, $e);
|
||||
}
|
||||
}
|
||||
@@ -117,14 +135,28 @@ print(OUT "LIBS = ${libs}\n");
|
||||
print(OUT "MATH = ${math}\n");
|
||||
print(OUT "SHARED = ${shared}\n");
|
||||
print(OUT "\n");
|
||||
print(OUT ".PHONY: all clean distclean lib examples\n");
|
||||
print(OUT ".PHONY: all format clean distclean lib examples\n");
|
||||
print(OUT "\n");
|
||||
print(OUT "all: lib examples\n");
|
||||
print(OUT "\n");
|
||||
print(OUT "format:\n");
|
||||
print(OUT
|
||||
" clang-format --verbose -i `find src include -name \"*.c\" -or -name \"*.h\"`\n"
|
||||
);
|
||||
print(OUT
|
||||
" perltidy -b -bext=\"/\" --paren-tightness=2 `find tools Makefile.pl -name \"*.pl\"`\n"
|
||||
);
|
||||
print(OUT "\n");
|
||||
print(OUT "lib: src/${library_prefix}Mw${library_suffix}\n");
|
||||
print(OUT "\n");
|
||||
print(OUT "src/${library_prefix}Mw${library_suffix}: " . join(" ", @library_targets) . "\n");
|
||||
print(OUT " \$(CC) \$(SHARED) \$(LDFLAGS\) \$(LIBDIR) -o src/${library_prefix}Mw${library_suffix} " . join(" ", @library_targets) . " \$(LIBS)\n");
|
||||
print( OUT "src/${library_prefix}Mw${library_suffix}: "
|
||||
. join(" ", @library_targets)
|
||||
. "\n");
|
||||
print(OUT
|
||||
" \$(CC) \$(SHARED) \$(LDFLAGS\) \$(LIBDIR) -o src/${library_prefix}Mw${library_suffix} "
|
||||
. join(" ", @library_targets)
|
||||
. " \$(LIBS)\n");
|
||||
|
||||
foreach my $l (@library_targets) {
|
||||
my $s = $l;
|
||||
my $o = $object_suffix;
|
||||
@@ -149,14 +181,22 @@ foreach my $l (@examples_targets){
|
||||
$libs = $examples_libs{$l};
|
||||
}
|
||||
|
||||
print(OUT "${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n");
|
||||
print(OUT " \$(CC) -L src -Wl,-R./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n");
|
||||
print(OUT
|
||||
"${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n"
|
||||
);
|
||||
print(OUT
|
||||
" \$(CC) -L src -Wl,-R./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
|
||||
);
|
||||
print(OUT "${s}${object_suffix}: ${s}.c\n");
|
||||
print(OUT " \$(CC) -c \$\(INCDIR) -o ${s}${object_suffix} ${s}.c -lMw ${math}\n");
|
||||
print(OUT
|
||||
" \$(CC) -c \$\(INCDIR) -o ${s}${object_suffix} ${s}.c -lMw ${math}\n"
|
||||
);
|
||||
}
|
||||
print(OUT "\n");
|
||||
print(OUT "clean:\n");
|
||||
print(OUT " rm -f */*.o */*/*.o */*/*/*.o src/*.so src/*.dll src/*.a " . join(" ", @examples_targets) . "\n");
|
||||
print( OUT " rm -f */*.o */*/*.o */*/*/*.o src/*.so src/*.dll src/*.a "
|
||||
. join(" ", @examples_targets)
|
||||
. "\n");
|
||||
print(OUT "\n");
|
||||
print(OUT "distclean: clean\n");
|
||||
print(OUT " rm -f Makefile\n");
|
||||
|
||||
@@ -636,23 +636,29 @@ void MwLLForceRender(MwLL handle) {
|
||||
}
|
||||
|
||||
void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
|
||||
XcursorImage* img = XcursorImageCreate(MwCursorDataHeight, MwCursorDataHeight);
|
||||
Cursor cur;
|
||||
int y, x, ys, xs;
|
||||
char* di = malloc(MwCursorDataHeight * MwCursorDataHeight * 4);
|
||||
char* dm = malloc(MwCursorDataHeight * MwCursorDataHeight * 4);
|
||||
XImage* cimage = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), 1, ZPixmap, 0, di, MwCursorDataHeight, MwCursorDataHeight, 32, MwCursorDataHeight * 4);
|
||||
XImage* cmask = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), 1, ZPixmap, 0, dm, MwCursorDataHeight, MwCursorDataHeight, 32, MwCursorDataHeight * 4);
|
||||
Pixmap pimage = XCreatePixmap(handle->display, handle->window, MwCursorDataHeight, MwCursorDataHeight, 1);
|
||||
Pixmap pmask = XCreatePixmap(handle->display, handle->window, MwCursorDataHeight, MwCursorDataHeight, 1);
|
||||
GC imagegc = XCreateGC(handle->display, pimage, 0, NULL);
|
||||
GC maskgc = XCreateGC(handle->display, pmask, 0, NULL);
|
||||
XColor cfg, cbg;
|
||||
|
||||
xs = -mask->x + image->x;
|
||||
ys = MwCursorDataHeight + mask->y;
|
||||
ys = MwCursorDataHeight + image->y - ys;
|
||||
|
||||
img->xhot = xs;
|
||||
img->yhot = ys;
|
||||
|
||||
memset(img->pixels, 0, MwCursorDataHeight * MwCursorDataHeight * sizeof(XcursorPixel));
|
||||
memset(cimage->data, 0, cimage->bytes_per_line * cimage->height);
|
||||
memset(cmask->data, 0, cmask->bytes_per_line * cmask->height);
|
||||
for(y = 0; y < mask->height; y++) {
|
||||
unsigned int l = mask->data[y];
|
||||
for(x = mask->width - 1; x >= 0; x--) {
|
||||
if(l & 1) {
|
||||
img->pixels[y * MwCursorDataHeight + x] = 0xff000000;
|
||||
XPutPixel(cmask, x, y, 1);
|
||||
}
|
||||
l = l >> 1;
|
||||
}
|
||||
@@ -661,18 +667,35 @@ void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
|
||||
unsigned int l = image->data[y];
|
||||
for(x = image->width - 1; x >= 0; x--) {
|
||||
int px = 0;
|
||||
if(l & 1) px = 255;
|
||||
img->pixels[(ys + y) * MwCursorDataHeight + (xs + x)] |= (px << 16) | (px << 8) | (px);
|
||||
if(l & 1) px = 1;
|
||||
XPutPixel(cimage, xs + x, ys + y, px);
|
||||
|
||||
l = l >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
cur = XcursorImageLoadCursor(handle->display, img);
|
||||
cfg.red = 65535;
|
||||
cfg.green = 65535;
|
||||
cfg.blue = 65535;
|
||||
XAllocColor(handle->display, handle->colormap, &cfg);
|
||||
|
||||
cbg.red = 0;
|
||||
cbg.green = 0;
|
||||
cbg.blue = 0;
|
||||
XAllocColor(handle->display, handle->colormap, &cbg);
|
||||
|
||||
XPutImage(handle->display, pimage, imagegc, cimage, 0, 0, 0, 0, MwCursorDataHeight, MwCursorDataHeight);
|
||||
XPutImage(handle->display, pmask, maskgc, cmask, 0, 0, 0, 0, MwCursorDataHeight, MwCursorDataHeight);
|
||||
|
||||
cur = XCreatePixmapCursor(handle->display, pimage, pmask, &cfg, &cbg, xs, ys);
|
||||
XDefineCursor(handle->display, handle->window, cur);
|
||||
XFreeCursor(handle->display, cur);
|
||||
|
||||
XcursorImageDestroy(img);
|
||||
XFreePixmap(handle->display, pimage);
|
||||
XFreePixmap(handle->display, pmask);
|
||||
|
||||
XDestroyImage(cimage);
|
||||
XDestroyImage(cmask);
|
||||
}
|
||||
|
||||
void MwLLDetach(MwLL handle, MwPoint* point) {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
#include <X11/extensions/Xrender.h>
|
||||
|
||||
struct _MwLL {
|
||||
|
||||
3
src/font/boldttf.c
generated
3
src/font/boldttf.c
generated
@@ -1848,7 +1848,6 @@ unsigned char MwBoldTTFData[] = {
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0xe5, 0x16, 0xe7, 0x6b, 0x00, 0x00, 0x00, 0x00, 0xe1, 0xa9, 0xde, 0x3f,
|
||||
0x00, 0x00, 0x00, 0x00, 0xe5, 0x20, 0x8b, 0x8e
|
||||
};
|
||||
0x00, 0x00, 0x00, 0x00, 0xe5, 0x20, 0x8b, 0x8e};
|
||||
unsigned int MwBoldTTFDataSize = 22148;
|
||||
#endif
|
||||
|
||||
3
src/font/ttf.c
generated
3
src/font/ttf.c
generated
@@ -1837,7 +1837,6 @@ unsigned char MwTTFData[] = {
|
||||
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0xe5, 0x16, 0xe7, 0x6b, 0x00, 0x00, 0x00, 0x00,
|
||||
0xe1, 0xa9, 0xde, 0x41, 0x00, 0x00, 0x00, 0x00, 0xe5, 0x20, 0x8b, 0xa9
|
||||
};
|
||||
0xe1, 0xa9, 0xde, 0x41, 0x00, 0x00, 0x00, 0x00, 0xe5, 0x20, 0x8b, 0xa9};
|
||||
unsigned int MwTTFDataSize = 22020;
|
||||
#endif
|
||||
|
||||
@@ -87,8 +87,7 @@ static int create(MwWidget handle) {
|
||||
attribs[3] = 24;
|
||||
attribs[4] = None;
|
||||
|
||||
while(glpath[glincr] != NULL && (o->lib = dlopen(glpath[glincr++], RTLD_LAZY)) == NULL)
|
||||
;
|
||||
while(glpath[glincr] != NULL && (o->lib = dlopen(glpath[glincr++], RTLD_LAZY)) == NULL);
|
||||
|
||||
o->glXChooseVisual = (MWglXChooseVisual)dlsym(o->lib, "glXChooseVisual");
|
||||
o->glXCreateContext = (MWglXCreateContext)dlsym(o->lib, "glXCreateContext");
|
||||
|
||||
Reference in New Issue
Block a user