forked from pyrite-dev/milsko
remove xcursor
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@641 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
parent
fc9a30bfe9
commit
9b45083747
7 changed files with 3863 additions and 3804 deletions
100
Makefile.pl
100
Makefile.pl
|
|
@ -3,9 +3,10 @@
|
||||||
our $target = `uname -s`;
|
our $target = `uname -s`;
|
||||||
$target =~ s/\r?\n$//;
|
$target =~ s/\r?\n$//;
|
||||||
|
|
||||||
foreach my $l (@ARGV){
|
foreach my $l (@ARGV) {
|
||||||
if($l =~ /^--.+$/){
|
if ($l =~ /^--.+$/) {
|
||||||
}elsif($l =~ /^(.+)=(.+)$/){
|
}
|
||||||
|
elsif ($l =~ /^(.+)=(.+)$/) {
|
||||||
$ENV{$1} = $2;
|
$ENV{$1} = $2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -47,18 +48,26 @@ my %features = (
|
||||||
"vulkan" => "build Vulkan widget",
|
"vulkan" => "build Vulkan widget",
|
||||||
"vulkan-string-helper" => "use Vulkan string helper"
|
"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){
|
foreach my $l (@ARGV) {
|
||||||
if($l =~ /^--(with|enable)-(.+)$/){
|
if ($l =~ /^--(with|enable)-(.+)$/) {
|
||||||
param_set($2, 1);
|
param_set($2, 1);
|
||||||
}elsif($l =~ /^--(without|disable)-(.+)$/){
|
}
|
||||||
|
elsif ($l =~ /^--(without|disable)-(.+)$/) {
|
||||||
param_set($2, 0);
|
param_set($2, 0);
|
||||||
}elsif($l =~ /^--target=(.+)$/){
|
}
|
||||||
|
elsif ($l =~ /^--target=(.+)$/) {
|
||||||
$target = $1;
|
$target = $1;
|
||||||
}elsif($l eq "--cross"){
|
}
|
||||||
|
elsif ($l eq "--cross") {
|
||||||
$cross = 1;
|
$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("Milsko Toolkit Configuration Utility\n");
|
||||||
print("\n");
|
print("\n");
|
||||||
print("Usage: $0 [options]\n");
|
print("Usage: $0 [options]\n");
|
||||||
|
|
@ -73,11 +82,16 @@ foreach my $l (@ARGV){
|
||||||
print(" --with-FEATURE Use FEATURE\n");
|
print(" --with-FEATURE Use FEATURE\n");
|
||||||
print(" --disable-FEATURE Do not use FEATURE\n");
|
print(" --disable-FEATURE Do not use FEATURE\n");
|
||||||
print(" --without-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);
|
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 $do = param_get(substr($l, 1)) ? "Do not " : "";
|
my $do = param_get(substr($l, 1)) ? "Do not " : "";
|
||||||
my $feat = $features{substr($l, 1)};
|
my $feat = $features{ substr($l, 1) };
|
||||||
if(not(param_get($l))){
|
if (not(param_get($l))) {
|
||||||
$feat = uc(substr($feat, 0, 1)) . substr($feat, 1);
|
$feat = uc(substr($feat, 0, 1)) . substr($feat, 1);
|
||||||
}
|
}
|
||||||
print(" $flag" . (" " x (32 - length($flag))) . "${do}${feat}\n");
|
print(" $flag" . (" " x (32 - length($flag))) . "${do}${feat}\n");
|
||||||
|
|
@ -86,10 +100,13 @@ foreach my $l (@ARGV){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(-f "./pl/ostype/${target}.pl"){
|
if (-f "./pl/ostype/${target}.pl") {
|
||||||
require("./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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,10 +115,11 @@ require("./pl/rules.pl");
|
||||||
print("Target : " . $target . "\n");
|
print("Target : " . $target . "\n");
|
||||||
|
|
||||||
my @l = ();
|
my @l = ();
|
||||||
foreach my $e (param_list()){
|
foreach my $e (param_list()) {
|
||||||
if(($e eq "vulkan-string-helper") and param_get("vulkan")){
|
if (($e eq "vulkan-string-helper") and param_get("vulkan")) {
|
||||||
push(@l, $e);
|
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);
|
push(@l, $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,15 +135,29 @@ print(OUT "LIBS = ${libs}\n");
|
||||||
print(OUT "MATH = ${math}\n");
|
print(OUT "MATH = ${math}\n");
|
||||||
print(OUT "SHARED = ${shared}\n");
|
print(OUT "SHARED = ${shared}\n");
|
||||||
print(OUT "\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 "\n");
|
||||||
print(OUT "all: lib examples\n");
|
print(OUT "all: lib examples\n");
|
||||||
print(OUT "\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 "lib: src/${library_prefix}Mw${library_suffix}\n");
|
||||||
print(OUT "\n");
|
print(OUT "\n");
|
||||||
print(OUT "src/${library_prefix}Mw${library_suffix}: " . join(" ", @library_targets) . "\n");
|
print( OUT "src/${library_prefix}Mw${library_suffix}: "
|
||||||
print(OUT " \$(CC) \$(SHARED) \$(LDFLAGS\) \$(LIBDIR) -o src/${library_prefix}Mw${library_suffix} " . join(" ", @library_targets) . " \$(LIBS)\n");
|
. join(" ", @library_targets)
|
||||||
foreach my $l (@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 $s = $l;
|
||||||
my $o = $object_suffix;
|
my $o = $object_suffix;
|
||||||
$o =~ s/\./\\\./g;
|
$o =~ s/\./\\\./g;
|
||||||
|
|
@ -138,25 +170,33 @@ print(OUT "\n");
|
||||||
print(OUT "\n");
|
print(OUT "\n");
|
||||||
print(OUT "examples: " . join(" ", @examples_targets) . "\n");
|
print(OUT "examples: " . join(" ", @examples_targets) . "\n");
|
||||||
print(OUT "\n");
|
print(OUT "\n");
|
||||||
foreach my $l (@examples_targets){
|
foreach my $l (@examples_targets) {
|
||||||
my $libs = "";
|
my $libs = "";
|
||||||
my $s = $l;
|
my $s = $l;
|
||||||
my $o = $executable_suffix;
|
my $o = $executable_suffix;
|
||||||
$o =~ s/\./\\\./g;
|
$o =~ s/\./\\\./g;
|
||||||
$s =~ s/$o$//;
|
$s =~ s/$o$//;
|
||||||
|
|
||||||
if(defined($examples_libs{$l})){
|
if (defined($examples_libs{$l})) {
|
||||||
$libs = $examples_libs{$l};
|
$libs = $examples_libs{$l};
|
||||||
}
|
}
|
||||||
|
|
||||||
print(OUT "${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n");
|
print(OUT
|
||||||
print(OUT " \$(CC) -L src -Wl,-R./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n");
|
"${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 "${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 "\n");
|
||||||
print(OUT "clean:\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 "\n");
|
||||||
print(OUT "distclean: clean\n");
|
print(OUT "distclean: clean\n");
|
||||||
print(OUT " rm -f Makefile\n");
|
print(OUT " rm -f Makefile\n");
|
||||||
|
|
|
||||||
|
|
@ -636,23 +636,29 @@ void MwLLForceRender(MwLL handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
|
void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
|
||||||
XcursorImage* img = XcursorImageCreate(MwCursorDataHeight, MwCursorDataHeight);
|
|
||||||
Cursor cur;
|
Cursor cur;
|
||||||
int y, x, ys, xs;
|
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;
|
xs = -mask->x + image->x;
|
||||||
ys = MwCursorDataHeight + mask->y;
|
ys = MwCursorDataHeight + mask->y;
|
||||||
ys = MwCursorDataHeight + image->y - ys;
|
ys = MwCursorDataHeight + image->y - ys;
|
||||||
|
|
||||||
img->xhot = xs;
|
memset(cimage->data, 0, cimage->bytes_per_line * cimage->height);
|
||||||
img->yhot = ys;
|
memset(cmask->data, 0, cmask->bytes_per_line * cmask->height);
|
||||||
|
|
||||||
memset(img->pixels, 0, MwCursorDataHeight * MwCursorDataHeight * sizeof(XcursorPixel));
|
|
||||||
for(y = 0; y < mask->height; y++) {
|
for(y = 0; y < mask->height; y++) {
|
||||||
unsigned int l = mask->data[y];
|
unsigned int l = mask->data[y];
|
||||||
for(x = mask->width - 1; x >= 0; x--) {
|
for(x = mask->width - 1; x >= 0; x--) {
|
||||||
if(l & 1) {
|
if(l & 1) {
|
||||||
img->pixels[y * MwCursorDataHeight + x] = 0xff000000;
|
XPutPixel(cmask, x, y, 1);
|
||||||
}
|
}
|
||||||
l = l >> 1;
|
l = l >> 1;
|
||||||
}
|
}
|
||||||
|
|
@ -661,18 +667,35 @@ void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
|
||||||
unsigned int l = image->data[y];
|
unsigned int l = image->data[y];
|
||||||
for(x = image->width - 1; x >= 0; x--) {
|
for(x = image->width - 1; x >= 0; x--) {
|
||||||
int px = 0;
|
int px = 0;
|
||||||
if(l & 1) px = 255;
|
if(l & 1) px = 1;
|
||||||
img->pixels[(ys + y) * MwCursorDataHeight + (xs + x)] |= (px << 16) | (px << 8) | (px);
|
XPutPixel(cimage, xs + x, ys + y, px);
|
||||||
|
|
||||||
l = l >> 1;
|
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);
|
XDefineCursor(handle->display, handle->window, cur);
|
||||||
XFreeCursor(handle->display, 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) {
|
void MwLLDetach(MwLL handle, MwPoint* point) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xcursor/Xcursor.h>
|
|
||||||
#include <X11/extensions/Xrender.h>
|
#include <X11/extensions/Xrender.h>
|
||||||
|
|
||||||
struct _MwLL {
|
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,
|
0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 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,
|
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;
|
unsigned int MwBoldTTFDataSize = 22148;
|
||||||
#endif
|
#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, 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, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||||
0x00, 0x00, 0x00, 0x00, 0xe5, 0x16, 0xe7, 0x6b, 0x00, 0x00, 0x00, 0x00,
|
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;
|
unsigned int MwTTFDataSize = 22020;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,7 @@ static int create(MwWidget handle) {
|
||||||
attribs[3] = 24;
|
attribs[3] = 24;
|
||||||
attribs[4] = None;
|
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->glXChooseVisual = (MWglXChooseVisual)dlsym(o->lib, "glXChooseVisual");
|
||||||
o->glXCreateContext = (MWglXCreateContext)dlsym(o->lib, "glXCreateContext");
|
o->glXCreateContext = (MWglXCreateContext)dlsym(o->lib, "glXCreateContext");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue