public void getData(CreateWindowMsgArgs msgArgs) throws EOFException { msgArgs.decorated = bufQueue.nextByte() != 0; bufQueue.nextShort(); // Skip 2 bytes of pad msgArgs.wid = bufQueue.nextInt(); msgArgs.x = bufQueue.nextShort(); msgArgs.y = bufQueue.nextShort(); msgArgs.wAndBorder = bufQueue.nextInt(); msgArgs.hAndBorder = bufQueue.nextInt(); }
public void getData(DisplayPixelsMsgArgs msgArgs) throws EOFException { int encodingCode = bufQueue.nextByte(); msgArgs.encoding = Proto.PixelEncoding.values()[encodingCode]; msgArgs.x = bufQueue.nextShort(); msgArgs.wid = bufQueue.nextInt(); msgArgs.y = bufQueue.nextShort(); msgArgs.w = bufQueue.nextShort(); msgArgs.h = bufQueue.nextShort(); // Skip 2 bytes of pad bufQueue.nextShort(); }
// TODO: 0.4 protocol public void getData(DisplayCursorMsgArgs msg) throws EOFException { // Skip 3 bytes of pad bufQueue.nextByte(); bufQueue.nextShort(); msg.width = bufQueue.nextShort(); msg.height = bufQueue.nextShort(); msg.xhot = bufQueue.nextShort(); msg.yhot = bufQueue.nextShort(); int numPixels = msg.width * msg.height; msg.pixels = new int[numPixels]; for (int i : msg.pixels) { msg.pixels[i] = bufQueue.nextInt(); } }
public void getData(PositionWindowMsgArgs msgArgs) throws EOFException { bufQueue.skipBytes(3); // Skip 3 bytes of pad msgArgs.clientId = bufQueue.nextInt(); msgArgs.wid = bufQueue.nextInt(); msgArgs.x = bufQueue.nextShort(); msgArgs.y = bufQueue.nextShort(); }
// TODO: 0.4 protocol public void getData(MoveCursorMsgArgs msg) throws EOFException { // Skip 3 bytes of pad bufQueue.nextByte(); bufQueue.nextShort(); msg.wid = bufQueue.nextInt(); msg.x = bufQueue.nextInt(); msg.y = bufQueue.nextInt(); }
public void getData(SetPopupParentMsgArgs msgArgs) throws EOFException { // Skip 3 bytes of pad bufQueue.nextByte(); bufQueue.nextShort(); msgArgs.wid = bufQueue.nextInt(); msgArgs.parentWid = bufQueue.nextInt(); }
public void getData(ControllerStatusMsgArgs msgArgs) throws EOFException { int status = (int) bufQueue.nextByte(); msgArgs.status = Proto.ControllerStatus.values()[status]; // Skip 2 bytes of pad bufQueue.nextShort(); msgArgs.clientId = bufQueue.nextInt(); }
public void getData(ConfigureWindowMsgArgs msgArgs) throws EOFException { bufQueue.skipBytes(3); // Skip 3 bytes of pad msgArgs.clientId = bufQueue.nextInt(); msgArgs.wid = bufQueue.nextInt(); msgArgs.x = bufQueue.nextShort(); msgArgs.y = bufQueue.nextShort(); msgArgs.wAndBorder = bufQueue.nextInt(); msgArgs.hAndBorder = bufQueue.nextInt(); msgArgs.sibid = bufQueue.nextInt(); }
public void getData(ShowWindowMsgArgs msgArgs) throws EOFException { msgArgs.show = (bufQueue.nextByte() != 0); // TODO: 0.4 protocol: skip 2 bytes of transient and pad (ignore transient for now) // TODO: 0.5 protocol: skip 2 bytes of pad bufQueue.nextShort(); msgArgs.wid = bufQueue.nextInt(); // TODO: 0.5 protocol: not yet // msgArgs.transientFor = bufQueue.nextInt(); }
public void getData(CopyAreaMsgArgs msgArgs) throws EOFException { // Skip 3 bytes of pad bufQueue.nextByte(); bufQueue.nextShort(); msgArgs.wid = bufQueue.nextInt(); msgArgs.srcX = bufQueue.nextInt(); msgArgs.srcY = bufQueue.nextInt(); msgArgs.width = bufQueue.nextInt(); msgArgs.height = bufQueue.nextInt(); msgArgs.dstX = bufQueue.nextInt(); msgArgs.dstY = bufQueue.nextInt(); }
public void getData(SetWindowTitleMsgArgs msgArgs) throws EOFException { // Skip 3 byte of pad bufQueue.nextByte(); bufQueue.nextShort(); msgArgs.wid = bufQueue.nextInt(); int strLen = bufQueue.nextInt(); byte[] bytes = new byte[strLen]; for (int i = 0; i < strLen; i++) { bytes[i] = bufQueue.nextByte(); } msgArgs.title = new String(bytes); }
public void getData(UserNameMsgArgs msgArgs) throws EOFException { // Skip 1 byte of pad bufQueue.nextByte(); int strLen = bufQueue.nextShort(); if (strLen > 0) { byte[] bytes = new byte[strLen]; for (int i = 0; i < strLen; i++) { bytes[i] = bufQueue.nextByte(); } msgArgs.userName = new String(bytes); } else { msgArgs.userName = null; } controllingUserName = msgArgs.userName; }
public void getData(WindowSetBorderWidthMsgArgs msgArgs) throws EOFException { bufQueue.nextByte(); // Skip 1 byte of pad msgArgs.borderWidth = bufQueue.nextShort(); msgArgs.wid = bufQueue.nextInt(); }
public void getData(WindowSetDecoratedMsgArgs msgArgs) throws EOFException { msgArgs.decorated = (bufQueue.nextByte() == 1) ? true : false; bufQueue.nextShort(); // Skip 2 bytes of pad msgArgs.wid = bufQueue.nextInt(); }
private void initialHandshake() throws EOFException { String userName = session.getUserID().getUsername(); int strLen = userName.length(); // Inform the server that we have connected by sending a hello message // with the name of this user byte[] helloBuf = new byte[Proto.ClientMessageType.HELLO.size() + strLen + Proto.SIGNATURE_SIZE]; helloBuf[0] = (byte) Proto.ClientMessageType.HELLO.ordinal(); helloBuf[1] = (byte) 0; // pad helloBuf[2] = (byte) ((strLen >> 8) & 0xff); helloBuf[3] = (byte) (strLen & 0xff); System.arraycopy(userName.getBytes(), 0, helloBuf, 4, strLen); try { slaveSocket.send(sign(helloBuf)); } catch (IOException ex) { throw new RuntimeException(ex); } AppXrw.logger.info("Broadcast slave Hello message for user " + userName); // Get the welcome message from the server. This contains the client id // Note: because the master hub broadcasts to all slaves, there is a chance // there might be irrelevant messages queued up for this // slave. These should be ignored. This come from the fact that it takes // some time after the slave joins the connection for the master to become // aware of it and to compose and send the welcome message. During this time // if there are any incoming messages from the X server they will be // forwarded to this slave even if it has not yet been officially welcomed. // Since the content of these messages will be reflected in the welcome message // and the slave can't really do anything until it is welcomed we need // to ignore these messages. ServerMessageType type = null; do { type = getMessageType(); } while (type != ServerMessageType.WELCOME); // TODO: eventually we should add a timeout // Skip 3 bytes of pad bufQueue.nextByte(); bufQueue.nextShort(); clientId = bufQueue.nextInt(); client.setClientId(clientId); windowParents.clear(); // Read the initial window state synchronization // part of the welcome message int numWins = bufQueue.nextInt(); AppXrw.logger.info("numWins = " + numWins); for (int i = 0; i < numWins; i++) { syncWindowStateNext(); } // All windows have been defined. Now assign the parents for (WindowXrw win : windowParents.keySet()) { Integer parentWid = windowParents.get(win); if (parentWid != null) { WindowXrw parentWin = client.lookupWindow(parentWid.intValue()); win.setParent(parentWin); } } windowParents.clear(); client.updateSlaveWindows(); }