Applied a number of patches.
* HP-UX fixes (Bernd Noll) * Now handling accept() taking an int 3rd arg * Now casting sizeof() to socklen_t where necessary * BSD ports fix (Kristen Glynn) * Now defining NULL via stddef.h * Crash on X11 using clipboard (Daniel Gollub) * CXWindowsClipboard::pushReplies() increments iterator better * Solaris/HP-UX compile errors * Now #ifdef out sets of key syms if first key sym undefined * Fix assertion on bad mouse position (ubiquitous_q) * Validate mouse position from client and fix if necessary
This commit is contained in:
parent
899beb6919
commit
460b751aba
17
acinclude.m4
17
acinclude.m4
|
@ -27,6 +27,23 @@ AC_DEFUN([ACX_CHECK_SOCKLEN_T], [
|
|||
fi
|
||||
])dnl ACX_CHECK_SOCKLEN_T
|
||||
|
||||
# HP-UX defines socklen_t but doesn't use it in arg 3 for accept().
|
||||
AC_DEFUN([ACX_FUNC_ACCEPT], [
|
||||
AC_MSG_CHECKING([for type of arg 3 for accept])
|
||||
acx_accept_socklen_t_arg3=int
|
||||
if test x"$acx_socklen_t_ok" = xyes; then
|
||||
AC_TRY_COMPILE([
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
],
|
||||
[struct sockaddr addr; socklen_t len; accept(0, &addr, &len);],
|
||||
[acx_accept_socklen_t_arg3=socklen_t],
|
||||
[acx_accept_socklen_t_arg3=int])
|
||||
fi
|
||||
AC_MSG_RESULT($acx_accept_socklen_t_arg3)
|
||||
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG3,$acx_accept_socklen_t_arg3,[Define to the base type of arg 3 for `accept'.])
|
||||
])dnl ACX_FUNC_ACCEPT
|
||||
|
||||
AC_DEFUN([ACX_CHECK_CXX], [
|
||||
AC_MSG_CHECKING([if g++ defines correct C++ macro])
|
||||
AC_TRY_COMPILE(, [
|
||||
|
|
|
@ -233,6 +233,7 @@ ACX_CHECK_GETPWUID_R
|
|||
AC_CHECK_FUNCS(vsnprintf)
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
ACX_CHECK_POLL
|
||||
ACX_FUNC_ACCEPT
|
||||
dnl use AC_REPLACE_FUNCS() for stuff in string.h
|
||||
|
||||
dnl checks for system services
|
||||
|
|
|
@ -212,7 +212,9 @@ CArchNetworkBSD::acceptSocket(CArchSocket s, CArchNetAddress* addr)
|
|||
*addr = new CArchNetAddressImpl;
|
||||
|
||||
// accept on socket
|
||||
int fd = accept(s->m_fd, &(*addr)->m_addr, &(*addr)->m_len);
|
||||
ACCEPT_TYPE_ARG3 len = (ACCEPT_TYPE_ARG3)((*addr)->m_len);
|
||||
int fd = accept(s->m_fd, &(*addr)->m_addr, &len);
|
||||
(*addr)->m_len = (socklen_t)len;
|
||||
if (fd == -1) {
|
||||
int err = errno;
|
||||
delete newSocket;
|
||||
|
@ -528,7 +530,7 @@ CArchNetworkBSD::throwErrorOnSocket(CArchSocket s)
|
|||
|
||||
// get the error from the socket layer
|
||||
int err = 0;
|
||||
socklen_t size = sizeof(err);
|
||||
socklen_t size = (socklen_t)sizeof(err);
|
||||
if (getsockopt(s->m_fd, SOL_SOCKET, SO_ERROR,
|
||||
(optval_t*)&err, &size) == -1) {
|
||||
err = errno;
|
||||
|
@ -567,14 +569,14 @@ CArchNetworkBSD::setNoDelayOnSocket(CArchSocket s, bool noDelay)
|
|||
|
||||
// get old state
|
||||
int oflag;
|
||||
socklen_t size = sizeof(oflag);
|
||||
socklen_t size = (socklen_t)sizeof(oflag);
|
||||
if (getsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(optval_t*)&oflag, &size) == -1) {
|
||||
throwError(errno);
|
||||
}
|
||||
|
||||
int flag = noDelay ? 1 : 0;
|
||||
size = sizeof(flag);
|
||||
size = (socklen_t)sizeof(flag);
|
||||
if (setsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(optval_t*)&flag, size) == -1) {
|
||||
throwError(errno);
|
||||
|
@ -590,14 +592,14 @@ CArchNetworkBSD::setReuseAddrOnSocket(CArchSocket s, bool reuse)
|
|||
|
||||
// get old state
|
||||
int oflag;
|
||||
socklen_t size = sizeof(oflag);
|
||||
socklen_t size = (socklen_t)sizeof(oflag);
|
||||
if (getsockopt(s->m_fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
(optval_t*)&oflag, &size) == -1) {
|
||||
throwError(errno);
|
||||
}
|
||||
|
||||
int flag = reuse ? 1 : 0;
|
||||
size = sizeof(flag);
|
||||
size = (socklen_t)sizeof(flag);
|
||||
if (setsockopt(s->m_fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
(optval_t*)&flag, size) == -1) {
|
||||
throwError(errno);
|
||||
|
@ -633,7 +635,7 @@ CArchNetworkBSD::newAnyAddr(EAddressFamily family)
|
|||
ipAddr->sin_family = AF_INET;
|
||||
ipAddr->sin_port = 0;
|
||||
ipAddr->sin_addr.s_addr = INADDR_ANY;
|
||||
addr->m_len = sizeof(struct sockaddr_in);
|
||||
addr->m_len = (socklen_t)sizeof(struct sockaddr_in);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -665,7 +667,7 @@ CArchNetworkBSD::nameToAddr(const std::string& name)
|
|||
memset(&inaddr, 0, sizeof(inaddr));
|
||||
if (inet_aton(name.c_str(), &inaddr.sin_addr) != 0) {
|
||||
// it's a dot notation address
|
||||
addr->m_len = sizeof(struct sockaddr_in);
|
||||
addr->m_len = (socklen_t)sizeof(struct sockaddr_in);
|
||||
inaddr.sin_family = AF_INET;
|
||||
inaddr.sin_port = 0;
|
||||
memcpy(&addr->m_addr, &inaddr, addr->m_len);
|
||||
|
@ -683,7 +685,7 @@ CArchNetworkBSD::nameToAddr(const std::string& name)
|
|||
|
||||
// copy over address (only IPv4 currently supported)
|
||||
if (info->h_addrtype == AF_INET) {
|
||||
addr->m_len = sizeof(struct sockaddr_in);
|
||||
addr->m_len = (socklen_t)sizeof(struct sockaddr_in);
|
||||
inaddr.sin_family = info->h_addrtype;
|
||||
inaddr.sin_port = 0;
|
||||
memcpy(&inaddr.sin_addr, info->h_addr_list[0],
|
||||
|
@ -819,7 +821,7 @@ CArchNetworkBSD::isAnyAddr(CArchNetAddress addr)
|
|||
struct sockaddr_in* ipAddr =
|
||||
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr);
|
||||
return (ipAddr->sin_addr.s_addr == INADDR_ANY &&
|
||||
addr->m_len == sizeof(struct sockaddr_in));
|
||||
addr->m_len == (socklen_t)sizeof(struct sockaddr_in));
|
||||
}
|
||||
|
||||
default:
|
||||
|
|
|
@ -127,9 +127,7 @@
|
|||
#endif
|
||||
|
||||
// define NULL
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
|
||||
// make assert available since we use it a lot
|
||||
#include <assert.h>
|
||||
|
|
|
@ -929,16 +929,19 @@ CXWindowsClipboard::pushReplies()
|
|||
// send the first reply for each window if that reply hasn't
|
||||
// been sent yet.
|
||||
for (CReplyMap::iterator index = m_replies.begin();
|
||||
index != m_replies.end(); ++index) {
|
||||
index != m_replies.end(); ) {
|
||||
assert(!index->second.empty());
|
||||
if (!index->second.front()->m_replied) {
|
||||
pushReplies(index, index->second, index->second.begin());
|
||||
}
|
||||
else {
|
||||
++index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::pushReplies(CReplyMap::iterator mapIndex,
|
||||
CXWindowsClipboard::pushReplies(CReplyMap::iterator& mapIndex,
|
||||
CReplyList& replies, CReplyList::iterator index)
|
||||
{
|
||||
CReply* reply = *index;
|
||||
|
@ -959,9 +962,12 @@ CXWindowsClipboard::pushReplies(CReplyMap::iterator mapIndex,
|
|||
CXWindowsUtil::CErrorLock lock(m_display);
|
||||
Window requestor = mapIndex->first;
|
||||
XSelectInput(m_display, requestor, m_eventMasks[requestor]);
|
||||
m_replies.erase(mapIndex);
|
||||
m_replies.erase(mapIndex++);
|
||||
m_eventMasks.erase(requestor);
|
||||
}
|
||||
else {
|
||||
++mapIndex;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -265,7 +265,7 @@ private:
|
|||
bool insertMultipleReply(Window, ::Time, Atom);
|
||||
void insertReply(CReply*);
|
||||
void pushReplies();
|
||||
void pushReplies(CReplyMap::iterator,
|
||||
void pushReplies(CReplyMap::iterator&,
|
||||
CReplyList&, CReplyList::iterator);
|
||||
bool sendReply(CReply*);
|
||||
void clearReplies();
|
||||
|
|
|
@ -188,6 +188,7 @@ struct codepair {
|
|||
{ XK_uogonek, 0x0173 }, /* LATIN SMALL LETTER U WITH OGONEK */
|
||||
{ XK_utilde, 0x0169 }, /* LATIN SMALL LETTER U WITH TILDE */
|
||||
{ XK_umacron, 0x016b }, /* LATIN SMALL LETTER U WITH MACRON */
|
||||
#if defined(XK_Babovedot)
|
||||
{ XK_Babovedot, 0x1e02 }, /* LATIN CAPITAL LETTER B WITH DOT ABOVE */
|
||||
{ XK_babovedot, 0x1e03 }, /* LATIN SMALL LETTER B WITH DOT ABOVE */
|
||||
{ XK_Dabovedot, 0x1e0a }, /* LATIN CAPITAL LETTER D WITH DOT ABOVE */
|
||||
|
@ -214,6 +215,8 @@ struct codepair {
|
|||
{ XK_wcircumflex, 0x0175 }, /* LATIN SMALL LETTER W WITH CIRCUMFLEX */
|
||||
{ XK_tabovedot, 0x1e6b }, /* LATIN SMALL LETTER T WITH DOT ABOVE */
|
||||
{ XK_ycircumflex, 0x0177 }, /* LATIN SMALL LETTER Y WITH CIRCUMFLEX */
|
||||
#endif // defined(XK_Babovedot)
|
||||
#if defined(XK_overline)
|
||||
{ XK_overline, 0x203e }, /* OVERLINE */
|
||||
{ XK_kana_fullstop, 0x3002 }, /* IDEOGRAPHIC FULL STOP */
|
||||
{ XK_kana_openingbracket, 0x300c }, /* LEFT CORNER BRACKET */
|
||||
|
@ -278,6 +281,8 @@ struct codepair {
|
|||
{ XK_kana_N, 0x30f3 }, /* KATAKANA LETTER N */
|
||||
{ XK_voicedsound, 0x309b }, /* KATAKANA-HIRAGANA VOICED SOUND MARK */
|
||||
{ XK_semivoicedsound, 0x309c }, /* KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */
|
||||
#endif // defined(XK_overline)
|
||||
#if defined(XK_Farsi_0)
|
||||
{ XK_Farsi_0, 0x06f0 }, /* EXTENDED ARABIC-INDIC DIGIT 0 */
|
||||
{ XK_Farsi_1, 0x06f1 }, /* EXTENDED ARABIC-INDIC DIGIT 1 */
|
||||
{ XK_Farsi_2, 0x06f2 }, /* EXTENDED ARABIC-INDIC DIGIT 2 */
|
||||
|
@ -366,6 +371,8 @@ struct codepair {
|
|||
{ XK_Arabic_farsi_yeh, 0x06cc }, /* ARABIC LETTER FARSI YEH */
|
||||
{ XK_Arabic_yeh_baree, 0x06d2 }, /* ARABIC LETTER YEH BAREE */
|
||||
{ XK_Arabic_heh_goal, 0x06c1 }, /* ARABIC LETTER HEH GOAL */
|
||||
#endif // defined(XK_Farsi_0)
|
||||
#if defined(XK_Serbian_dje)
|
||||
{ XK_Serbian_dje, 0x0452 }, /* CYRILLIC SMALL LETTER DJE */
|
||||
{ XK_Macedonia_gje, 0x0453 }, /* CYRILLIC SMALL LETTER GJE */
|
||||
{ XK_Cyrillic_io, 0x0451 }, /* CYRILLIC SMALL LETTER IO */
|
||||
|
@ -378,7 +385,9 @@ struct codepair {
|
|||
{ XK_Cyrillic_nje, 0x045a }, /* CYRILLIC SMALL LETTER NJE */
|
||||
{ XK_Serbian_tshe, 0x045b }, /* CYRILLIC SMALL LETTER TSHE */
|
||||
{ XK_Macedonia_kje, 0x045c }, /* CYRILLIC SMALL LETTER KJE */
|
||||
#if defined(XK_Ukrainian_ghe_with_upturn)
|
||||
{ XK_Ukrainian_ghe_with_upturn, 0x0491 }, /* CYRILLIC SMALL LETTER GHE WITH UPTURN */
|
||||
#endif
|
||||
{ XK_Byelorussian_shortu, 0x045e }, /* CYRILLIC SMALL LETTER SHORT U */
|
||||
{ XK_Cyrillic_dzhe, 0x045f }, /* CYRILLIC SMALL LETTER DZHE */
|
||||
{ XK_numerosign, 0x2116 }, /* NUMERO SIGN */
|
||||
|
@ -394,7 +403,9 @@ struct codepair {
|
|||
{ XK_Cyrillic_NJE, 0x040a }, /* CYRILLIC CAPITAL LETTER NJE */
|
||||
{ XK_Serbian_TSHE, 0x040b }, /* CYRILLIC CAPITAL LETTER TSHE */
|
||||
{ XK_Macedonia_KJE, 0x040c }, /* CYRILLIC CAPITAL LETTER KJE */
|
||||
#if defined(XK_Ukrainian_GHE_WITH_UPTURN)
|
||||
{ XK_Ukrainian_GHE_WITH_UPTURN, 0x0490 }, /* CYRILLIC CAPITAL LETTER GHE WITH UPTURN */
|
||||
#endif
|
||||
{ XK_Byelorussian_SHORTU, 0x040e }, /* CYRILLIC CAPITAL LETTER SHORT U */
|
||||
{ XK_Cyrillic_DZHE, 0x040f }, /* CYRILLIC CAPITAL LETTER DZHE */
|
||||
{ XK_Cyrillic_yu, 0x044e }, /* CYRILLIC SMALL LETTER YU */
|
||||
|
@ -461,6 +472,8 @@ struct codepair {
|
|||
{ XK_Cyrillic_SHCHA, 0x0429 }, /* CYRILLIC CAPITAL LETTER SHCHA */
|
||||
{ XK_Cyrillic_CHE, 0x0427 }, /* CYRILLIC CAPITAL LETTER CHE */
|
||||
{ XK_Cyrillic_HARDSIGN, 0x042a }, /* CYRILLIC CAPITAL LETTER HARD SIGN */
|
||||
#endif // defined(XK_Serbian_dje)
|
||||
#if defined(XK_Greek_ALPHAaccent)
|
||||
{ XK_Greek_ALPHAaccent, 0x0386 }, /* GREEK CAPITAL LETTER ALPHA WITH TONOS */
|
||||
{ XK_Greek_EPSILONaccent, 0x0388 }, /* GREEK CAPITAL LETTER EPSILON WITH TONOS */
|
||||
{ XK_Greek_ETAaccent, 0x0389 }, /* GREEK CAPITAL LETTER ETA WITH TONOS */
|
||||
|
@ -532,6 +545,7 @@ struct codepair {
|
|||
{ XK_Greek_chi, 0x03c7 }, /* GREEK SMALL LETTER CHI */
|
||||
{ XK_Greek_psi, 0x03c8 }, /* GREEK SMALL LETTER PSI */
|
||||
{ XK_Greek_omega, 0x03c9 }, /* GREEK SMALL LETTER OMEGA */
|
||||
#endif // defined(XK_Greek_ALPHAaccent)
|
||||
{ XK_leftradical, 0x23b7 }, /* ??? */
|
||||
{ XK_topleftradical, 0x250c }, /* BOX DRAWINGS LIGHT DOWN AND RIGHT */
|
||||
{ XK_horizconnector, 0x2500 }, /* BOX DRAWINGS LIGHT HORIZONTAL */
|
||||
|
@ -700,6 +714,7 @@ struct codepair {
|
|||
{ XK_leftshoe, 0x2282 }, /* SUBSET OF */
|
||||
{ XK_lefttack, 0x22a2 }, /* RIGHT TACK */
|
||||
{ XK_righttack, 0x22a3 }, /* LEFT TACK */
|
||||
#if defined(XK_hebrew_doublelowline)
|
||||
{ XK_hebrew_doublelowline, 0x2017 }, /* DOUBLE LOW LINE */
|
||||
{ XK_hebrew_aleph, 0x05d0 }, /* HEBREW LETTER ALEF */
|
||||
{ XK_hebrew_bet, 0x05d1 }, /* HEBREW LETTER BET */
|
||||
|
@ -728,6 +743,8 @@ struct codepair {
|
|||
{ XK_hebrew_resh, 0x05e8 }, /* HEBREW LETTER RESH */
|
||||
{ XK_hebrew_shin, 0x05e9 }, /* HEBREW LETTER SHIN */
|
||||
{ XK_hebrew_taw, 0x05ea }, /* HEBREW LETTER TAV */
|
||||
#endif // defined(XK_hebrew_doublelowline)
|
||||
#if defined(XK_Thai_kokai)
|
||||
{ XK_Thai_kokai, 0x0e01 }, /* THAI CHARACTER KO KAI */
|
||||
{ XK_Thai_khokhai, 0x0e02 }, /* THAI CHARACTER KHO KHAI */
|
||||
{ XK_Thai_khokhuat, 0x0e03 }, /* THAI CHARACTER KHO KHUAT */
|
||||
|
@ -812,6 +829,8 @@ struct codepair {
|
|||
{ XK_Thai_lekchet, 0x0e57 }, /* THAI DIGIT SEVEN */
|
||||
{ XK_Thai_lekpaet, 0x0e58 }, /* THAI DIGIT EIGHT */
|
||||
{ XK_Thai_lekkao, 0x0e59 }, /* THAI DIGIT NINE */
|
||||
#endif // defined(XK_Thai_kokai)
|
||||
#if defined(XK_Hangul_Kiyeog)
|
||||
{ XK_Hangul_Kiyeog, 0x3131 }, /* HANGUL LETTER KIYEOK */
|
||||
{ XK_Hangul_SsangKiyeog, 0x3132 }, /* HANGUL LETTER SSANGKIYEOK */
|
||||
{ XK_Hangul_KiyeogSios, 0x3133 }, /* HANGUL LETTER KIYEOK-SIOS */
|
||||
|
@ -903,6 +922,7 @@ struct codepair {
|
|||
{ XK_Hangul_J_KkogjiDalrinIeung, 0x11f0 }, /* HANGUL JONGSEONG YESIEUNG */
|
||||
{ XK_Hangul_J_YeorinHieuh, 0x11f9 }, /* HANGUL JONGSEONG YEORINHIEUH */
|
||||
{ XK_Korean_Won, 0x20a9 }, /* WON SIGN */
|
||||
#endif // defined(XK_Hangul_Kiyeog)
|
||||
{ XK_OE, 0x0152 }, /* LATIN CAPITAL LIGATURE OE */
|
||||
{ XK_oe, 0x0153 }, /* LATIN SMALL LIGATURE OE */
|
||||
{ XK_Ydiaeresis, 0x0178 }, /* LATIN CAPITAL LETTER Y WITH DIAERESIS */
|
||||
|
|
|
@ -401,12 +401,16 @@ CClientProxy1_0::recvInfo()
|
|||
&x, &y, &w, &h, &dummy1, &mx, &my)) {
|
||||
return false;
|
||||
}
|
||||
LOG((CLOG_DEBUG "received client \"%s\" info shape=%d,%d %dx%d", getName().c_str(), x, y, w, h));
|
||||
LOG((CLOG_DEBUG "received client \"%s\" info shape=%d,%d %dx%d at %d,%d", getName().c_str(), x, y, w, h, mx, my));
|
||||
|
||||
// validate
|
||||
if (w <= 0 || h <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (mx < x || mx >= x + w || my < y || my >= y + h) {
|
||||
mx = x + w / 2;
|
||||
my = y + h / 2;
|
||||
}
|
||||
|
||||
// save
|
||||
m_info.m_x = x;
|
||||
|
|
Loading…
Reference in New Issue