1*c2c66affSColin FinckTODO 2*c2c66affSColin Finck---- 3*c2c66affSColin Finck 4*c2c66affSColin Finck* Command for executing new programs. 5*c2c66affSColin Finck 6*c2c66affSColin Finck* Commands for changing z order and focus. 7*c2c66affSColin Finck 8*c2c66affSColin Finck* Command for transferring icon. 9*c2c66affSColin Finck 10*c2c66affSColin Finck* Think about protocol version management 11*c2c66affSColin Finck 12*c2c66affSColin Finck* Try to assure that messages aren't repeated or are sent for hidden windows. 13*c2c66affSColin Finck 14*c2c66affSColin FinckOverview 15*c2c66affSColin Finck======== 16*c2c66affSColin Finck 17*c2c66affSColin FinckThe protocol is a line based protocol following this simple syntax: 18*c2c66affSColin Finck 19*c2c66affSColin Finck OPERATION,SERIAL[,ARG1[,ARG2,[...]]] 20*c2c66affSColin Finck 21*c2c66affSColin FinckEach operation will have an increasing serial number. The initial value is 22*c2c66affSColin Finckimplementation defined. 23*c2c66affSColin Finck 24*c2c66affSColin FinckThe goal is to have a generic protocol that can be used for other display 25*c2c66affSColin Fincksystems (e.g. VNC) as well. 26*c2c66affSColin Finck 27*c2c66affSColin FinckOne line may not exceed 1024 bytes, including newline. 28*c2c66affSColin Finck 29*c2c66affSColin FinckThe protocol has no concept of hidden or unmapped windows. A window does not 30*c2c66affSColin Finckexist unless it is visible. Note that a minimized window is an exception to 31*c2c66affSColin Finckthis rule. 32*c2c66affSColin Finck 33*c2c66affSColin FinckThe protocol has no way of indicating failure, meaning that all commands are 34*c2c66affSColin Finckexpected to succeed. If a command fails, the receiving end must send a 35*c2c66affSColin Finckcorresponding command back, indicating the actual state. 36*c2c66affSColin Finck 37*c2c66affSColin FinckData types 38*c2c66affSColin Finck========== 39*c2c66affSColin FinckWindow ID are written in hex, like 0x4321. 40*c2c66affSColin Finck 41*c2c66affSColin FinckWindow positions can be negative. This happens when a window is moved 42*c2c66affSColin Finckoutside the desktop. 43*c2c66affSColin Finck 44*c2c66affSColin FinckAll integers fit inside 32 bits. 45*c2c66affSColin Finck 46*c2c66affSColin FinckStrings are sent in UTF-8 and do not contain any characters less than 0x20 or 47*c2c66affSColin Finckthe character , (comma). 48*c2c66affSColin Finck 49*c2c66affSColin FinckServer to Client Operations 50*c2c66affSColin Finck=========================== 51*c2c66affSColin Finck 52*c2c66affSColin FinckCREATE 53*c2c66affSColin Finck------ 54*c2c66affSColin Finck 55*c2c66affSColin FinckAllocate structures for a new window. 56*c2c66affSColin Finck 57*c2c66affSColin FinckSyntax: 58*c2c66affSColin Finck CREATE,<SERIAL>,<ID>,<GRPID>,<PARENT>,<FLAGS> 59*c2c66affSColin Finck 60*c2c66affSColin FinckIndicates that a window has appeared on the server. If PARENT is non-zero then 61*c2c66affSColin Finckthe new window is a child of that window (it's transient for it). The special 62*c2c66affSColin Finckvalue 0xFFFFFFFF for PARENT means that the window is a popup window without a 63*c2c66affSColin Finckparent. It's commonly used for splash screens, tool tips and context menus. 64*c2c66affSColin Finck 65*c2c66affSColin FinckThe group id identifies a set of windows that belong together. It is currently 66*c2c66affSColin Finckonly used for modal windows and DESTROYGRP. 67*c2c66affSColin Finck 68*c2c66affSColin FinckFlags: 69*c2c66affSColin Finck 0x0001 : Create a window that's modal with regard to the other windows 70*c2c66affSColin Finck in the same group. 71*c2c66affSColin Finck 72*c2c66affSColin FinckNote that very little information is included in this message. Things like 73*c2c66affSColin Fincktitle and state will come in subsequent messages. This message should only 74*c2c66affSColin Finckbe used to allocate data structures for the new window. 75*c2c66affSColin Finck 76*c2c66affSColin FinckDESTROY 77*c2c66affSColin Finck------- 78*c2c66affSColin Finck 79*c2c66affSColin FinckRemove a window. 80*c2c66affSColin Finck 81*c2c66affSColin FinckSyntax: 82*c2c66affSColin Finck DESTROY,<SERIAL>,<ID>,<FLAGS> 83*c2c66affSColin Finck 84*c2c66affSColin FinckRemove the window and deallocate all associated structures. 85*c2c66affSColin Finck 86*c2c66affSColin FinckDESTROYGRP 87*c2c66affSColin Finck---------- 88*c2c66affSColin Finck 89*c2c66affSColin FinckDestroy an entire group of windows. 90*c2c66affSColin Finck 91*c2c66affSColin FinckSyntax: 92*c2c66affSColin Finck DESTROYGRP,<SERIAL>,<GRPID>,<FLAGS> 93*c2c66affSColin Finck 94*c2c66affSColin FinckEvery window that belongs to the group GRPID should be destroyed as if they 95*c2c66affSColin Finckeach got a DESTROY message. 96*c2c66affSColin Finck 97*c2c66affSColin FinckPOSITION 98*c2c66affSColin Finck-------- 99*c2c66affSColin Finck 100*c2c66affSColin FinckMove and/or resize a window. 101*c2c66affSColin Finck 102*c2c66affSColin FinckSyntax: 103*c2c66affSColin Finck POSITION,<SERIAL>,<ID>,<X>,<Y>,<WIDTH>,<HEIGHT>,<FLAGS> 104*c2c66affSColin Finck 105*c2c66affSColin FinckIf the window isn't visible yet (because a 106*c2c66affSColin FinckSTATE hasn't been set or because it's minimized), you must store the position 107*c2c66affSColin Finckand size. A new POSITION is not guaranteed to be sent when the window changes 108*c2c66affSColin Finckstate. 109*c2c66affSColin Finck 110*c2c66affSColin FinckTITLE 111*c2c66affSColin Finck----- 112*c2c66affSColin Finck 113*c2c66affSColin FinckSets a window title. 114*c2c66affSColin Finck 115*c2c66affSColin FinckSyntax: 116*c2c66affSColin Finck TITLE,<SERIAL>,<ID>,<TITLE>,<FLAGS> 117*c2c66affSColin Finck 118*c2c66affSColin FinckThe text is guaranteed to be stripped of control characters (< 0x20). 119*c2c66affSColin Finck 120*c2c66affSColin FinckNote that this has the same requirement as POSITION, that the title needs to 121*c2c66affSColin Finckbe stored for newly created windows until a STATE is sent. It is however not 122*c2c66affSColin Finckguaranteed that a TITLE will be sent before the first STATE. 123*c2c66affSColin Finck 124*c2c66affSColin Finck 125*c2c66affSColin FinckZCHANGE 126*c2c66affSColin Finck------- 127*c2c66affSColin Finck 128*c2c66affSColin FinckThe window moved in z order. 129*c2c66affSColin Finck 130*c2c66affSColin FinckSyntax: 131*c2c66affSColin Finck ZCHANGE,<SERIAL>,<ID>,<BEHIND>,<FLAGS> 132*c2c66affSColin Finck 133*c2c66affSColin FinckThe window with the id ID is behind the window with the id BEHIND. If 134*c2c66affSColin FinckBEHIND is 0, then this window should be brought to the front. 135*c2c66affSColin Finck 136*c2c66affSColin FinckSTATE 137*c2c66affSColin Finck----- 138*c2c66affSColin Finck 139*c2c66affSColin FinckChanges the window's state and/or title. 140*c2c66affSColin Finck 141*c2c66affSColin FinckSyntax: 142*c2c66affSColin Finck STATE,<SERIAL>,<ID>,<STATE>,<FLAGS> 143*c2c66affSColin Finck 144*c2c66affSColin FinckState can have one of three values: 145*c2c66affSColin Finck 0 : "Normal" window. 146*c2c66affSColin Finck 1 : Minimized. 147*c2c66affSColin Finck 2 : Maximized. 148*c2c66affSColin Finck 149*c2c66affSColin FinckThe initial STATE for a window will always be preceeded by one CREATE and one 150*c2c66affSColin FinckPOSITION. Optionally, a TITLE may also be sent before the first STATE. 151*c2c66affSColin Finck 152*c2c66affSColin FinckDEBUG 153*c2c66affSColin Finck----- 154*c2c66affSColin Finck 155*c2c66affSColin FinckDebug output from the server component. 156*c2c66affSColin Finck 157*c2c66affSColin FinckSyntax: 158*c2c66affSColin Finck DEBUG,<SERIAL>,<STRING> 159*c2c66affSColin Finck 160*c2c66affSColin FinckUsed for debugging. 161*c2c66affSColin Finck 162*c2c66affSColin FinckSYNCBEGIN 163*c2c66affSColin Finck--------- 164*c2c66affSColin Finck 165*c2c66affSColin FinckIndicates that a synchronisation has begun. 166*c2c66affSColin Finck 167*c2c66affSColin FinckSyntax: 168*c2c66affSColin Finck SYNCBEGIN,<SERIAL>,<FLAGS> 169*c2c66affSColin Finck 170*c2c66affSColin FinckSent when the server starts a synchronisation. The client should flush all 171*c2c66affSColin Finckinformation at this point. 172*c2c66affSColin Finck 173*c2c66affSColin FinckSYNCEND 174*c2c66affSColin Finck------- 175*c2c66affSColin Finck 176*c2c66affSColin FinckIndicates that a synchronisation is complete. 177*c2c66affSColin Finck 178*c2c66affSColin FinckSyntac: 179*c2c66affSColin Finck SYNCEND,<SERIAL>,<FLAGS> 180*c2c66affSColin Finck 181*c2c66affSColin FinckSent when the last message that is part of the synchronisation has been sent. 182*c2c66affSColin FinckThis may be followed by duplicate messages and/or messages referring invalid 183*c2c66affSColin Finckwindows that were queued up during the synchronisation. 184*c2c66affSColin Finck 185*c2c66affSColin FinckHELLO 186*c2c66affSColin Finck----- 187*c2c66affSColin Finck 188*c2c66affSColin FinckInitial message sent by server. 189*c2c66affSColin Finck 190*c2c66affSColin FinckSyntax: 191*c2c66affSColin Finck HELLO,<SERIAL>,<FLAGS> 192*c2c66affSColin Finck 193*c2c66affSColin FinckThe server starts each connection by sending this message. Normally the client 194*c2c66affSColin Finckwill react by sending a SYNC back to the server. 195*c2c66affSColin Finck 196*c2c66affSColin FinckFlags: 197*c2c66affSColin Finck 0x0001 : This is a reconnect to an existing session. 198*c2c66affSColin Finck 0x0002 : The desktop is currently hidden (see HIDE). 199*c2c66affSColin Finck 200*c2c66affSColin FinckACK 201*c2c66affSColin Finck--- 202*c2c66affSColin Finck 203*c2c66affSColin FinckAcknowledgement of a request to manipulate a window. 204*c2c66affSColin Finck 205*c2c66affSColin FinckSyntax: 206*c2c66affSColin Finck ACK,<SERIAL>,<ACKSERIAL> 207*c2c66affSColin Finck 208*c2c66affSColin FinckWhenever one of the commands POSITION, ZCHANGE, STATE or FOCUS is executed on 209*c2c66affSColin Finckthe server, the server will send an ACK back to the client. The purpose of this 210*c2c66affSColin Finckis to inform the client of when the operation was actually performed, allowing 211*c2c66affSColin Finckhigh latencies in the channel. 212*c2c66affSColin Finck 213*c2c66affSColin FinckHIDE 214*c2c66affSColin Finck---- 215*c2c66affSColin Finck 216*c2c66affSColin FinckThe desktop has become hidden on the server. 217*c2c66affSColin Finck 218*c2c66affSColin FinckSyntax: 219*c2c66affSColin Finck HIDE,<SERIAL>,<FLAGS> 220*c2c66affSColin Finck 221*c2c66affSColin FinckThis message is sent when the desktop on the server is obscured by something 222*c2c66affSColin Finckthat cannot be tracked. The client should remove all windows and display the 223*c2c66affSColin Finckentire desktop, allowing the user to handle whatever is blocking the view. 224*c2c66affSColin Finck 225*c2c66affSColin FinckNote that updates to windows will still be sent as the windows still exist on 226*c2c66affSColin Finckthe server, they are merely not visible. 227*c2c66affSColin Finck 228*c2c66affSColin FinckUNHIDE 229*c2c66affSColin Finck------ 230*c2c66affSColin Finck 231*c2c66affSColin FinckThe desktop has been restored on the server. 232*c2c66affSColin Finck 233*c2c66affSColin FinckSyntax: 234*c2c66affSColin Finck UNHIDE,<SERIAL>,<FLAGS> 235*c2c66affSColin Finck 236*c2c66affSColin FinckThis message is sent some time after a HIDE, indicating that the windowed view 237*c2c66affSColin Finckhas been restored. If the client has dropped all information about windows then 238*c2c66affSColin Finckit can send a SYNC to re-enumerate them. 239*c2c66affSColin Finck 240*c2c66affSColin FinckClient to Server Operations 241*c2c66affSColin Finck=========================== 242*c2c66affSColin Finck 243*c2c66affSColin FinckSYNC 244*c2c66affSColin Finck---- 245*c2c66affSColin Finck 246*c2c66affSColin FinckRequest a synchronisation of window information. 247*c2c66affSColin Finck 248*c2c66affSColin FinckSyntax: 249*c2c66affSColin Finck SYNC,<SERIAL>,<FLAGS> 250*c2c66affSColin Finck 251*c2c66affSColin FinckFor each window, the server will send CREATE, POSITION and STATE, in that 252*c2c66affSColin Finckorder, just as if the window was created. Note that a TITLE may also, 253*c2c66affSColin Finckoptionally, be sent before the STATE. 254*c2c66affSColin Finck 255*c2c66affSColin FinckPOSITION 256*c2c66affSColin Finck-------- 257*c2c66affSColin Finck 258*c2c66affSColin FinckIdentical to the command sent from server to client. 259*c2c66affSColin Finck 260*c2c66affSColin FinckTITLE 261*c2c66affSColin Finck----- 262*c2c66affSColin Finck 263*c2c66affSColin FinckIdentical to the command sent from server to client. 264*c2c66affSColin Finck 265*c2c66affSColin FinckZCHANGE 266*c2c66affSColin Finck------- 267*c2c66affSColin Finck 268*c2c66affSColin FinckIdentical to the command sent from server to client. 269*c2c66affSColin Finck 270*c2c66affSColin FinckSTATE 271*c2c66affSColin Finck----- 272*c2c66affSColin Finck 273*c2c66affSColin FinckIdentical to the command sent from server to client. 274*c2c66affSColin Finck 275*c2c66affSColin FinckFOCUS 276*c2c66affSColin Finck----- 277*c2c66affSColin Finck 278*c2c66affSColin FinckSets which window has input focus. 279*c2c66affSColin Finck 280*c2c66affSColin FinckSyntax: 281*c2c66affSColin Finck FOCUS,<SERIAL>,<ID>,<FLAGS> 282*c2c66affSColin Finck 283*c2c66affSColin FinckChanges which window that will receive the keyboard events. Note that this 284*c2c66affSColin Finckmight cause the window to change z order. 285