Skip to content

Commit

Permalink
* cocoa.[hm], cocoatouch.m:
Browse files Browse the repository at this point in the history
  Add hasAlpha to arguments of MLTermView::copyArea and view_copy_area().
  If hasAlpha is true, call CGCOntextSetBlendMode(kCGBlendModeNormal).
* quartz/ui_window.c:
  ui_window_copy_area() calls view_copy_area() with hasAlpha=1 if mask is not NULL.
* encodefilter/module/Makefile.in, configure.in:
  Link ../src/libmef.la to libmef_XXXX.la instead of @EF_CHARA_LO@.
* MLTermPty.java: Load MLTermPty.dll from ~/.mlterm/java all the time.
  • Loading branch information
arakiken committed Feb 25, 2024
1 parent 2d864e6 commit c98cfa4
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 75 deletions.
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2024-02-24 Araki Ken <arakiken@users.sf.net>

* cocoa.[hm], cocoatouch.m:
Add hasAlpha to arguments of MLTermView::copyArea and view_copy_area().
If hasAlpha is true, call CGCOntextSetBlendMode(kCGBlendModeNormal).

* quartz/ui_window.c:
ui_window_copy_area() calls view_copy_area() with hasAlpha=1 if mask is not NULL.

* encodefilter/module/Makefile.in, configure.in:
Link ../src/libmef.la to libmef_XXXX.la instead of @EF_CHARA_LO@.

* MLTermPty.java: Load MLTermPty.dll from ~/.mlterm/java all the time.

2024-02-17 Araki Ken <arakiken@users.sf.net>

* vt_parser.c:
Expand Down
15 changes: 2 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,6 @@ XPG4_LIBS
ALLOCA
pobl_top_builddir_suffix
pobl_top_srcdir_suffix
EF_CHAR_LO
MAKE_DIRS
TABLE_CFLAGS
mef_top_builddir_suffix
Expand Down Expand Up @@ -16999,7 +16998,7 @@ mingw*)
;;

msys*)
# msys2
# msys2
# Extract the first word of "cygpath", so it can be a program name with args.
set dummy cygpath; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
Expand Down Expand Up @@ -19717,6 +19716,7 @@ else
fi



VT_PTY_OBJ="$VT_PTY_OBJ vt_pty_win32.o"
else
VT_PTY_OBJ="vt_pty_unix.o"
Expand Down Expand Up @@ -23664,17 +23664,6 @@ if test "${MAKE_DIRS}" != "" ; then
mkdir -p ${MAKE_DIRS}
fi

#
# --- check for undefined symbol ---
#
if test "x$allow_undefined_flag" = "xunsupported" ; then
# link ef_char.lo to module/*.dll to resolve addresses in creating dll.
EF_CHAR_LO="../src/ef_char.lo"
else
EF_CHAR_LO=""
fi


#
# ====> check for baselib <===
#
Expand Down
11 changes: 0 additions & 11 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1926,17 +1926,6 @@ if test "${MAKE_DIRS}" != "" ; then
mkdir -p ${MAKE_DIRS}
fi

#
# --- check for undefined symbol ---
#
if test "x$allow_undefined_flag" = "xunsupported" ; then
# link ef_char.lo to module/*.dll to resolve addresses in creating dll.
EF_CHAR_LO="../src/ef_char.lo"
else
EF_CHAR_LO=""
fi
AC_SUBST(EF_CHAR_LO)

#
# ====> check for baselib <===
#
Expand Down
5 changes: 0 additions & 5 deletions encodefilter/configure
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ mef_top_builddir_suffix
mef_top_srcdir_suffix
DEXPORT
LPOBL
EF_CHAR_LO
NO_UNDEFINED_FLAG
MAKE_DIRS
TABLE_CFLAGS
Expand Down Expand Up @@ -11681,13 +11680,10 @@ if test "x$allow_undefined_flag" = "xunsupported" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
$as_echo "not supported" >&6; }
NO_UNDEFINED_FLAG="-no-undefined"
# link ef_char.lo to module/*.dll to resolve addresses in creating dll.
EF_CHAR_LO="../src/ef_char.lo"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: supported" >&5
$as_echo "supported" >&6; }
NO_UNDEFINED_FLAG=""
EF_CHAR_LO=""
fi
if test "x${POBL_BUILDDIR}" != "x" ; then
LPOBL="${POBL_BUILDDIR}/src/libpobl.la"
Expand All @@ -11698,7 +11694,6 @@ fi




if test "$with_gnu_ld" = "yes" ; then
DEXPORT="-Wl,--version-script=\$(VPATH)/dexport.map"
fi
Expand Down
4 changes: 0 additions & 4 deletions encodefilter/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,16 @@ AC_MSG_CHECKING([for undefined symbol])
if test "x$allow_undefined_flag" = "xunsupported" ; then
AC_MSG_RESULT([not supported])
NO_UNDEFINED_FLAG="-no-undefined"
# link ef_char.lo to module/*.dll to resolve addresses in creating dll.
EF_CHAR_LO="../src/ef_char.lo"
else
AC_MSG_RESULT(supported)
NO_UNDEFINED_FLAG=""
EF_CHAR_LO=""
fi
if test "x${POBL_BUILDDIR}" != "x" ; then
LPOBL="${POBL_BUILDDIR}/src/libpobl.la"
else
LPOBL='-lpobl'
fi
AC_SUBST(NO_UNDEFINED_FLAG)
AC_SUBST(EF_CHAR_LO)
AC_SUBST(LPOBL)


Expand Down
9 changes: 5 additions & 4 deletions encodefilter/module/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,22 @@ LIBTOOL_INSTALL = $(LIBTOOL) --mode=install $(INSTALL)

all: $(TARGET)

# ../src/libmef.la is for ef_int_to_bytes()
libmef_jajp.la: $(JAJP_TABLE_OBJ)
$(LIBTOOL_LINK) -o libmef_jajp.la $(JAJP_TABLE_OBJ:.o=.lo) @EF_CHAR_LO@ \
$(LIBTOOL_LINK) -o libmef_jajp.la $(JAJP_TABLE_OBJ:.o=.lo) ../src/libmef.la \
../src/ef_jis_property.lo \
-rpath $(libdir)/mef -module -avoid-version @NO_UNDEFINED_FLAG@

libmef_kokr.la: $(KOKR_TABLE_OBJ)
$(LIBTOOL_LINK) -o libmef_kokr.la $(KOKR_TABLE_OBJ:.o=.lo) @EF_CHAR_LO@ \
$(LIBTOOL_LINK) -o libmef_kokr.la $(KOKR_TABLE_OBJ:.o=.lo) ../src/libmef.la \
-rpath $(libdir)/mef -module -avoid-version @NO_UNDEFINED_FLAG@

libmef_zh.la: $(ZH_TABLE_OBJ)
$(LIBTOOL_LINK) -o libmef_zh.la $(ZH_TABLE_OBJ:.o=.lo) @EF_CHAR_LO@ \
$(LIBTOOL_LINK) -o libmef_zh.la $(ZH_TABLE_OBJ:.o=.lo) ../src/libmef.la \
-rpath $(libdir)/mef -module -avoid-version @NO_UNDEFINED_FLAG@

libmef_8bits.la: $(BYTE_TABLE_OBJ)
$(LIBTOOL_LINK) -o libmef_8bits.la $(BYTE_TABLE_OBJ:.o=.lo) @EF_CHAR_LO@ \
$(LIBTOOL_LINK) -o libmef_8bits.la $(BYTE_TABLE_OBJ:.o=.lo) ../src/libmef.la \
-rpath $(libdir)/mef -module -avoid-version @NO_UNDEFINED_FLAG@

install: install-la
Expand Down
6 changes: 2 additions & 4 deletions java/README
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,10 @@ How to build & install mlterm co-operating with Java.
Control+F2: Open new pty in current mlterm window.
Control+F3: Switch to a next free pty.

* On-line demo (win32 only)
http://mlterm.sourceforge.net/mltermlet.jnlp

o If libeay32.dll exits in system foler (c:\windows\system) and it is not
compatible with the one which libssh2 depends on, this demo doesn't start.
compatible with the one which libssh2 depends on, mlterm doesn't start.
Remove libeay32.dll in system folder in advance.

o The path of RSA public key is %HOMEPATH%\mlterm\id_rsa.pub and the one of
private key is %HOMEPATH%\mlterm\id_rsa by default.

Expand Down
32 changes: 22 additions & 10 deletions java/mlterm/MLTermPty.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class MLTermPty {

private static void loadLibraryFromJar() {
Manifest mf = null;
long jarLastModified = (new File(System.getProperty("java.class.path"))).lastModified();

try {
Enumeration urls =
Expand Down Expand Up @@ -59,6 +60,12 @@ private static void loadLibraryFromJar() {

byte[] buf = new byte[4096];
for (int count = 0; count < files.length; count++) {
// jarLastModified == 0L means that jar file is not found.
if (jarLastModified > 0L &&
(new File(dir + files[count])).lastModified() >= jarLastModified) {
continue;
}

if (true) {
System.out.println("Writing " + dir + files[count]);
}
Expand Down Expand Up @@ -131,18 +138,23 @@ private static void loadLibraryFromJar() {
}

static {
try {
if (DEBUG) {
System.out.println(System.getProperty("java.library.path"));
}

System.loadLibrary("MLTermPty");
} catch (UnsatisfiedLinkError e) {
if (DEBUG) {
e.printStackTrace();
}
if (DEBUG) {
System.out.println(System.getProperty("java.library.path"));
}

if (true) {
// Always load ~/.mlterm/java/*.dll
loadLibraryFromJar();
} else {
try {
System.loadLibrary("MLTermPty");
} catch (UnsatisfiedLinkError e) {
if (DEBUG) {
e.printStackTrace();
}

loadLibraryFromJar();
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/quartz/cocoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void view_fill_with(void *view, ui_color_t *color, int x, int y, u_int width, u_
void view_draw_rect_frame(void *view, ui_color_t *color, int x1, int y1, int x2, int y2);

void view_copy_area(void *view, Pixmap src, int src_x, int src_y, u_int width, u_int height,
int dst_x, int dst_y);
int dst_x, int dst_y, int hasAlpha);

void view_scroll(void *view, int src_x, int src_y, u_int width, u_int height, int dst_x, int dst_y);

Expand Down
23 changes: 15 additions & 8 deletions uitoolkit/quartz/cocoa.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ - (void)copyArea:(Pixmap)src
:(u_int)width
:(u_int)height
:(int)dst_x
:(int)dst_y;
:(int)dst_y
:(BOOL)hasAlpha;
#if 0
- (void)scroll:(int)src_x:(int)src_y:(u_int)width:(u_int)height:(int)dst_x:(int)dst_y;
#endif
Expand Down Expand Up @@ -1251,13 +1252,19 @@ - (void)copyArea:(Pixmap)src
:(u_int)width
:(u_int)height
:(int)dst_x
:(int)dst_y {
:(int)dst_y
:(BOOL)hasAlpha {
CGImageRef clipped = CGImageCreateWithImageInRect(
src, CGRectMake(src_x, src_y, width, height));
CGContextDrawImage(
ctx,
CGRectMake(dst_x, ACTUAL_HEIGHT(uiwindow) - dst_y - height, width, height),
clipped);
if (hasAlpha) {
CGContextSetBlendMode(ctx, kCGBlendModeNormal /* kCGBlendModeMultiply */);
}
CGContextDrawImage(ctx,
CGRectMake(dst_x, ACTUAL_HEIGHT(uiwindow) - dst_y - height, width, height),
clipped);
if (hasAlpha) {
CGContextSetBlendMode(ctx, kCGBlendModeCopy);
}
CGImageRelease(clipped);
}

Expand Down Expand Up @@ -1419,8 +1426,8 @@ void view_draw_rect_frame(MLTermView *view, ui_color_t *color, int x1, int y1,
}

void view_copy_area(MLTermView *view, Pixmap src, int src_x, int src_y,
u_int width, u_int height, int dst_x, int dst_y) {
[view copyArea:src:src_x:src_y:width:height:dst_x:dst_y];
u_int width, u_int height, int dst_x, int dst_y, int hasAlpha) {
[view copyArea:src:src_x:src_y:width:height:dst_x:dst_y:hasAlpha];
}

void view_scroll(MLTermView *view, int src_x, int src_y, u_int width,
Expand Down
23 changes: 15 additions & 8 deletions uitoolkit/quartz/cocoatouch.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ - (void)copyArea:(Pixmap)src
:(u_int)width
:(u_int)height
:(int)dst_x
:(int)dst_y;
:(int)dst_y
:(BOOL)hasAlpha;
#if 0
- (void)scroll:(int)src_x:(int)src_y:(u_int)width:(u_int)height:(int)dst_x:(int)dst_y;
#endif
Expand Down Expand Up @@ -1307,13 +1308,19 @@ - (void)copyArea:(Pixmap)src
:(u_int)width
:(u_int)height
:(int)dst_x
:(int)dst_y {
:(int)dst_y
:(BOOL)hasAlpha {
CGImageRef clipped = CGImageCreateWithImageInRect(
src, CGRectMake(src_x, src_y, width, height));
CGContextDrawImage(
ctx,
CGRectMake(dst_x, ACTUAL_HEIGHT(uiwindow) - dst_y - height, width, height),
clipped);
if (hasAlpha) {
CGContextSetBlendMode(ctx, kCGBlendModeNormal /* kCGBlendModeMultiply */);
}
CGContextDrawImage(ctx,
CGRectMake(dst_x, ACTUAL_HEIGHT(uiwindow) - dst_y - height, width, height),
clipped);
if (hasAlpha) {
CGContextSetBlendMode(ctx, kCGBlendModeCopy);
}
CGImageRelease(clipped);
}

Expand Down Expand Up @@ -1449,8 +1456,8 @@ void view_draw_rect_frame(MLTermView *view, ui_color_t *color, int x1, int y1,
}

void view_copy_area(MLTermView *view, Pixmap src, int src_x, int src_y,
u_int width, u_int height, int dst_x, int dst_y) {
[view copyArea:src:src_x:src_y:width:height:dst_x:dst_y];
u_int width, u_int height, int dst_x, int dst_y, int hasAlpha) {
[view copyArea:src:src_x:src_y:width:height:dst_x:dst_y:hasAlpha];
}

void view_scroll(MLTermView *view, int src_x, int src_y, u_int width,
Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/quartz/ui_imagelib.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static int check_has_alpha(u_char *image, u_int width, u_int height) {

for (y = 0; y < height; y++) {
for (x = 0; x < width; x++, p += 4) {
if (*p != 0xff) {
if (*p < 0x80) {
return 1;
}
}
Expand Down
13 changes: 7 additions & 6 deletions uitoolkit/quartz/ui_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,18 @@ static void clear_margin_area(ui_window_t *win) {
}

if (win->hmargin > 0 || right_margin > 0) {
view_copy_area(win->my_window, pic, src_x, src_y, win->hmargin, ACTUAL_HEIGHT(win), 0, 0);
view_copy_area(win->my_window, pic, src_x, src_y, win->hmargin, ACTUAL_HEIGHT(win), 0, 0, 0);
view_copy_area(win->my_window, pic, src_x + win_width + win->hmargin, src_y,
win->hmargin + right_margin, ACTUAL_HEIGHT(win), win_width + win->hmargin, 0);
win->hmargin + right_margin, ACTUAL_HEIGHT(win), win_width + win->hmargin, 0,
0);
}

if (win->vmargin > 0 || bottom_margin > 0) {
view_copy_area(win->my_window, pic, src_x + win->hmargin, src_y, win_width, win->vmargin,
win->hmargin, 0);
win->hmargin, 0, 0);
view_copy_area(win->my_window, pic, src_x + win->hmargin, src_y + win_height + win->vmargin,
win_width, win->vmargin + bottom_margin, win->hmargin,
win_height + win->vmargin);
win_height + win->vmargin, 0);
}
} else {
if (win->hmargin > 0 || right_margin > 0) {
Expand Down Expand Up @@ -813,7 +814,7 @@ void ui_window_clear(ui_window_t *win, int x, int y, u_int width, u_int height)
src_x = src_y = 0;
}

view_copy_area(win->my_window, pic, src_x + x, src_y + y, width, height, x, y);
view_copy_area(win->my_window, pic, src_x + x, src_y + y, width, height, x, y, 0);
} else {
view_fill_with(win->my_window, &win->bg_color, x, y, width, height);
}
Expand Down Expand Up @@ -1135,7 +1136,7 @@ int ui_window_copy_area(ui_window_t *win, Pixmap src, PixmapMask mask, int src_x
}

view_copy_area(win->my_window, src, src_x, src_y, width, height, dst_x + win->hmargin,
dst_y + win->vmargin);
dst_y + win->vmargin, mask ? 1 : 0);

return 1;
}
Expand Down

0 comments on commit c98cfa4

Please sign in to comment.