#include <windows.h>
#include <dinput.h>
#include <dsound.h>
#include <winsock.h>
#include <wsipx.h>
Include dependency graph for win_local.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | WinVars_t |
Defines | |
| #define | DIRECTINPUT_VERSION 0x0300 |
| #define | DIRECTSOUND_VERSION 0x0300 |
Functions | |
| void | Conbuf_AppendText (const char *msg) |
| void | IN_Activate (qboolean active) |
| void | IN_DeactivateWin32Mouse (void) |
| void | IN_Frame (void) |
| void | IN_Init (void) |
| void | IN_JoystickCommands (void) |
| void | IN_MouseEvent (int mstate) |
| void | IN_Move (usercmd_t *cmd) |
| void | IN_Shutdown (void) |
| LONG WINAPI | MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| void | SNDDMA_Activate (void) |
| int | SNDDMA_InitDS () |
| char * | Sys_ConsoleInput (void) |
| void | Sys_CreateConsole (void) |
| void | Sys_DestroyConsole (void) |
| qboolean | Sys_GetPacket (netadr_t *net_from, msg_t *net_message) |
| void | Sys_QueEvent (int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr) |
Variables | |
| WinVars_t | g_wv |
|
|
Definition at line 34 of file win_local.h. Referenced by IN_InitDIMouse(). |
|
|
Definition at line 33 of file win_local.h. |
|
|
Definition at line 496 of file win_syscon.c. References b, buffer, CONSOLE_BUFFER_SIZE, WinConData::hwndBuffer, i, LPARAM, Q_IsColorString, s_wcd, and strlen(). Referenced by Sys_Error(), and Sys_Print(). 00497 {
00498 #define CONSOLE_BUFFER_SIZE 16384
00499
00500 char buffer[CONSOLE_BUFFER_SIZE*2];
00501 char *b = buffer;
00502 const char *msg;
00503 int bufLen;
00504 int i = 0;
00505 static unsigned long s_totalChars;
00506
00507 //
00508 // if the message is REALLY long, use just the last portion of it
00509 //
00510 if ( strlen( pMsg ) > CONSOLE_BUFFER_SIZE - 1 )
00511 {
00512 msg = pMsg + strlen( pMsg ) - CONSOLE_BUFFER_SIZE + 1;
00513 }
00514 else
00515 {
00516 msg = pMsg;
00517 }
00518
00519 //
00520 // copy into an intermediate buffer
00521 //
00522 while ( msg[i] && ( ( b - buffer ) < sizeof( buffer ) - 1 ) )
00523 {
00524 if ( msg[i] == '\n' && msg[i+1] == '\r' )
00525 {
00526 b[0] = '\r';
00527 b[1] = '\n';
00528 b += 2;
00529 i++;
00530 }
00531 else if ( msg[i] == '\r' )
00532 {
00533 b[0] = '\r';
00534 b[1] = '\n';
00535 b += 2;
00536 }
00537 else if ( msg[i] == '\n' )
00538 {
00539 b[0] = '\r';
00540 b[1] = '\n';
00541 b += 2;
00542 }
00543 else if ( Q_IsColorString( &msg[i] ) )
00544 {
00545 i++;
00546 }
00547 else
00548 {
00549 *b= msg[i];
00550 b++;
00551 }
00552 i++;
00553 }
00554 *b = 0;
00555 bufLen = b - buffer;
00556
00557 s_totalChars += bufLen;
00558
00559 //
00560 // replace selection instead of appending if we're overflowing
00561 //
00562 if ( s_totalChars > 0x7fff )
00563 {
00564 SendMessage( s_wcd.hwndBuffer, EM_SETSEL, 0, -1 );
00565 s_totalChars = bufLen;
00566 }
00567
00568 //
00569 // put this text into the windows console
00570 //
00571 SendMessage( s_wcd.hwndBuffer, EM_LINESCROLL, 0, 0xffff );
00572 SendMessage( s_wcd.hwndBuffer, EM_SCROLLCARET, 0, 0 );
00573 SendMessage( s_wcd.hwndBuffer, EM_REPLACESEL, 0, (LPARAM) buffer );
00574 }
|
Here is the call graph for this function:

|
|
Definition at line 719 of file win_input.c. References in_appactive, and IN_DeactivateMouse(). 00719 {
00720 in_appactive = active;
00721
00722 if ( !active )
00723 {
00724 IN_DeactivateMouse();
00725 }
00726 }
|
Here is the call graph for this function:

|
|
Definition at line 160 of file win_input.c. Referenced by IN_DeactivateMouse(). 00161 {
00162 ClipCursor (NULL);
00163 ReleaseCapture ();
00164 while (ShowCursor (TRUE) < 0)
00165 ;
00166 }
|
|
|
Definition at line 27 of file null_input.c. References _3DFX_DRIVER_NAME, cls, Com_Printf(), Cvar_VariableString(), Cvar_VariableValue(), g_wv, WinVars_t::hWnd, IN_ActivateMouse(), IN_DeactivateMouse(), IN_JoyMove(), IN_MouseMove(), IN_StartupMouse(), clientStatic_t::keyCatchers, WinMouseVars_t::mouseInitialized, WinMouseVars_t::mouseStartupDelayed, s_wmv, and strcmp(). 00027 {
00028 }
|
Here is the call graph for this function:

|
|
Definition at line 24 of file null_input.c. References Cmd_AddCommand(), CVAR_ARCHIVE, Cvar_Get(), CVAR_LATCH, CVAR_TEMP, in_debugJoystick, in_joyBallScale, in_joystick, in_logitechbug, in_midi, in_midichannel, in_mididevice, in_midiport, in_mouse, IN_Startup(), joy_threshold, and MidiInfo_f(). 00024 {
00025 }
|
Here is the call graph for this function:

|
|
|
|
|
Definition at line 597 of file win_input.c. References g_wv, i, K_MOUSE1, WinMouseVars_t::mouseInitialized, NULL, WinMouseVars_t::oldButtonState, qfalse, qtrue, s_wmv, SE_KEY, Sys_QueEvent(), and WinVars_t::sysMsgTime. Referenced by MainWndProc(). 00598 {
00599 int i;
00600
00601 if ( !s_wmv.mouseInitialized )
00602 return;
00603
00604 // perform button actions
00605 for (i = 0 ; i < 3 ; i++ )
00606 {
00607 if ( (mstate & (1<<i)) &&
00608 !(s_wmv.oldButtonState & (1<<i)) )
00609 {
00610 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MOUSE1 + i, qtrue, 0, NULL );
00611 }
00612
00613 if ( !(mstate & (1<<i)) &&
00614 (s_wmv.oldButtonState & (1<<i)) )
00615 {
00616 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MOUSE1 + i, qfalse, 0, NULL );
00617 }
00618 }
00619
00620 s_wmv.oldButtonState = mstate;
00621 }
|
Here is the call graph for this function:

|
|
|
|
|
Definition at line 30 of file null_input.c. References Cmd_RemoveCommand(), IN_DeactivateMouse(), IN_ShutdownDIMouse(), and IN_ShutdownMIDI(). 00030 {
00031 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 226 of file win_wndproc.c. References WinVars_t::activeApp, Cbuf_AddText(), Cbuf_ExecuteText(), cls, Com_DPrintf(), CVAR_ARCHIVE, Cvar_Get(), CVAR_LATCH, Cvar_SetValue(), EXEC_APPEND, FALSE, g_wv, WinVars_t::hWnd, i, IN_Activate(), in_logitechbug, in_mouse, IN_MouseEvent(), cvar_s::integer, K_MWHEELDOWN, K_MWHEELUP, clientStatic_t::keyCatchers, LONG, MapKey(), cvar_s::modified, MSH_MOUSEWHEEL, NULL, qboolean, qfalse, qtrue, r, r_fullscreen, SE_CHAR, SE_KEY, SNDDMA_Activate(), Sys_QueEvent(), WinVars_t::sysMsgTime, uMsg, VID_AppActivate(), vid_xpos, vid_ypos, WIN_DisableAltTab(), WIN_EnableAltTab(), WM_MOUSEWHEEL, and wParam. Referenced by Sys_Init(). 00231 {
00232 static qboolean flip = qtrue;
00233 int zDelta, i;
00234
00235 // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/aboutmouseinput.asp
00236 // Windows 95, Windows NT 3.51 - uses MSH_MOUSEWHEEL
00237 // only relevant for non-DI input
00238 //
00239 // NOTE: not sure how reliable this is anymore, might trigger double wheel events
00240 if (in_mouse->integer != 1)
00241 {
00242 if ( uMsg == MSH_MOUSEWHEEL )
00243 {
00244 if ( ( ( int ) wParam ) > 0 )
00245 {
00246 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELUP, qtrue, 0, NULL );
00247 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELUP, qfalse, 0, NULL );
00248 }
00249 else
00250 {
00251 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELDOWN, qtrue, 0, NULL );
00252 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELDOWN, qfalse, 0, NULL );
00253 }
00254 return DefWindowProc (hWnd, uMsg, wParam, lParam);
00255 }
00256 }
00257
00258 switch (uMsg)
00259 {
00260 case WM_MOUSEWHEEL:
00261 // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/aboutmouseinput.asp
00262 // Windows 98/Me, Windows NT 4.0 and later - uses WM_MOUSEWHEEL
00263 // only relevant for non-DI input and when console is toggled in window mode
00264 // if console is toggled in window mode (KEYCATCH_CONSOLE) then mouse is released and DI doesn't see any mouse wheel
00265 if (in_mouse->integer != 1 || (!r_fullscreen->integer && (cls.keyCatchers & KEYCATCH_CONSOLE)))
00266 {
00267 // 120 increments, might be 240 and multiples if wheel goes too fast
00268 // NOTE Logitech: logitech drivers are screwed and send the message twice?
00269 // could add a cvar to interpret the message as successive press/release events
00270 zDelta = ( short ) HIWORD( wParam ) / 120;
00271 if ( zDelta > 0 )
00272 {
00273 for(i=0; i<zDelta; i++)
00274 {
00275 if (!in_logitechbug->integer)
00276 {
00277 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELUP, qtrue, 0, NULL );
00278 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELUP, qfalse, 0, NULL );
00279 }
00280 else
00281 {
00282 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELUP, flip, 0, NULL );
00283 flip = !flip;
00284 }
00285 }
00286 }
00287 else
00288 {
00289 for(i=0; i<-zDelta; i++)
00290 {
00291 if (!in_logitechbug->integer)
00292 {
00293 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELDOWN, qtrue, 0, NULL );
00294 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELDOWN, qfalse, 0, NULL );
00295 }
00296 else
00297 {
00298 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELDOWN, flip, 0, NULL );
00299 flip = !flip;
00300 }
00301 }
00302 }
00303 // when an application processes the WM_MOUSEWHEEL message, it must return zero
00304 return 0;
00305 }
00306 break;
00307
00308 case WM_CREATE:
00309
00310 g_wv.hWnd = hWnd;
00311
00312 vid_xpos = Cvar_Get ("vid_xpos", "3", CVAR_ARCHIVE);
00313 vid_ypos = Cvar_Get ("vid_ypos", "22", CVAR_ARCHIVE);
00314 r_fullscreen = Cvar_Get ("r_fullscreen", "1", CVAR_ARCHIVE | CVAR_LATCH );
00315
00316 MSH_MOUSEWHEEL = RegisterWindowMessage("MSWHEEL_ROLLMSG");
00317 if ( r_fullscreen->integer )
00318 {
00319 WIN_DisableAltTab();
00320 }
00321 else
00322 {
00323 WIN_EnableAltTab();
00324 }
00325
00326 break;
00327 #if 0
00328 case WM_DISPLAYCHANGE:
00329 Com_DPrintf( "WM_DISPLAYCHANGE\n" );
00330 // we need to force a vid_restart if the user has changed
00331 // their desktop resolution while the game is running,
00332 // but don't do anything if the message is a result of
00333 // our own calling of ChangeDisplaySettings
00334 if ( com_insideVidInit ) {
00335 break; // we did this on purpose
00336 }
00337 // something else forced a mode change, so restart all our gl stuff
00338 Cbuf_AddText( "vid_restart\n" );
00339 break;
00340 #endif
00341 case WM_DESTROY:
00342 // let sound and input know about this?
00343 g_wv.hWnd = NULL;
00344 if ( r_fullscreen->integer )
00345 {
00346 WIN_EnableAltTab();
00347 }
00348 break;
00349
00350 case WM_CLOSE:
00351 Cbuf_ExecuteText( EXEC_APPEND, "quit" );
00352 break;
00353
00354 case WM_ACTIVATE:
00355 {
00356 int fActive, fMinimized;
00357
00358 fActive = LOWORD(wParam);
00359 fMinimized = (BOOL) HIWORD(wParam);
00360
00361 VID_AppActivate( fActive != WA_INACTIVE, fMinimized);
00362 SNDDMA_Activate();
00363 }
00364 break;
00365
00366 case WM_MOVE:
00367 {
00368 int xPos, yPos;
00369 RECT r;
00370 int style;
00371
00372 if (!r_fullscreen->integer )
00373 {
00374 xPos = (short) LOWORD(lParam); // horizontal position
00375 yPos = (short) HIWORD(lParam); // vertical position
00376
00377 r.left = 0;
00378 r.top = 0;
00379 r.right = 1;
00380 r.bottom = 1;
00381
00382 style = GetWindowLong( hWnd, GWL_STYLE );
00383 AdjustWindowRect( &r, style, FALSE );
00384
00385 Cvar_SetValue( "vid_xpos", xPos + r.left);
00386 Cvar_SetValue( "vid_ypos", yPos + r.top);
00387 vid_xpos->modified = qfalse;
00388 vid_ypos->modified = qfalse;
00389 if ( g_wv.activeApp )
00390 {
00391 IN_Activate (qtrue);
00392 }
00393 }
00394 }
00395 break;
00396
00397 // this is complicated because Win32 seems to pack multiple mouse events into
00398 // one update sometimes, so we always check all states and look for events
00399 case WM_LBUTTONDOWN:
00400 case WM_LBUTTONUP:
00401 case WM_RBUTTONDOWN:
00402 case WM_RBUTTONUP:
00403 case WM_MBUTTONDOWN:
00404 case WM_MBUTTONUP:
00405 case WM_MOUSEMOVE:
00406 {
00407 int temp;
00408
00409 temp = 0;
00410
00411 if (wParam & MK_LBUTTON)
00412 temp |= 1;
00413
00414 if (wParam & MK_RBUTTON)
00415 temp |= 2;
00416
00417 if (wParam & MK_MBUTTON)
00418 temp |= 4;
00419
00420 IN_MouseEvent (temp);
00421 }
00422 break;
00423
00424 case WM_SYSCOMMAND:
00425 if ( wParam == SC_SCREENSAVE )
00426 return 0;
00427 break;
00428
00429 case WM_SYSKEYDOWN:
00430 if ( wParam == 13 )
00431 {
00432 if ( r_fullscreen )
00433 {
00434 Cvar_SetValue( "r_fullscreen", !r_fullscreen->integer );
00435 Cbuf_AddText( "vid_restart\n" );
00436 }
00437 return 0;
00438 }
00439 // fall through
00440 case WM_KEYDOWN:
00441 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, MapKey( lParam ), qtrue, 0, NULL );
00442 break;
00443
00444 case WM_SYSKEYUP:
00445 case WM_KEYUP:
00446 Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, MapKey( lParam ), qfalse, 0, NULL );
00447 break;
00448
00449 case WM_CHAR:
00450 Sys_QueEvent( g_wv.sysMsgTime, SE_CHAR, wParam, 0, 0, NULL );
00451 break;
00452 }
00453
00454 return DefWindowProc( hWnd, uMsg, wParam, lParam );
00455 }
|
Here is the call graph for this function:

|
|
Definition at line 377 of file win_snd.c. References Com_Printf(), g_wv, WinVars_t::hWnd, pDS, and SNDDMA_Shutdown(). 00377 {
00378 if ( !pDS ) {
00379 return;
00380 }
00381
00382 if ( DS_OK != pDS->lpVtbl->SetCooperativeLevel( pDS, g_wv.hWnd, DSSCL_PRIORITY ) ) {
00383 Com_Printf ("sound SetCooperativeLevel failed\n");
00384 SNDDMA_Shutdown ();
00385 }
00386 }
|
Here is the call graph for this function:

|
|
Definition at line 151 of file win_snd.c. References dma_t::buffer, dma_t::channels, Com_DPrintf(), Com_Printf(), dma, format, g_wv, gSndBufSize, HRESULT(), WinVars_t::hWnd, memset(), NULL, pDS, pDSBuf, sample16, dma_t::samplebits, dma_t::samples, SNDDMA_BeginPainting(), SNDDMA_Shutdown(), SNDDMA_Submit(), dma_t::speed, and dma_t::submission_chunk. Referenced by SNDDMA_Init(). 00152 {
00153 HRESULT hresult;
00154 DSBUFFERDESC dsbuf;
00155 DSBCAPS dsbcaps;
00156 WAVEFORMATEX format;
00157 int use8;
00158
00159 Com_Printf( "Initializing DirectSound\n");
00160
00161 use8 = 1;
00162 // Create IDirectSound using the primary sound device
00163 if( FAILED( hresult = CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectSound8, (void **)&pDS))) {
00164 use8 = 0;
00165 if( FAILED( hresult = CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectSound, (void **)&pDS))) {
00166 Com_Printf ("failed\n");
00167 SNDDMA_Shutdown ();
00168 return qfalse;
00169 }
00170 }
00171
00172 hresult = pDS->lpVtbl->Initialize( pDS, NULL);
00173
00174 Com_DPrintf( "ok\n" );
00175
00176 Com_DPrintf("...setting DSSCL_PRIORITY coop level: " );
00177
00178 if ( DS_OK != pDS->lpVtbl->SetCooperativeLevel( pDS, g_wv.hWnd, DSSCL_PRIORITY ) ) {
00179 Com_Printf ("failed\n");
00180 SNDDMA_Shutdown ();
00181 return qfalse;
00182 }
00183 Com_DPrintf("ok\n" );
00184
00185
00186 // create the secondary buffer we'll actually work with
00187 dma.channels = 2;
00188 dma.samplebits = 16;
00189
00190 // if (s_khz->integer == 44)
00191 // dma.speed = 44100;
00192 // else if (s_khz->integer == 22)
00193 // dma.speed = 22050;
00194 // else
00195 // dma.speed = 11025;
00196
00197 dma.speed = 22050;
00198 memset (&format, 0, sizeof(format));
00199 format.wFormatTag = WAVE_FORMAT_PCM;
00200 format.nChannels = dma.channels;
00201 format.wBitsPerSample = dma.samplebits;
00202 format.nSamplesPerSec = dma.speed;
00203 format.nBlockAlign = format.nChannels * format.wBitsPerSample / 8;
00204 format.cbSize = 0;
00205 format.nAvgBytesPerSec = format.nSamplesPerSec*format.nBlockAlign;
00206
00207 memset (&dsbuf, 0, sizeof(dsbuf));
00208 dsbuf.dwSize = sizeof(DSBUFFERDESC);
00209
00210 // Micah: take advantage of 2D hardware.if available.
00211 dsbuf.dwFlags = DSBCAPS_LOCHARDWARE;
00212 if (use8) {
00213 dsbuf.dwFlags |= DSBCAPS_GETCURRENTPOSITION2;
00214 }
00215 dsbuf.dwBufferBytes = SECONDARY_BUFFER_SIZE;
00216 dsbuf.lpwfxFormat = &format;
00217
00218 memset(&dsbcaps, 0, sizeof(dsbcaps));
00219 dsbcaps.dwSize = sizeof(dsbcaps);
00220
00221 Com_DPrintf( "...creating secondary buffer: " );
00222 if (DS_OK == pDS->lpVtbl->CreateSoundBuffer(pDS, &dsbuf, &pDSBuf, NULL)) {
00223 Com_Printf( "locked hardware. ok\n" );
00224 }
00225 else {
00226 // Couldn't get hardware, fallback to software.
00227 dsbuf.dwFlags = DSBCAPS_LOCSOFTWARE;
00228 if (use8) {
00229 dsbuf.dwFlags |= DSBCAPS_GETCURRENTPOSITION2;
00230 }
00231 if (DS_OK != pDS->lpVtbl->CreateSoundBuffer(pDS, &dsbuf, &pDSBuf, NULL)) {
00232 Com_Printf( "failed\n" );
00233 SNDDMA_Shutdown ();
00234 return qfalse;
00235 }
00236 Com_DPrintf( "forced to software. ok\n" );
00237 }
00238
00239 // Make sure mixer is active
00240 if ( DS_OK != pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING) ) {
00241 Com_Printf ("*** Looped sound play failed ***\n");
00242 SNDDMA_Shutdown ();
00243 return qfalse;
00244 }
00245
00246 // get the returned buffer size
00247 if ( DS_OK != pDSBuf->lpVtbl->GetCaps (pDSBuf, &dsbcaps) ) {
00248 Com_Printf ("*** GetCaps failed ***\n");
00249 SNDDMA_Shutdown ();
00250 return qfalse;
00251 }
00252
00253 gSndBufSize = dsbcaps.dwBufferBytes;
00254
00255 dma.channels = format.nChannels;
00256 dma.samplebits = format.wBitsPerSample;
00257 dma.speed = format.nSamplesPerSec;
00258 dma.samples = gSndBufSize/(dma.samplebits/8);
00259 dma.submission_chunk = 1;
00260 dma.buffer = NULL; // must be locked first
00261
00262 sample16 = (dma.samplebits/8) - 1;
00263
00264 SNDDMA_BeginPainting ();
00265 if (dma.buffer)
00266 memset(dma.buffer, 0, dma.samples * dma.samplebits/8);
00267 SNDDMA_Submit ();
00268 return 1;
00269 }
|
Here is the call graph for this function:

|
|
Definition at line 514 of file unix_main.c. References field_t::buffer, com_dedicated, Com_DPrintf(), WinConData::consoleText, field_t::cursor, Field_Clear(), Field_CompleteCommand(), Hist_Add(), Hist_Next(), Hist_Prev(), i, NULL, read(), WinConData::returnedText, s_wcd, stdin_active, strcpy(), strlen(), tty_Back(), tty_con, tty_erase, tty_FlushIn(), tty_Hide(), tty_Show(), ttycon, cvar_s::value, and write(). 00515 {
00516 // we use this when sending back commands
00517 static char text[256];
00518 int i;
00519 int avail;
00520 char key;
00521 field_t *history;
00522
00523 if (ttycon && ttycon->value)
00524 {
00525 avail = read(0, &key, 1);
00526 if (avail != -1)
00527 {
00528 // we have something
00529 // backspace?
00530 // NOTE TTimo testing a lot of values .. seems it's the only way to get it to work everywhere
00531 if ((key == tty_erase) || (key == 127) || (key == 8))
00532 {
00533 if (tty_con.cursor > 0)
00534 {
00535 tty_con.cursor--;
00536 tty_con.buffer[tty_con.cursor] = '\0';
00537 tty_Back();
00538 }
00539 return NULL;
00540 }
00541 // check if this is a control char
00542 if ((key) && (key) < ' ')
00543 {
00544 if (key == '\n')
00545 {
00546 // push it in history
00547 Hist_Add(&tty_con);
00548 strcpy(text, tty_con.buffer);
00549 Field_Clear(&tty_con);
00550 key = '\n';
00551 write(1, &key, 1);
00552 return text;
00553 }
00554 if (key == '\t')
00555 {
00556 tty_Hide();
00557 Field_CompleteCommand( &tty_con );
00558 // Field_CompleteCommand does weird things to the string, do a cleanup
00559 // it adds a '\' at the beginning of the string
00560 // cursor doesn't reflect actual length of the string that's sent back
00561 tty_con.cursor = strlen(tty_con.buffer);
00562 if (tty_con.cursor>0)
00563 {
00564 if (tty_con.buffer[0] == '\\')
00565 {
00566 for (i=0; i<=tty_con.cursor; i++)
00567 {
00568 tty_con.buffer[i] = tty_con.buffer[i+1];
00569 }
00570 tty_con.cursor--;
00571 }
00572 }
00573 tty_Show();
00574 return NULL;
00575 }
00576 avail = read(0, &key, 1);
00577 if (avail != -1)
00578 {
00579 // VT 100 keys
00580 if (key == '[' || key == 'O')
00581 {
00582 avail = read(0, &key, 1);
00583 if (avail != -1)
00584 {
00585 switch (key)
00586 {
00587 case 'A':
00588 history = Hist_Prev();
00589 if (history)
00590 {
00591 tty_Hide();
00592 tty_con = *history;
00593 tty_Show();
00594 }
00595 tty_FlushIn();
00596 return NULL;
00597 break;
00598 case 'B':
00599 history = Hist_Next();
00600 tty_Hide();
00601 if (history)
00602 {
00603 tty_con = *history;
00604 } else
00605 {
00606 Field_Clear(&tty_con);
00607 }
00608 tty_Show();
00609 tty_FlushIn();
00610 return NULL;
00611 break;
00612 case 'C':
00613 return NULL;
00614 case 'D':
00615 return NULL;
00616 }
00617 }
00618 }
00619 }
00620 Com_DPrintf("droping ISCTL sequence: %d, tty_erase: %d\n", key, tty_erase);
00621 tty_FlushIn();
00622 return NULL;
00623 }
00624 // push regular character
00625 tty_con.buffer[tty_con.cursor] = key;
00626 tty_con.cursor++;
00627 // print the current line (this is differential)
00628 write(1, &key, 1);
00629 }
00630 return NULL;
00631 } else
00632 {
00633 int len;
00634 fd_set fdset;
00635 struct timeval timeout;
00636
00637 if (!com_dedicated || !com_dedicated->value)
00638 return NULL;
00639
00640 if (!stdin_active)
00641 return NULL;
00642
00643 FD_ZERO(&fdset);
00644 FD_SET(0, &fdset); // stdin
00645 timeout.tv_sec = 0;
00646 timeout.tv_usec = 0;
00647 if (select (1, &fdset, NULL, NULL, &timeout) == -1 || !FD_ISSET(0, &fdset))
00648 {
00649 return NULL;
00650 }
00651
00652 len = read (0, text, sizeof(text));
00653 if (len == 0)
00654 { // eof!
00655 stdin_active = qfalse;
00656 return NULL;
00657 }
00658
00659 if (len < 1)
00660 return NULL;
00661 text[len-1] = 0; // rip off the /n and terminate
00662
00663 return text;
00664 }
00665 }
|
Here is the call graph for this function:

|
|
Definition at line 295 of file win_syscon.c. References CLEAR_ID, COPY_ID, EDIT_ID, FALSE, g_wv, HDC(), WinConData::hfBufferFont, WinVars_t::hInstance, WinConData::hWnd, WinConData::hwndBuffer, WinConData::hwndButtonClear, WinConData::hwndButtonCopy, WinConData::hwndButtonQuit, WinConData::hwndInputLine, IDI_ICON1, INPUT_ID, InputLineWndProc(), LPARAM, memset(), NULL, QUIT_ID, rect, s_wcd, WinConData::SysInputLineWndProc, WinConData::visLevel, WinConData::windowHeight, WinConData::windowWidth, and WPARAM. Referenced by WinMain(). 00296 {
00297 HDC hDC;
00298 WNDCLASS wc;
00299 RECT rect;
00300 const char *DEDCLASS = "Q3 WinConsole";
00301 int nHeight;
00302 int swidth, sheight;
00303 int DEDSTYLE = WS_POPUPWINDOW | WS_CAPTION | WS_MINIMIZEBOX;
00304
00305 memset( &wc, 0, sizeof( wc ) );
00306
00307 wc.style = 0;
00308 wc.lpfnWndProc = (WNDPROC) ConWndProc;
00309 wc.cbClsExtra = 0;
00310 wc.cbWndExtra = 0;
00311 wc.hInstance = g_wv.hInstance;
00312 wc.hIcon = LoadIcon( g_wv.hInstance, MAKEINTRESOURCE(IDI_ICON1));
00313 wc.hCursor = LoadCursor (NULL,IDC_ARROW);
00314 wc.hbrBackground = (void *)COLOR_WINDOW;
00315 wc.lpszMenuName = 0;
00316 wc.lpszClassName = DEDCLASS;
00317
00318 if ( !RegisterClass (&wc) )
00319 return;
00320
00321 rect.left = 0;
00322 rect.right = 540;
00323 rect.top = 0;
00324 rect.bottom = 450;
00325 AdjustWindowRect( &rect, DEDSTYLE, FALSE );
00326
00327 hDC = GetDC( GetDesktopWindow() );
00328 swidth = GetDeviceCaps( hDC, HORZRES );
00329 sheight = GetDeviceCaps( hDC, VERTRES );
00330 ReleaseDC( GetDesktopWindow(), hDC );
00331
00332 s_wcd.windowWidth = rect.right - rect.left + 1;
00333 s_wcd.windowHeight = rect.bottom - rect.top + 1;
00334
00335 s_wcd.hWnd = CreateWindowEx( 0,
00336 DEDCLASS,
00337 "Quake 3 Console",
00338 DEDSTYLE,
00339 ( swidth - 600 ) / 2, ( sheight - 450 ) / 2 , rect.right - rect.left + 1, rect.bottom - rect.top + 1,
00340 NULL,
00341 NULL,
00342 g_wv.hInstance,
00343 NULL );
00344
00345 if ( s_wcd.hWnd == NULL )
00346 {
00347 return;
00348 }
00349
00350 //
00351 // create fonts
00352 //
00353 hDC = GetDC( s_wcd.hWnd );
00354 nHeight = -MulDiv( 8, GetDeviceCaps( hDC, LOGPIXELSY), 72);
00355
00356 s_wcd.hfBufferFont = CreateFont( nHeight,
00357 0,
00358 0,
00359 0,
00360 FW_LIGHT,
00361 0,
00362 0,
00363 0,
00364 DEFAULT_CHARSET,
00365 OUT_DEFAULT_PRECIS,
00366 CLIP_DEFAULT_PRECIS,
00367 DEFAULT_QUALITY,
00368 FF_MODERN | FIXED_PITCH,
00369 "Courier New" );
00370
00371 ReleaseDC( s_wcd.hWnd, hDC );
00372
00373 //
00374 // create the input line
00375 //
00376 s_wcd.hwndInputLine = CreateWindow( "edit", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER |
00377 ES_LEFT | ES_AUTOHSCROLL,
00378 6, 400, 528, 20,
00379 s_wcd.hWnd,
00380 ( HMENU ) INPUT_ID, // child window ID
00381 g_wv.hInstance, NULL );
00382
00383 //
00384 // create the buttons
00385 //
00386 s_wcd.hwndButtonCopy = CreateWindow( "button", NULL, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
00387 5, 425, 72, 24,
00388 s_wcd.hWnd,
00389 ( HMENU ) COPY_ID, // child window ID
00390 g_wv.hInstance, NULL );
00391 SendMessage( s_wcd.hwndButtonCopy, WM_SETTEXT, 0, ( LPARAM ) "copy" );
00392
00393 s_wcd.hwndButtonClear = CreateWindow( "button", NULL, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
00394 82, 425, 72, 24,
00395 s_wcd.hWnd,
00396 ( HMENU ) CLEAR_ID, // child window ID
00397 g_wv.hInstance, NULL );
00398 SendMessage( s_wcd.hwndButtonClear, WM_SETTEXT, 0, ( LPARAM ) "clear" );
00399
00400 s_wcd.hwndButtonQuit = CreateWindow( "button", NULL, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
00401 462, 425, 72, 24,
00402 s_wcd.hWnd,
00403 ( HMENU ) QUIT_ID, // child window ID
00404 g_wv.hInstance, NULL );
00405 SendMessage( s_wcd.hwndButtonQuit, WM_SETTEXT, 0, ( LPARAM ) "quit" );
00406
00407
00408 //
00409 // create the scrollbuffer
00410 //
00411 s_wcd.hwndBuffer = CreateWindow( "edit", NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER |
00412 ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY,
00413 6, 40, 526, 354,
00414 s_wcd.hWnd,
00415 ( HMENU ) EDIT_ID, // child window ID
00416 g_wv.hInstance, NULL );
00417 SendMessage( s_wcd.hwndBuffer, WM_SETFONT, ( WPARAM ) s_wcd.hfBufferFont, 0 );
00418
00419 s_wcd.SysInputLineWndProc = ( WNDPROC ) SetWindowLong( s_wcd.hwndInputLine, GWL_WNDPROC, ( long ) InputLineWndProc );
00420 SendMessage( s_wcd.hwndInputLine, WM_SETFONT, ( WPARAM ) s_wcd.hfBufferFont, 0 );
00421
00422 ShowWindow( s_wcd.hWnd, SW_SHOWDEFAULT);
00423 UpdateWindow( s_wcd.hWnd );
00424 SetForegroundWindow( s_wcd.hWnd );
00425 SetFocus( s_wcd.hwndInputLine );
00426
00427 s_wcd.visLevel = 1;
00428 }
|
Here is the call graph for this function:

|
|
Definition at line 433 of file win_syscon.c. References WinConData::hWnd, and s_wcd. Referenced by Sys_Error(), and Sys_Quit(). 00433 {
00434 if ( s_wcd.hWnd ) {
00435 ShowWindow( s_wcd.hWnd, SW_HIDE );
00436 CloseWindow( s_wcd.hWnd );
00437 DestroyWindow( s_wcd.hWnd );
00438 s_wcd.hWnd = 0;
00439 }
00440 }
|
|
||||||||||||
|
Definition at line 63 of file mac_net.c. References Com_Printf(), msg_t::cursize, msg_t::data, err(), netadr_t::ip, ip_socket, msg_t::maxsize, memcmp(), memset(), NET_AdrToString(), NET_ErrorString(), netadr_t::port, qboolean, msg_t::readcount, recvfromCount, SockadrToNetadr(), socksRelayAddr, netadr_t::type, and usingSocks. Referenced by Sys_GetEvent(). 00063 {
00064 return false;
00065 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||||||
|
Definition at line 796 of file macosx_input.m. References Com_Printf(), eventHead, eventQue, eventTail, sysEvent_t::evPtr, sysEvent_t::evPtrLength, sysEvent_t::evTime, sysEvent_t::evType, sysEvent_t::evValue, sysEvent_t::evValue2, i, in_showevents, cvar_s::integer, j, Sys_Milliseconds(), time(), type, value, and Z_Free(). Referenced by ConWndProc(), HandleEvents(), IN_DIMouse(), IN_JoyMove(), IN_MouseEvent(), IN_MouseMove(), MainWndProc(), MIDI_NoteOff(), MIDI_NoteOn(), processEvent(), processSystemDefinedEvent(), sendEventForCharacter(), sendEventForMaskChangeInFlags(), Sys_GetEvent(), and Sys_ProcessMouseMovedEvent(). 00796 {
00797 sysEvent_t *ev;
00798 int i,j;
00799 #ifndef DEDICATED
00800 if (in_showevents->integer)
00801 NSLog(@"EVENT ENQUEUE: time=%d type=%d value=0x%08x value2=0x%08x\n", time, type, value, value2);
00802 #endif
00803
00804 if ( eventHead - eventTail >= MAX_QUED_EVENTS ) {
00805 Com_Printf("Sys_QueEvent: overflow\n");
00806 }
00807
00808 if ( !time ) {
00809 time = Sys_Milliseconds();
00810 }
00811
00812 // insert it by time
00813 for ( i = eventTail ; i < eventHead ; i++ ) {
00814 ev = &eventQue[ i & MASK_QUED_EVENTS ];
00815 if ( ev->evTime > time ) {
00816 break;
00817 }
00818 }
00819
00820 // insert before i
00821 for ( j = eventHead ; j > i ; j-- ) {
00822 eventQue[ j & MASK_QUED_EVENTS ] = eventQue[ (j-1) & MASK_QUED_EVENTS ];
00823 }
00824 ev = &eventQue[ i & MASK_QUED_EVENTS ];
00825
00826 eventHead++;
00827
00828 ev->evTime = time;
00829 ev->evType = type;
00830 ev->evValue = value;
00831 ev->evValue2 = value2;
00832 ev->evPtrLength = ptrLength;
00833 ev->evPtr = ptr;
00834 }
|
Here is the call graph for this function:
