checkpoint. changed CProtocolUtil::readf() to store 1 and 2
byte integers into pointers to 1 and 2 byte integers. was always assuming pointers to 4 byte integers.
This commit is contained in:
parent
f9170eb139
commit
9ac0473d5a
|
@ -303,7 +303,7 @@ void CClient::closeSecondaryScreen()
|
|||
|
||||
void CClient::onEnter()
|
||||
{
|
||||
SInt32 x, y;
|
||||
SInt16 x, y;
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
CProtocolUtil::readf(m_input, kMsgCEnter + 4, &x, &y);
|
||||
|
@ -328,7 +328,7 @@ void CClient::onGrabClipboard()
|
|||
|
||||
void CClient::onScreenSaver()
|
||||
{
|
||||
SInt32 on;
|
||||
SInt8 on;
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
CProtocolUtil::readf(m_input, kMsgCScreenSaver + 4, &on);
|
||||
|
@ -395,7 +395,7 @@ void CClient::onSetClipboard()
|
|||
|
||||
void CClient::onKeyDown()
|
||||
{
|
||||
SInt32 id, mask;
|
||||
SInt16 id, mask;
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
CProtocolUtil::readf(m_input, kMsgDKeyDown + 4, &id, &mask);
|
||||
|
@ -406,7 +406,7 @@ void CClient::onKeyDown()
|
|||
|
||||
void CClient::onKeyRepeat()
|
||||
{
|
||||
SInt32 id, mask, count;
|
||||
SInt16 id, mask, count;
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
CProtocolUtil::readf(m_input, kMsgDKeyRepeat + 4, &id, &mask, &count);
|
||||
|
@ -418,7 +418,7 @@ void CClient::onKeyRepeat()
|
|||
|
||||
void CClient::onKeyUp()
|
||||
{
|
||||
SInt32 id, mask;
|
||||
SInt16 id, mask;
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
CProtocolUtil::readf(m_input, kMsgDKeyUp + 4, &id, &mask);
|
||||
|
@ -429,7 +429,7 @@ void CClient::onKeyUp()
|
|||
|
||||
void CClient::onMouseDown()
|
||||
{
|
||||
SInt32 id;
|
||||
SInt8 id;
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
CProtocolUtil::readf(m_input, kMsgDMouseDown + 4, &id);
|
||||
|
@ -439,7 +439,7 @@ void CClient::onMouseDown()
|
|||
|
||||
void CClient::onMouseUp()
|
||||
{
|
||||
SInt32 id;
|
||||
SInt8 id;
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
CProtocolUtil::readf(m_input, kMsgDMouseUp + 4, &id);
|
||||
|
@ -449,7 +449,7 @@ void CClient::onMouseUp()
|
|||
|
||||
void CClient::onMouseMove()
|
||||
{
|
||||
SInt32 x, y;
|
||||
SInt16 x, y;
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
CProtocolUtil::readf(m_input, kMsgDMouseMove + 4, &x, &y);
|
||||
|
@ -459,7 +459,7 @@ void CClient::onMouseMove()
|
|||
|
||||
void CClient::onMouseWheel()
|
||||
{
|
||||
SInt32 delta;
|
||||
SInt16 delta;
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
CProtocolUtil::readf(m_input, kMsgDMouseWheel + 4, &delta);
|
||||
|
|
|
@ -127,6 +127,7 @@ void CXWindowsSecondaryScreen::open(CClient* client)
|
|||
// open the display
|
||||
openDisplay();
|
||||
|
||||
{
|
||||
// verify the availability of the XTest extension
|
||||
CDisplayLock display(this);
|
||||
int majorOpcode, firstEvent, firstError;
|
||||
|
@ -141,6 +142,11 @@ void CXWindowsSecondaryScreen::open(CClient* client)
|
|||
updateModifiers(display);
|
||||
}
|
||||
|
||||
// assume primary has all clipboards
|
||||
for (ClipboardID id = 0; id < kClipboardEnd; ++id)
|
||||
grabClipboard(id);
|
||||
}
|
||||
|
||||
void CXWindowsSecondaryScreen::close()
|
||||
{
|
||||
assert(m_client != NULL);
|
||||
|
|
|
@ -320,7 +320,7 @@ void CServer::onMouseUp(ButtonID id)
|
|||
|
||||
bool CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||
{
|
||||
log((CLOG_DEBUG "onMouseMovePrimary %d,%d", x, y));
|
||||
// log((CLOG_DEBUG "onMouseMovePrimary %d,%d", x, y));
|
||||
|
||||
// mouse move on primary (server's) screen
|
||||
assert(m_active != NULL);
|
||||
|
|
|
@ -181,7 +181,7 @@ void CServerProtocol1_0::sendMouseWheel(
|
|||
void CServerProtocol1_0::recvInfo()
|
||||
{
|
||||
// parse the message
|
||||
SInt32 w, h, zoneInfo;
|
||||
SInt16 w, h, zoneInfo;
|
||||
CProtocolUtil::readf(getInputStream(), kMsgDInfo + 4, &w, &h, &zoneInfo);
|
||||
log((CLOG_INFO "received client \"%s\" info size=%dx%d, zone=%d", getClient().c_str(), w, h, zoneInfo));
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ void CXWindowsPrimaryScreen::run()
|
|||
}
|
||||
|
||||
case MotionNotify: {
|
||||
log((CLOG_DEBUG "event: MotionNotify %d,%d", xevent.xmotion.x_root, xevent.xmotion.y_root));
|
||||
// log((CLOG_DEBUG "event: MotionNotify %d,%d", xevent.xmotion.x_root, xevent.xmotion.y_root));
|
||||
SInt32 x, y;
|
||||
if (!m_active) {
|
||||
x = xevent.xmotion.x_root;
|
||||
|
|
|
@ -73,28 +73,32 @@ void CProtocolUtil::readf(IInputStream* stream,
|
|||
read(stream, buffer, len);
|
||||
|
||||
// convert it
|
||||
UInt32* v = va_arg(args, UInt32*);
|
||||
void* v = va_arg(args, void*);
|
||||
switch (len) {
|
||||
case 1:
|
||||
// 1 byte integer
|
||||
*v = static_cast<UInt32>(buffer[0]);
|
||||
*reinterpret_cast<UInt8*>(v) = buffer[0];
|
||||
log((CLOG_DEBUG "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt8*>(v), *reinterpret_cast<UInt8*>(v)));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// 2 byte integer
|
||||
*v = (static_cast<UInt32>(buffer[0]) << 8) |
|
||||
static_cast<UInt32>(buffer[1]);
|
||||
*reinterpret_cast<UInt16*>(v) =
|
||||
(static_cast<UInt16>(buffer[0]) << 8) |
|
||||
static_cast<UInt16>(buffer[1]);
|
||||
log((CLOG_DEBUG "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt16*>(v), *reinterpret_cast<UInt16*>(v)));
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// 4 byte integer
|
||||
*v = (static_cast<UInt32>(buffer[0]) << 24) |
|
||||
*reinterpret_cast<UInt32*>(v) =
|
||||
(static_cast<UInt32>(buffer[0]) << 24) |
|
||||
(static_cast<UInt32>(buffer[1]) << 16) |
|
||||
(static_cast<UInt32>(buffer[2]) << 8) |
|
||||
static_cast<UInt32>(buffer[3]);
|
||||
log((CLOG_DEBUG "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt32*>(v), *reinterpret_cast<UInt32*>(v)));
|
||||
break;
|
||||
}
|
||||
log((CLOG_DEBUG "readf: read %d byte integer: %d (0x%x)", len, *v, *v));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -352,6 +352,7 @@ bool CXWindowsScreen::getDisplayClipboard(
|
|||
// events because X stupidly doesn't provide a mask for selection
|
||||
// events, so we use a predicate to find our event.
|
||||
XEvent xevent;
|
||||
// FIXME -- must limit the time we wait for bad clients
|
||||
while (XCheckIfEvent(m_display, &xevent,
|
||||
&CXWindowsScreen::findSelectionNotify,
|
||||
(XPointer)&requestor) != True) {
|
||||
|
|
|
@ -78,7 +78,7 @@ static const char kMsgDMouseWheel[] = "DMWM%2i";
|
|||
// that message. $1 = clipboard identifier.
|
||||
static const char kMsgDClipboard[] = "DCLP%1i%4i%s";
|
||||
|
||||
// client data: seconary -> primary
|
||||
// client data: secondary -> primary
|
||||
// $1 = seconary screen width in pixels, $2 = screen height, $3 =
|
||||
// size of warp zone.
|
||||
static const char kMsgDInfo[] = "DINF%2i%2i%2i";
|
||||
|
|
Loading…
Reference in New Issue