git-svn-id: svn://db.shs.com.ru/pip@606 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -430,7 +430,11 @@ if(LIB)
|
|||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(CMAKE_INSTALL_PREFIX /usr/local)
|
set(CMAKE_INSTALL_PREFIX /usr/local)
|
||||||
else()
|
else()
|
||||||
set(CMAKE_INSTALL_PREFIX /usr)
|
if (DEFINED ANDROID_PLATFORM)
|
||||||
|
set(CMAKE_INSTALL_PREFIX ${ANDROID_SYSTEM_LIBRARY_PATH}/usr)
|
||||||
|
else()
|
||||||
|
set(CMAKE_INSTALL_PREFIX /usr)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
install(FILES ${HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/pip)
|
install(FILES ${HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/pip)
|
||||||
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "piincludes_p.h"
|
#include "piincludes_p.h"
|
||||||
#include "piterminal.h"
|
#include "piterminal.h"
|
||||||
# include "pisharedmemory.h"
|
#include "pisharedmemory.h"
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <wincon.h>
|
# include <wincon.h>
|
||||||
@@ -37,6 +37,13 @@
|
|||||||
# include <pty.h>
|
# include <pty.h>
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef ANDROID
|
||||||
|
# if __ANDROID_API__ >= 23
|
||||||
|
# define HAS_FORKPTY
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define HAS_FORKPTY
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -133,11 +140,13 @@ void PITerminal::write(const PIByteArray & d) {
|
|||||||
msg << int(mtKey) << ke;
|
msg << int(mtKey) << ke;
|
||||||
writePipe(PRIVATE->pipe, msg);
|
writePipe(PRIVATE->pipe, msg);
|
||||||
#else
|
#else
|
||||||
|
# ifdef HAS_FORKPTY
|
||||||
if (PRIVATE->fd == 0) return;
|
if (PRIVATE->fd == 0) return;
|
||||||
//ssize_t wrote = 0;
|
//ssize_t wrote = 0;
|
||||||
//wrote =
|
//wrote =
|
||||||
::write(PRIVATE->fd, d.data(), d.size_s());
|
::write(PRIVATE->fd, d.data(), d.size_s());
|
||||||
//piCout << "wrote" << wrote << d;
|
//piCout << "wrote" << wrote << d;
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
cursor_tm.reset();
|
cursor_tm.reset();
|
||||||
cursor_blink = true;
|
cursor_blink = true;
|
||||||
@@ -360,6 +369,7 @@ void PITerminal::run() {
|
|||||||
cursor_blink = !cursor_blink;
|
cursor_blink = !cursor_blink;
|
||||||
}
|
}
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
|
# ifdef HAS_FORKPTY
|
||||||
if (PRIVATE->fd == 0) return;
|
if (PRIVATE->fd == 0) return;
|
||||||
PRIVATE->tmp_buf.resize(BUFFER_SIZE);
|
PRIVATE->tmp_buf.resize(BUFFER_SIZE);
|
||||||
int readed = ::read(PRIVATE->fd, PRIVATE->tmp_buf.data(), BUFFER_SIZE - PRIVATE->read_buf.size_s());
|
int readed = ::read(PRIVATE->fd, PRIVATE->tmp_buf.data(), BUFFER_SIZE - PRIVATE->read_buf.size_s());
|
||||||
@@ -396,6 +406,7 @@ void PITerminal::run() {
|
|||||||
PRIVATE->read_buf.clear();
|
PRIVATE->read_buf.clear();
|
||||||
}
|
}
|
||||||
PRIVATE->last_read = false;
|
PRIVATE->last_read = false;
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -779,6 +790,7 @@ bool PITerminal::initialize() {
|
|||||||
CloseHandle(PRIVATE->pi.hThread);
|
CloseHandle(PRIVATE->pi.hThread);
|
||||||
resize(dsize_x, dsize_y);
|
resize(dsize_x, dsize_y);
|
||||||
#else
|
#else
|
||||||
|
# ifdef HAS_FORKPTY
|
||||||
char pty[256]; memset(pty, 0, 256);
|
char pty[256]; memset(pty, 0, 256);
|
||||||
winsize ws;
|
winsize ws;
|
||||||
ws.ws_col = dsize_x;
|
ws.ws_col = dsize_x;
|
||||||
@@ -833,6 +845,7 @@ bool PITerminal::initialize() {
|
|||||||
size_y = dsize_y;
|
size_y = dsize_y;
|
||||||
resize(size_x, size_y);
|
resize(size_x, size_y);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
cursor_blink = false;
|
cursor_blink = false;
|
||||||
cursor_tm.reset();
|
cursor_tm.reset();
|
||||||
@@ -856,10 +869,12 @@ void PITerminal::destroy() {
|
|||||||
if (PRIVATE->hConBuf != INVALID_HANDLE_VALUE) CloseHandle(PRIVATE->hConBuf);
|
if (PRIVATE->hConBuf != INVALID_HANDLE_VALUE) CloseHandle(PRIVATE->hConBuf);
|
||||||
//piCout << "destroy" << size_y;
|
//piCout << "destroy" << size_y;
|
||||||
#else
|
#else
|
||||||
|
# ifdef HAS_FORKPTY
|
||||||
if (PRIVATE->pid != 0)
|
if (PRIVATE->pid != 0)
|
||||||
kill(PRIVATE->pid, SIGKILL);
|
kill(PRIVATE->pid, SIGKILL);
|
||||||
if (PRIVATE->fd != 0)
|
if (PRIVATE->fd != 0)
|
||||||
::close(PRIVATE->fd);
|
::close(PRIVATE->fd);
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
initPrivate();
|
initPrivate();
|
||||||
}
|
}
|
||||||
@@ -875,6 +890,7 @@ bool PITerminal::resize(int cols, int rows) {
|
|||||||
msg << int(mtResize) << dsize_x << dsize_y;
|
msg << int(mtResize) << dsize_x << dsize_y;
|
||||||
writePipe(PRIVATE->pipe, msg);
|
writePipe(PRIVATE->pipe, msg);
|
||||||
#else
|
#else
|
||||||
|
# ifdef HAS_FORKPTY
|
||||||
if (PRIVATE->fd == 0) return false;
|
if (PRIVATE->fd == 0) return false;
|
||||||
size_x = dsize_x;
|
size_x = dsize_x;
|
||||||
size_y = dsize_y;
|
size_y = dsize_y;
|
||||||
@@ -888,6 +904,7 @@ bool PITerminal::resize(int cols, int rows) {
|
|||||||
PRIVATE->cells_save.resize(size_y);
|
PRIVATE->cells_save.resize(size_y);
|
||||||
for (int i = 0; i < size_y; ++i)
|
for (int i = 0; i < size_y; ++i)
|
||||||
PRIVATE->cells_save[i].resize(size_x);
|
PRIVATE->cells_save[i].resize(size_x);
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
cells.resize(size_y);
|
cells.resize(size_y);
|
||||||
for (int i = 0; i < size_y; ++i)
|
for (int i = 0; i < size_y; ++i)
|
||||||
|
|||||||
@@ -31,9 +31,13 @@ char * __sysoemname__ = 0;
|
|||||||
#ifdef BLACKBERRY
|
#ifdef BLACKBERRY
|
||||||
# include <ctype.h>
|
# include <ctype.h>
|
||||||
#endif
|
#endif
|
||||||
//#ifdef ANDROID
|
#include <wchar.h>
|
||||||
# include <wchar.h>
|
#ifdef ANDROID
|
||||||
//#endif
|
# if __ANDROID_API__ < 21
|
||||||
|
# define wctomb(s, wc) wcrtomb(s, wc, NULL)
|
||||||
|
# define mbtowc(pwc, s, n) mbrtowc(pwc, s, n, NULL)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*! \class PIChar
|
/*! \class PIChar
|
||||||
* \brief Unicode char
|
* \brief Unicode char
|
||||||
|
|||||||
@@ -21,9 +21,13 @@
|
|||||||
#ifdef PIP_ICU
|
#ifdef PIP_ICU
|
||||||
# include "unicode/ucnv.h"
|
# include "unicode/ucnv.h"
|
||||||
#endif
|
#endif
|
||||||
//#ifdef ANDROID
|
#include <wchar.h>
|
||||||
# include <wchar.h>
|
#ifdef ANDROID
|
||||||
//#endif
|
# if __ANDROID_API__ < 21
|
||||||
|
# define wctomb(s, wc) wcrtomb(s, wc, NULL)
|
||||||
|
# define mbtowc(pwc, s, n) mbrtowc(pwc, s, n, NULL)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*! \class PIString
|
/*! \class PIString
|
||||||
* \brief String class
|
* \brief String class
|
||||||
|
|||||||
Reference in New Issue
Block a user