haiku/docs/develop/servers/app_server/AppServer.htm
DarkWyrm fb49720446 Initial checkin
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@955 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-09-02 00:14:11 +00:00

568 lines
27 KiB
HTML

<HTML>
<HEAD>
<TITLE>AppServer.htm</TITLE>
<style type="text/css">
<!--
.Default {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 12pt}
.OBOS-Function-Def {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 16pt}
.OBOS-Title {background-color: rgb(255,255,255); color: rgb(0,128,0); font-family: 'Dutch801 Rm BT'; font-size: 24pt}
.Text-Background {background-color: rgb(255,255,255)}
.GR-Default {}
.Body {margin: 0px}
.Footer {margin: 0px}
.Header {margin: 0px}
.WP-Default {text-align: left; text-indent: 0px; margin-left: 0px; margin-right: 0px}
-->
</style>
</HEAD>
<BODY BGCOLOR="#ffffff">
<DIV class="sheet" id="Sheet 1">
<P class="Body" style="margin: 0px"><span class="OBOS-Title">AppServer class</span><span style="color: rgb(0,0,0); font-size: 24pt"></span></P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">The AppServer class sits at the top of the hierarchy, starting and stopping services, monitoring for messages, and so forth.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<HR>
</P>
<P class="Body" style="margin: 0px"><BR>
Member Functions</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<TABLE WIDTH=617 HEIGHT=113 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=203 HEIGHT=17>
<P class="Body" style="margin: 0px">AppServer(void)</P>
</TD>
<TD WIDTH=260 HEIGHT=17>
<P class="Body" style="margin: 0px">~AppServer(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=203 HEIGHT=17>
<P class="Body" style="margin: 0px">static int32 Poller(void *data)</P>
</TD>
<TD WIDTH=260 HEIGHT=17>
<P class="Body" style="margin: 0px">static int32 Picasso(void *data)</P>
</TD>
</TR>
<TR>
<TD WIDTH=203 HEIGHT=17>
<P class="Body" style="margin: 0px">thread_id Run(void)</P>
</TD>
<TD WIDTH=260 HEIGHT=17>
<P class="Body" style="margin: 0px">void MainLoop(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=203 HEIGHT=17>
<P class="Body" style="margin: 0px">bool LoadDecorator(const char *path)</P>
</TD>
<TD WIDTH=260 HEIGHT=17>
<P class="Body" style="margin: 0px">void DispatchMessage(int32 code, int8 *buffer)</P>
</TD>
</TR>
<TR>
<TD WIDTH=203 HEIGHT=17>
<P class="Body" style="margin: 0px">void Broadcast(int32 code)</P>
</TD>
<TD WIDTH=260 HEIGHT=17>
<P class="Body" style="margin: 0px"><span style="color: rgb(0,0,0)">void HandleKeyMessage(int32 code, int8 *buffer)</span></P>
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
Global Functions</P>
<P class="Body" style="margin: 0px"><BR>
Decorator * instantiate_decorator(Layer *owner, uint32 wflags, uint32 wlook)</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<HR>
</P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">AppServer(void)</span><span style="font-size: 16pt"></span></P>
<P class="Body" style="margin: 0px"><BR>
Create the message and input ports</P>
<P class="Body" style="margin: 0px">Create any necessary semaphores for regulating the 3 main threads</P>
<P class="Body" style="margin: 0px">Initialize all member variables</P>
<P class="Body" style="margin: 0px">Allocate the application BList</P>
<P class="Body" style="margin: 0px">Read in and process all configuration data</P>
<P class="Body" style="margin: 0px">Initialize the desktop</P>
<P class="Body" style="margin: 0px">Spawn the Picasso and Poller threads</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">~AppServer(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Shut down the desktop</P>
<P class="Body" style="margin: 0px">Empty and delete the application list</P>
<P class="Body" style="margin: 0px">Wait for Picasso and Poller to exit</P>
<P class="Body" style="margin: 0px">Free any allocated heap space</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void MainLoop(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
MainLoop is one large loop used to monitor the main message port in the app_server thread. This is a standard port-monitoring loop code:</P>
<P class="Body" style="margin: 0px"><BR>
1) Call port_buffer_size - which will block if the port is empty</P>
<P class="Body" style="margin: 0px">2) Allocate a buffer on the heap if the port buffer size is greater than 0</P>
<P class="Body" style="margin: 0px">3) Read the port</P>
<P class="Body" style="margin: 0px">4) Pass specified messages to DispatchMessage() for processing, spitting out an error message to stderr if the message's code is unrecognized</P>
<P class="Body" style="margin: 0px">5) Return from DispatchMessage() and free the message buffer if one was allocated</P>
<P class="Body" style="margin: 0px">6) If the message code matches the B_QUIT_REQUESTED definition and the quit_server flag is true, fall out of the infinite message-monitoring loop</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void DispatchMessage(int32 code, int8 *buffer)</span></P>
<P class="Body" style="margin: 0px"><BR>
DispatchMessage implements all the code necessary to respond to a given message sent to the app_server on its main port. This allows for clearer and more manageable code.</P>
<P class="Body" style="margin: 0px"><BR>
CREATE_APP:</P>
<P class="Body" style="margin: 0px"><BR>
Sent by a new BApplication object via synchronous PortLink messaging. Set up the corresponding ServerApp and reply to the BApplication with the new port to which it will send future communications with the App Server.</P>
<P class="Body" style="margin: 0px"><BR>
Attached Data:</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: center; margin: 0px"></P>
<TABLE WIDTH=573 HEIGHT=88 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=112 HEIGHT=32>
<P class="Body" style="margin: 0px">port_id reply_port</P>
</TD>
<TD WIDTH=318 HEIGHT=32>
<P class="Body" style="margin: 0px">port to which the server is to reply in response to the current message</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">port_id app_port</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">message port for the requesting BApplication</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">const char *signature</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">Signature of the requesting BApplication</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="text-align: center; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px"><BR>
1) Get all attached data</P>
<P class="Body" style="margin: 0px">2) Acquire the application list lock</P>
<P class="Body" style="margin: 0px">3) Allocate a ServerApp object and add it to the list</P>
<P class="Body" style="margin: 0px">4) Release application list lock</P>
<P class="Body" style="margin: 0px">5) Acquire active application pointer lock</P>
<P class="Body" style="margin: 0px">6) Update active application pointer</P>
<P class="Body" style="margin: 0px">7) Release active application lock</P>
<P class="Body" style="margin: 0px">8) Send the message SET_SERVER_PORT (with the ServerApp's receiver port attached) to the reply port</P>
<P class="Body" style="margin: 0px">9) Run() the new ServerApp instance</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
DELETE_APP:</P>
<P class="Body" style="margin: 0px"><BR>
Sent by a ServerApp when told to quit either by its BApplication or the Server itself (during shutdown). It is identified by the unique ID assigned to its thread.</P>
<P class="Body" style="margin: 0px"><BR>
Attached Data:</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: center; margin: 0px"></P>
<TABLE WIDTH=568 HEIGHT=22 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=132 HEIGHT=17>
<P class="Body" style="margin: 0px">thread_id app_thread</P>
</TD>
<TD WIDTH=294 HEIGHT=17>
<P class="Body" style="margin: 0px">Thread id of the ServerApp sending this message</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="text-align: center; margin: 0px"><BR>
</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
1) Get app's thread_id</P>
<P class="Body" style="text-align: left; margin: 0px">2) Acquire application list lock</P>
<P class="Body" style="text-align: left; margin: 0px">3) Iterate through the application list, searching for the ServerApp object with the sent thread_id</P>
<P class="Body" style="text-align: left; margin: 0px">4) Remove the object from the list and delete it</P>
<P class="Body" style="text-align: left; margin: 0px">5) Acquire active application lock</P>
<P class="Body" style="text-align: left; margin: 0px">6) Check to see if the application is active</P>
<P class="Body" style="text-align: left; margin: 0px">7) If application is/was active, set it to the previous application in the list or NULL if there are no other active applications</P>
<P class="Body" style="text-align: left; margin: 0px">8) Release application list lock</P>
<P class="Body" style="text-align: left; margin: 0px">9) Release active application lock</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
<BR>
GET_SCREEN_MODE:</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
Received from the OpenBeOS Input Server when requesting the current screen settings via synchronous PortLink messaging. This is a temporary solution which will be deprecated as soon as the BScreen class is complete.</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">Attached Data:</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: center; margin: 0px"></P>
<TABLE WIDTH=573 HEIGHT=42 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=112 HEIGHT=32>
<P class="Body" style="margin: 0px">port_id reply_port</P>
</TD>
<TD WIDTH=318 HEIGHT=32>
<P class="Body" style="margin: 0px">port to which the server is to reply in response to the current message</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="text-align: center; margin: 0px"><BR>
</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
1) Get height, width, and color depth from the global graphics driver object</P>
<P class="Body" style="text-align: left; margin: 0px">2) Attach via PortLink and reply to sender</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
B_QUIT_REQUESTED:</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
Encountered only under testing situations where the Server is told to quit.</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
Attached Data: None</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
1) Set quit_server flag to true</P>
<P class="Body" style="text-align: left; margin: 0px">2) Call Broadcast(QUIT_APP)</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
<BR>
SET_DECORATOR:</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
Received from just about anything when a new window decorator is chosen</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">Attached Data:</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: center; margin: 0px"></P>
<TABLE WIDTH=548 HEIGHT=22 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=117 HEIGHT=17>
<P class="Body" style="margin: 0px">const char *path</P>
</TD>
<TD WIDTH=294 HEIGHT=17>
<P class="Body" style="margin: 0px">Path to the proposed new decorator</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="text-align: center; margin: 0px"><BR>
</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
1) Get the path from the buffer</P>
<P class="Body" style="text-align: left; margin: 0px">2) Call LoadDecorator()</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void Run(void)</span></P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
Run() exists mostly for consistency with other regular applications.</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
1) Call MainLoop()</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">bool LoadDecorator(const char *path)</span></P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
Allows for a simple way to change the current window decorator systemwide simply by specifying the path to the desired Decorator addon.</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
1) Load the passed string as the path to an addon.</P>
<P class="Body" style="text-align: left; margin: 0px">2) Load all necessary symbols for the decorator</P>
<P class="Body" style="text-align: left; margin: 0px">3) Return false if things didn't go so well</P>
<P class="Body" style="text-align: left; margin: 0px">4) Call Broadcast(UPDATE_DECORATOR)</P>
<P class="Body" style="text-align: left; margin: 0px">5) Return true</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
<span class="OBOS-Function-Def">static int32 Picasso(void *data)</span></P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
Picasso is a function, despite its name, dedicated to ensuring that the server deallocates resources to a dead application. It consists of a while(!quit_server) loop as follows:</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
1) Acquire the appliction list lock</P>
<P class="Body" style="text-align: left; margin: 0px">2) Iterate through the list, calling each ServerApp object's PingTarget() method.</P>
<P class="Body" style="text-align: left; margin: 0px">3) If PingTarget returns false, remove the ServerApp from the list and delete it.</P>
<P class="Body" style="text-align: left; margin: 0px">4) Release the appliction list lock</P>
<P class="Body" style="text-align: left; margin: 0px">5) snooze for 3 seconds</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
<span class="OBOS-Function-Def">static int32 Poller(void *data)</span></P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
Poller is the main workhorse of the AppServer class, polling the Server's input port constantly for any messages from the Input Server and calling the appropriate handlers. Like Picasso, it, too, is mostly a while(!quit_server) loop.</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">1) Call port_buffer_size_etc() with a timeout of 3 seconds.</P>
<P class="Body" style="margin: 0px">2) Check to see if the port_buffer_size_etc() timed out and do a continue to next iteration if it did.</P>
<P class="Body" style="margin: 0px">3) Allocate a buffer on the heap if the port buffer size is greater than 0</P>
<P class="Body" style="margin: 0px">4) Read the port</P>
<P class="Body" style="margin: 0px">5) Pass specified messages to DispatchMessage() for processing, spitting out an error message to stderr if the message's code is unrecognized</P>
<P class="Body" style="margin: 0px">6) Return from DispatchMessage() and free the message buffer if one was allocated</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<HR>
</P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">Decorator * instantiate_decorator(Layer *owner, uint32 wflags, uint32 wlook)</span></P>
<P class="Body" style="margin: 0px"><BR>
instantiate_decorator returns a new instance of the decorator currently in use. The caller is responsible for the memory allocated for the returned object.</P>
<P class="Body" style="margin: 0px"><BR>
1) Acquire the decorator lock</P>
<P class="Body" style="margin: 0px">2) If create_decorator is NULL, create a new instance of the default decorator</P>
<P class="Body" style="margin: 0px">3) If create_decorator is non-NULL, create a new decorator instance by calling AppServer::create_decorator().</P>
<P class="Body" style="margin: 0px">4) Release the decorator lock</P>
<P class="Body" style="margin: 0px">5) Return the newly allocated instance</P>
<P class="Body" style="margin: 0px"><BR>
<span class="OBOS-Function-Def">void Broadcast(int32 code)</span></P>
<P class="Body" style="margin: 0px"><BR>
Broadcast() provides the AppServer class with an easy way to send a quick message to all ServerApps. Primarily, this is called when a font or decorator has changed, or when the server is shutting down. It is not intended to do anything except send a quick message which requires no extra data, such as for some upadate signalling.</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: left; margin: 0px">1) Acquire application list lock</P>
<P class="Body" style="text-align: left; margin: 0px">2) Create a PortLink instance and set its message code to the passed parameter.</P>
<P class="Body" style="text-align: left; margin: 0px">3) Iterate through the application list, targeting the PortLink instance to each ServerApp's message port and calling Flush().</P>
<P class="Body" style="text-align: left; margin: 0px">4) Release application list lock</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
<span class="OBOS-Function-Def">void HandleKeyMessage(int32 code, int8 *buffer)</span></P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">Called from DispatchMessage to filter out App Server events and otherwise send keystrokes to the active application. </P>
<P class="Body" style="margin: 0px"><BR>
B_KEY_DOWN:</P>
<P class="Body" style="margin: 0px"><BR>
Sent when the user presses (or holds down) a key that's been mapped to a character.</P>
<P class="Body" style="margin: 0px"><BR>
Attached Data:</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: center; margin: 0px"></P>
<TABLE WIDTH=573 HEIGHT=246 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int64 when</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">event time in seconds since 1/1/70</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 rawcode</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">code for the physical key pressed</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 repeat_count</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">number of times a key has been repeated</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 modifiers</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">flags signifying the states of the modifier keys</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 state_count</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">number of bytes to follow containing the state of all keys</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int8 *states</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">array of the state of all keys at the time of the event</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int8 utf8data[3]</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">UTF-8 data generated</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=32>
<P class="Body" style="margin: 0px">int8 charcount</P>
</TD>
<TD WIDTH=318 HEIGHT=32>
<P class="Body" style="margin: 0px">number of bytes to follow containing the string generated (usually 1)</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">const char *string</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">null-terminated string generated by the keystroke</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 raw_char</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">modifier-independent ASCII code for the character</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="text-align: center; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px"><BR>
1) Get all attached data</P>
<P class="Body" style="margin: 0px">2) If the command modifier is down, check for Left Ctrl+Left Alt+Left Shift+F12 and reset the workspace to 640 x 480 x 256 @ 60Hz and return if true</P>
<P class="Body" style="margin: 0px">3) If the command modifier is down, check for Alt+F1 through Alt+F12 and set workspace and return if true</P>
<P class="Body" style="margin: 0px">4) If the control modifier is true, check for B_CONTROL_KEY+Tab and, if true, find and send to the Deskbar.</P>
<P class="Body" style="margin: 0px">4) Acquire the active application lock</P>
<P class="Body" style="margin: 0px">5) Create a PortLink instance, target the active ServerApp's sender port, set the opcode to B_KEY_DOWN, attach the buffer <span style="font-style: italic">en masse</span>, and send it to the BApplication.</P>
<P class="Body" style="margin: 0px">6) Release the active application lock</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: left; margin: 0px">B_KEY_UP:</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">Sent when the user releases a key that's been mapped to a character.</P>
<P class="Body" style="margin: 0px"><BR>
Attached Data:</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: center; margin: 0px"></P>
<TABLE WIDTH=573 HEIGHT=224 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int64 when</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">event time in seconds since 1/1/70</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 rawcode</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">code for the physical key pressed</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 modifiers</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">flags signifying the states of the modifier keys</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 state_count</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">number of bytes to follow containing the state of all keys</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int8 *states</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">array of the state of all keys at the time of the event</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int8 utf8data[3]</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">UTF-8 data generated</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=32>
<P class="Body" style="margin: 0px">int8 charcount</P>
</TD>
<TD WIDTH=318 HEIGHT=32>
<P class="Body" style="margin: 0px">number of bytes to follow containing the string generated (usually 1)</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">const char *string</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">null-terminated string generated by the keystroke</P>
</TD>
</TR>
<TR>
<TD WIDTH=112 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 raw_char</P>
</TD>
<TD WIDTH=318 HEIGHT=17>
<P class="Body" style="margin: 0px">modifier-independent ASCII code for the character</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="text-align: center; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px"><BR>
1) Get all attached data</P>
<P class="Body" style="margin: 0px">2) Acquire the active application lock</P>
<P class="Body" style="margin: 0px">3) Create a PortLink instance, target the active ServerApp's sender port, set the opcode to B_KEY_UP, attach the buffer <span style="font-style: italic">en masse</span>, and send it to the BApplication.</P>
<P class="Body" style="margin: 0px">4) Release the active application lock</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
B_UNMAPPED_KEY_DOWN:</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">Sent when the user presses a key that has not been mapped to a character.</P>
<P class="Body" style="margin: 0px"><BR>
Attached Data:</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: center; margin: 0px"></P>
<TABLE HEIGHT=0 BORDER=0 CELLPADDING=1 CELLSPACING=2>
</TABLE>
<P class="Body" style="text-align: center; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px"><BR>
1) Acquire the active application lock</P>
<P class="Body" style="margin: 0px">2) Create a PortLink instance, target the active ServerApp's sender port, set the opcode to B_UNMAPPED_KEY_DOWN, attach the buffer <span style="font-style: italic">en masse</span>, and send it to the BApplication.</P>
<P class="Body" style="margin: 0px">3) Release the active application lock</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
B_UNMAPPED_KEY_UP:</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">Sent when the user presses a key that has not been mapped to a character.</P>
<P class="Body" style="margin: 0px"><BR>
Attached Data:</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: center; margin: 0px">?</P>
<P class="Body" style="margin: 0px"><BR>
1) Acquire the active application lock</P>
<P class="Body" style="margin: 0px">2) Create a PortLink instance, target the active ServerApp's sender port, set the opcode to B_UNMAPPED_KEY_UP, attach the buffer <span style="font-style: italic">en masse</span>, and send it to the BApplication.</P>
<P class="Body" style="margin: 0px">3) Release the active application lock</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: left; margin: 0px">B_MODIFIERS_CHANGED:</P>
<P class="Body" style="text-align: left; margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">Sent when the user presses or releases one of the modifier keys</P>
<P class="Body" style="margin: 0px"><BR>
Attached Data:</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="text-align: center; margin: 0px">?</P>
<P class="Body" style="margin: 0px"><BR>
1) Acquire the active application lock</P>
<P class="Body" style="margin: 0px">2) Create a PortLink instance, target the active ServerApp's sender port, set the opcode to B_MODIFIERS_CHANGED, attach the buffer <span style="font-style: italic">en masse</span>, and send it to the BApplication.</P>
<P class="Body" style="margin: 0px">3) Release the active application lock</P>
</DIV>
</BODY>
</HTML>