#include <windows.h>#include <windowsx.h>#include <winuser.h>#include <mmsystem.h>#include <Assert.h>#include "sal.h"#include <stdio.h>#include <dos.h>#include <malloc.h>#include <direct.h>#include <io.h>Go to the source code of this file.
Defines | |
| #define | DISABLED_BEHAVIOR |
| #define | WIN32_LEAN_AND_MEAN |
Functions | |
| long FAR PASCAL | MyWndProc (HWND hWindow, UINT message, WPARAM wParam, LPARAM lParam) |
| BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) |
| void | serve_queue (void) |
| RECT * | client_screen_rect (void) |
| void | MOUSE_event (unsigned long wParam, unsigned long lParam) |
| void | KEYDOWN_event (unsigned long wParam, unsigned long lParam) |
| void | KEYUP_event (unsigned long wParam, unsigned long lParam) |
| void | CHAR_event (unsigned long wParam, unsigned long lParam) |
| void | DIB_shutdown (void) |
| S32 | DIB_startup (S32 display_size_X, S32 display_size_Y, S32 display_bpp) |
| void | DIB_refresh_surface (void) |
| void | DIB_flip_surface (void) |
| DXDEF void WINAPI | SAL_blit_surface (void) |
| void | DIB_wipe_surface (S32 surface, U32 color) |
| void | DIB_lock_surface (S32 surface, U8 **ptr, S32 *pitch) |
| void | DIB_release_surface (S32 surface, S32 perform_flip) |
| DXDEF S32 WINAPI | SAL_startup (BOOL FileLog) |
| DXDEF void WINAPI | SAL_shutdown (void) |
| DXDEF S32 WINAPI | SAL_set_preference (U32 number, S32 value) |
| DXDEF S32 WINAPI | SAL_get_preference (U32 number) |
| DXDEF void __cdecl | SAL_debug_printf (char *fmt,...) |
| DXDEF void __cdecl | SAL_error_box (C8 *caption, C8 *fmt,...) |
| DXDEF BOOL WINAPI | SAL_set_main_window (HWND hWindow) |
| DXDEF S32 WINAPI | SAL_set_display_mode (S32 display_size_X, S32 display_size_Y, S32 display_bpp, S32 initial_window_mode, S32 allow_mode_switch) |
| DXDEF S32 WINAPI | SAL_window_status (void) |
| DXDEF void WINAPI | SAL_client_area (SAL_WINAREA *area) |
| DXDEF void WINAPI | SAL_window_area (SAL_WINAREA *area) |
| DXDEF S32 WINAPI | SAL_is_app_active (void) |
| DXDEF SALFOCUSCB WINAPI | SAL_register_focus_callback (SALFOCUSCB fn) |
| DXDEF WNDPROC WINAPI | SAL_register_WNDPROC (WNDPROC fn) |
| DXDEF void WINAPI | SAL_serve_message_queue (void) |
| DXDEF void WINAPI | SAL_set_palette_entry (S32 index, SAL_RGB32 *entry, S32 wait_flag) |
| DXDEF void WINAPI | SAL_get_palette_entry (S32 index, SAL_RGB32 *entry) |
| DXDEF void WINAPI | SAL_set_palette_range (S32 index, S32 num_entries, SAL_RGB32 *entry_list, S32 wait_flag) |
| DXDEF void WINAPI | SAL_get_palette_range (S32 index, S32 num_entries, SAL_RGB32 *entry_list) |
| DXDEF void WINAPI | SAL_flip_surface (void) |
| DXDEF void WINAPI | SAL_wipe_surface (S32 surface, U32 color) |
| DXDEF void WINAPI | SAL_lock_surface (S32 surface, U8 **ptr, S32 *pitch) |
| DXDEF void WINAPI | SAL_release_surface (S32 surface, S32 perform_flip) |
| DXDEF void WINAPI | SAL_lock_region (S32 surface, SAL_REGION region, U8 **ptr, S32 *pitch) |
| DXDEF void WINAPI | SAL_release_region (S32 surface, SAL_REGION region) |
| DXDEF void WINAPI | SAL_show_system_mouse (void) |
| DXDEF void WINAPI | SAL_hide_system_mouse (void) |
| DXDEF void WINAPI | SAL_constrain_mouse (void) |
| DXDEF void WINAPI | SAL_unconstrain_mouse (void) |
| DXDEF void WINAPI | SAL_get_pixel_format (S32 *pixel_pitch, S32 *bytes_per_pixel, S32 *R_shift, U32 *R_mask, S32 *R_width, S32 *G_shift, U32 *G_mask, S32 *G_width, S32 *B_shift, U32 *B_mask, S32 *B_width) |
| DXDEF HBITMAP WINAPI | GetDIBHandle (void) |
| DXDEF void WINAPI | SAL_GetBackBufferDC (HDC *dc) |
| DXDEF void WINAPI | SAL_ReleaseBackBufferDC (HDC dc) |
Variables | |
| S32 | desktop_w |
| S32 | desktop_h |
| S32 | cursor_state |
| S32 | show_count |
| char | debug_log_filename [256] |
| S32 | log_to_file |
| S32 | app_minimized |
| S32 | app_active |
| S32 | app_terminated |
| SALEXITCB | exit_callback |
| SALFOCUSCB | focus_callback |
| WNDPROC | window_callback |
| WNDPROC | OldWindowProc |
| HANDLE | hSem |
| S32 | mode_change_request |
| HINSTANCE | hAppInstance |
| HINSTANCE | hDLLInstance |
| char | szMyAppName [512] |
| HWND | hWnd |
| HANDLE | hHook |
| S32 | SAL_preference [N_SAL_PREFS] |
| S32 | mode_change_allowed |
| S32 | current_window_mode |
| S32 | current_bpp |
| S32 | current_size_X |
| S32 | current_size_Y |
| LOGPALETTE * | pLogPal |
| BITMAPINFO * | pbmi |
| BITMAPINFOHEADER * | pbmih |
| SAL_RGB32 | palette_state [256] |
| SAL_WINAREA | area |
| S32 | desktop_bpp |
| U32 | desktop_R_bitmask |
| U32 | desktop_G_bitmask |
| U32 | desktop_B_bitmask |
| U32 | DIB_R_bitmask |
| U32 | DIB_G_bitmask |
| U32 | DIB_B_bitmask |
| U32 | DIB_R_Shift |
| U32 | DIB_G_Shift |
| U32 | DIB_B_Shift |
| S32 | DIB_active |
| U8 * | lpDIBBuffer |
| HBITMAP | hDIB |
| HPALETTE | hPalette |
| S32 | palette_change_request |
| RECT | original_window_rect |
| SAL_WINAREA | original_area |
| LONG | OldWindowLong_GWL_STYLE |
| LONG | OldWindowLong_GWL_EXSTYLE |
| RECT | unconstrained_rect |
| S32 | constrain_state |
| S32 | constrain_request |
| HDC | Context |
| HBITMAP | DefaultBitmap |
|
|
Definition at line 40 of file W32SAL.CPP. |
|
|
Definition at line 43 of file W32SAL.CPP. |
|
||||||||||||
|
Definition at line 261 of file W32SAL.CPP.
00262 {
00263 }
|
|
|
Definition at line 222 of file W32SAL.CPP. References tagRECT::bottom, hWnd, tagRECT::left, tagRECT::right, and tagRECT::top. Referenced by SAL_client_area().
00223 {
00224 static RECT rect;
00225 POINT ul,lr;
00226
00227 GetClientRect(hWnd, &rect);
00228
00229 ul.x = rect.left;
00230 ul.y = rect.top;
00231 lr.x = rect.right;
00232 lr.y = rect.bottom;
00233
00234 ClientToScreen(hWnd, &ul);
00235 ClientToScreen(hWnd, &lr);
00236
00237 SetRect(&rect, ul.x, ul.y,
00238 lr.x-1, lr.y-1);
00239
00240 return ▭
00241 }
|
|
|
Definition at line 802 of file W32SAL.CPP. References DIB_refresh_surface(), and SAL_is_app_active(). Referenced by SAL_blit_surface(), and SAL_flip_surface().
00803 {
00804 //while (1)
00805 //{
00806 //serve_queue();
00807
00808 if (!SAL_is_app_active())
00809 {
00810 Sleep(10);
00811 }
00812 else
00813 {
00814 DIB_refresh_surface();
00815 //break;
00816 }
00817 //}
00818 }
|
|
||||||||||||||||
|
Definition at line 844 of file W32SAL.CPP. References current_bpp, current_size_X, lpDIBBuffer, and NULL. Referenced by SAL_lock_surface().
00847 {
00848 if (ptr != NULL)
00849 {
00850 *ptr = lpDIBBuffer;
00851 }
00852
00853 if (pitch != NULL)
00854 {
00855 *pitch = current_size_X * (current_bpp / 8);
00856 }
00857 }
|
|
|
Definition at line 730 of file W32SAL.CPP. References current_size_X, current_size_Y, desktop_bpp, hPalette, hWnd, lpDIBBuffer, palette_change_request, and pbmi. Referenced by DIB_flip_surface().
00731 {
00732 HDC hdc;
00733
00734 hdc = GetDC(hWnd);
00735
00736 //
00737 // Select palette if desktop running in 8-bit mode
00738 //
00739 // If palette has changed, realize it
00740 //
00741
00742 if (desktop_bpp == 8)
00743 {
00744 SelectPalette(hdc,
00745 hPalette,
00746 0);
00747
00748 if (palette_change_request)
00749 {
00750 palette_change_request = 0;
00751 RealizePalette(hdc);
00752 }
00753 }
00754
00755 //
00756 // Disable Boolean operations during stretching
00757 //
00758
00759 SetStretchBltMode(hdc, COLORONCOLOR);
00760
00761 //
00762 // Stretch bitmap to conform to the size of the output window
00763 //
00764 /*
00765 StretchDIBits(hdc, // Destination DC
00766 0, // Destination X
00767 0, // Destination Y
00768 area.width, // Destination (client area) width
00769 area.height, // Destination (client area) height
00770 0, // Source X
00771 0, // Source Y
00772 current_size_X, // Source (back buffer) width
00773 current_size_Y, // Source (back buffer) height
00774 lpDIBBuffer, // Pointer to source (back buffer)
00775 pbmi, // Bitmap info for back buffer
00776 DIB_RGB_COLORS, // Bitmap contains index values
00777 SRCCOPY); // Do normal copy with stretching
00778 */
00779 StretchDIBits(hdc, // Destination DC
00780 0, // Destination X
00781 0, // Destination Y
00782 current_size_X, // Destination (client area) width
00783 current_size_Y, // Destination (client area) height
00784 0, // Source X
00785 0, // Source Y
00786 current_size_X, // Source (back buffer) width
00787 current_size_Y, // Source (back buffer) height
00788 lpDIBBuffer, // Pointer to source (back buffer)
00789 pbmi, // Bitmap info for back buffer
00790 DIB_RGB_COLORS, // Bitmap contains index values
00791 SRCCOPY); // Do normal copy with stretching
00792
00793 ReleaseDC(hWnd, hdc);
00794 }
|
|
||||||||||||
|
Definition at line 865 of file W32SAL.CPP. References SAL_flip_surface(). Referenced by SAL_release_surface().
00867 {
00868 if (perform_flip)
00869 {
00870 SAL_flip_surface();
00871 }
00872 }
|
|
|
Definition at line 272 of file W32SAL.CPP. References constrain_request, constrain_state, DIB_active, hDIB, hPalette, NULL, SAL_BACK_SURFACE, SAL_flip_surface(), SAL_is_app_active(), SAL_wipe_surface(), and unconstrained_rect. Referenced by DIB_startup(), SAL_set_display_mode(), and SAL_shutdown().
00273 {
00274 if (constrain_state)
00275 {
00276 #ifndef DISABLED_BEHAVIOR
00277 ClipCursor(&unconstrained_rect);
00278 #endif
00279 constrain_request = 0;
00280 }
00281
00282 if (DIB_active && SAL_is_app_active())
00283 {
00284 SAL_wipe_surface(SAL_BACK_SURFACE, 0);
00285 SAL_flip_surface();
00286 }
00287
00288 if (hDIB != NULL)
00289 {
00290 DeleteObject(hDIB);
00291 hDIB = NULL;
00292 }
00293
00294 if (hPalette != NULL)
00295 {
00296 DeleteObject(hPalette);
00297 hPalette = NULL;
00298 }
00299 /*
00300 //
00301 // Make sure we restore the old hWnd parms
00302 //
00303 SetWindowLong(hWnd,
00304 GWL_STYLE,
00305 OldWindowLong_GWL_STYLE);
00306 SetWindowLong(hWnd,
00307 GWL_EXSTYLE,
00308 OldWindowLong_GWL_EXSTYLE);
00309 SetWindowPos(hWnd,
00310 HWND_TOP,
00311 original_area.x,
00312 original_area.y,
00313 original_area.width,
00314 original_area.height,
00315 SWP_NOCOPYBITS | SWP_NOZORDER);
00316
00317 ShowWindow(hWnd, SW_SHOWNORMAL);
00318 */
00319 DIB_active = 0;
00320 }
|
|
||||||||||||||||
|
Definition at line 328 of file W32SAL.CPP. References area, BITMAPINFOHEADER::biBitCount, BITMAPINFOHEADER::biClrImportant, BITMAPINFOHEADER::biClrUsed, BITMAPINFOHEADER::biCompression, BITMAPINFOHEADER::biHeight, BITMAPINFOHEADER::biPlanes, BITMAPINFOHEADER::biSize, BITMAPINFOHEADER::biSizeImage, BITMAPINFOHEADER::biWidth, BITMAPINFOHEADER::biXPelsPerMeter, BITMAPINFOHEADER::biYPelsPerMeter, constrain_request, constrain_state, desktop_B_bitmask, desktop_bpp, desktop_G_bitmask, desktop_h, desktop_R_bitmask, desktop_w, DIB_active, DIB_B_bitmask, DIB_G_bitmask, DIB_R_bitmask, DIB_shutdown(), FALSE, HBITMAP, hDIB, SAL_WINAREA::height, hPalette, hWnd, lpDIBBuffer, NULL, OldWindowLong_GWL_EXSTYLE, OldWindowLong_GWL_STYLE, original_area, original_window_rect, palette_change_request, pbmi, pbmih, pLogPal, S32, SAL_debug_printf(), SAL_error_box(), TRUE, U16, U32, SAL_WINAREA::width, SAL_WINAREA::x, and SAL_WINAREA::y. Referenced by SAL_set_display_mode().
00331 {
00332 HDC hdc;
00333 COLORREF color,save;
00334 RECT window_rect;
00335
00336 area.x = 0;
00337 area.y = 0;
00338 area.width = display_size_X;
00339 area.height = display_size_Y;
00340 original_area = area;
00341
00342 GetWindowRect(hWnd, &window_rect);
00343 original_window_rect = window_rect;
00344
00345 OldWindowLong_GWL_STYLE = GetWindowLong(hWnd, GWL_STYLE);
00346 OldWindowLong_GWL_EXSTYLE = GetWindowLong(hWnd, GWL_EXSTYLE);
00347
00348 display_size_X = area.width;
00349 display_size_Y = area.height;
00350
00351 // Get desktop size
00352 //
00353 /*
00354 desktop_w = GetSystemMetrics(SM_CXSCREEN);
00355 desktop_h = GetSystemMetrics(SM_CYSCREEN);
00356
00357 //
00358 // Enable caption menu and user preferences
00359 //
00360
00361 SetWindowLong(hWnd,
00362 GWL_STYLE,
00363 GetWindowLong(hWnd, GWL_STYLE) & ~WS_POPUP);
00364
00365 SetWindowLong(hWnd,
00366 GWL_STYLE,
00367 GetWindowLong(hWnd, GWL_STYLE) | (WS_OVERLAPPED |
00368 WS_CAPTION |
00369 WS_SYSMENU |
00370 WS_MINIMIZEBOX));
00371
00372 if (SAL_get_preference(SAL_ALLOW_WINDOW_RESIZE))
00373 {
00374 SetWindowLong(hWnd,
00375 GWL_STYLE,
00376 GetWindowLong(hWnd, GWL_STYLE) | WS_THICKFRAME |
00377 WS_MAXIMIZEBOX);
00378 }
00379
00380 if (SAL_get_preference(SAL_ALWAYS_ON_TOP))
00381 {
00382 SetWindowLong(hWnd,
00383 GWL_EXSTYLE,
00384 GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_TOPMOST);
00385 }
00386 else
00387 {
00388 SetWindowLong(hWnd,
00389 GWL_EXSTYLE,
00390 GetWindowLong(hWnd, GWL_EXSTYLE) & ~WS_EX_TOPMOST);
00391 }
00392
00393 //
00394 // If area not already established, center window's client area on
00395 // desktop, and size it to correspond to the display size for optimum
00396 // performance (no stretching needed)
00397 //
00398
00399 //if (area.width == -1)
00400 {
00401 area.width = display_size_X;
00402 area.height = display_size_Y;
00403
00404 area.x = ((desktop_w - area.width ) / 2);
00405 area.y = ((desktop_h - area.height) / 2);
00406 }
00407
00408 //
00409 // Calculate adjusted position of window
00410 //
00411 // Do not allow overall window size to exceed desktop size; keep
00412 // dividing height and width by 2 until entire window fits
00413 //
00414 // If window is offscreen (or almost entirely offscreen), center it
00415 //
00416
00417 do
00418 {
00419 retry = 0;
00420
00421 window_rect.left = area.x;
00422 window_rect.right = area.x + area.width - 1;
00423 window_rect.top = area.y;
00424 window_rect.bottom = area.y + area.height - 1;
00425
00426 AdjustWindowRectEx(&window_rect,
00427 GetWindowLong(hWnd, GWL_STYLE),
00428 (GetMenu(hWnd) != NULL),
00429 GetWindowLong(hWnd, GWL_EXSTYLE));
00430
00431 if ((window_rect.right - window_rect.left + 1) > desktop_w)
00432 {
00433 area.width >>= 1;
00434 area.x = ((desktop_w - area.width ) / 2);
00435 retry = 1;
00436 }
00437
00438 if ((window_rect.bottom - window_rect.top + 1) > desktop_h)
00439 {
00440 area.height >>= 1;
00441 area.y = ((desktop_h - area.height) / 2);
00442 retry = 1;
00443 }
00444
00445 if ((window_rect.left >= (desktop_w-16)) ||
00446 (window_rect.top >= (desktop_h-16)) ||
00447 (window_rect.right <= 16) ||
00448 (window_rect.bottom <= 16))
00449 {
00450 area.x = ((desktop_w - area.width ) / 2);
00451 area.y = ((desktop_h - area.height) / 2);
00452 retry = 1;
00453 }
00454 }
00455 while (retry);
00456
00457 //
00458 // Save window and client areas for restoration if maximize button pressed
00459 //
00460
00461 original_window_rect = window_rect;
00462 original_area = area;
00463
00464 //
00465 // Set window size and position
00466 //
00467
00468 SetWindowPos(hWnd,
00469 HWND_TOP,
00470 window_rect.left,
00471 window_rect.top,
00472 window_rect.right - window_rect.left + 1,
00473 window_rect.bottom - window_rect.top + 1,
00474 SWP_NOCOPYBITS | SWP_NOZORDER);
00475
00476 GetClientRect(hWnd,
00477 &client_rect);
00478
00479 SAL_debug_printf("SAL: Window at (%d,%d), client size = (%d,%d)\n",
00480 window_rect.left,
00481 window_rect.top,
00482 client_rect.right,
00483 client_rect.bottom);
00484
00485 //
00486 // Make window visible
00487 //
00488
00489 ShowWindow(hWnd, SW_SHOWNORMAL);
00490
00491 //
00492 // If mouse is constrained, limit its travel to the window area
00493 //
00494
00495 */
00496
00497 if (constrain_state)
00498 {
00499 constrain_request = 1;
00500 }
00501
00502 //
00503 // Init DIB globals
00504 //
00505
00506 hDIB = NULL;
00507 lpDIBBuffer = NULL;
00508 hPalette = NULL;
00509
00510 pbmih->biSize = sizeof(BITMAPINFOHEADER);
00511 pbmih->biWidth = (display_size_X);
00512 pbmih->biHeight = -(display_size_Y);
00513 pbmih->biPlanes = 1;
00514 pbmih->biBitCount = (U16) display_bpp;
00515 pbmih->biSizeImage = 0;
00516 pbmih->biXPelsPerMeter = 0;
00517 pbmih->biYPelsPerMeter = 0;
00518 pbmih->biClrUsed = 0;
00519 pbmih->biClrImportant = 0;
00520
00521 //
00522 // Get Windows desktop display format (and masks, in high-color modes)
00523 //
00524
00525 hdc = GetDC(hWnd);
00526
00527 desktop_bpp = GetDeviceCaps(hdc, BITSPIXEL) *
00528 GetDeviceCaps(hdc, PLANES);
00529
00530 SAL_debug_printf("SAL: Desktop = %dx%d, %d BPP\n",desktop_w,
00531 desktop_h,
00532 desktop_bpp);
00533
00534 if(desktop_bpp > 8)
00535 {
00536 HBITMAP TempBmp;
00537 BITMAPINFO TempInfo;
00538 OSVERSIONINFO WinVer;
00539
00540 memset(&WinVer, 0, sizeof(OSVERSIONINFO));
00541 WinVer.dwOSVersionInfoSize =sizeof(OSVERSIONINFO);
00542
00543 GetVersionEx(&WinVer);
00544 if(WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT)
00545 {
00546 TempBmp =CreateCompatibleBitmap(hdc, 8, 8);
00547 if(TempBmp)
00548 {
00549 memset(&TempInfo, 0, sizeof(BITMAPINFO));
00550 TempInfo.bmiHeader.biSize =sizeof(BITMAPINFO);
00551 TempInfo.bmiHeader.biBitCount =(U16)desktop_bpp;
00552 TempInfo.bmiHeader.biCompression =BI_BITFIELDS;
00553
00554 if(GetDIBits(hdc, TempBmp, 0, 0, NULL, &TempInfo, DIB_RGB_COLORS))
00555 {
00556 desktop_R_bitmask =*((U32 *)&TempInfo.bmiColors[0]);
00557 desktop_G_bitmask =*((U32 *)&TempInfo.bmiColors[1]);
00558 desktop_B_bitmask =*((U32 *)&TempInfo.bmiColors[2]);
00559
00560 SAL_debug_printf("(%x-%x-%x)\n", desktop_R_bitmask, desktop_G_bitmask, desktop_B_bitmask);
00561 }
00562 DeleteObject(TempBmp);
00563 }
00564 }
00565 else
00566 {
00567 save = GetPixel(hdc,0,0);
00568
00569 SetPixel(hdc,0,0,RGB(0x08,0x08,0x08));
00570
00571 color = GetPixel(hdc,0,0) & 0xffffff;
00572
00573 SAL_debug_printf("SAL: Desktop pixel format = 0x%X ",color);
00574
00575 switch (color)
00576 {
00577 //
00578 // 0x000000 = 5-5-5
00579 //
00580
00581 case 0x000000:
00582
00583 SAL_debug_printf("(5-5-5)\n");
00584
00585 desktop_R_bitmask = 0x007c00;
00586 desktop_G_bitmask = 0x0003e0;
00587 desktop_B_bitmask = 0x00001f;
00588 break;
00589
00590 //
00591 // 0x000800 = 5-6-5
00592 //
00593
00594 case 0x000800:
00595
00596 SAL_debug_printf("(5-6-5)\n");
00597
00598 desktop_R_bitmask = 0x00f800;
00599 desktop_G_bitmask = 0x0007e0;
00600 desktop_B_bitmask = 0x00001f;
00601 break;
00602
00603 //
00604 // 0x080808 = 8-8-8
00605 //
00606
00607 case 0x080808:
00608
00609 SAL_debug_printf("(8-8-8)\n");
00610
00611 desktop_R_bitmask = 0xff0000;
00612 desktop_G_bitmask = 0x00ff00;
00613 desktop_B_bitmask = 0x0000ff;
00614 break;
00615
00616 default:
00617
00618 SAL_debug_printf("(Unsupported, using 5-6-5)\n");
00619
00620 if ((desktop_bpp == 15) || (desktop_bpp == 16))
00621 {
00622 desktop_R_bitmask = 0x00f800;
00623 desktop_G_bitmask = 0x0007e0;
00624 desktop_B_bitmask = 0x00001f;
00625 }
00626 break;
00627 }
00628
00629 SetPixel(hdc,0,0,save);
00630 }
00631 }
00632 ReleaseDC(hWnd, hdc);
00633
00634 //
00635 // If DIB and desktop are both in 15/16-BPP mode, set DIB to desktop
00636 // pixel format for maximum throughput
00637 //
00638 // Otherwise, set DIB to 5-6-5 mode if 16BPP DIB requested, or 8-8-8 mode
00639 // if 24BPP DIB requested
00640 //
00641 // Finally, if 8BPP DIB requested, create GDI palette object based on
00642 // current logical palette
00643 //
00644
00645 switch (display_bpp)
00646 {
00647 case 8:
00648
00649 pbmih->biCompression = BI_RGB;
00650
00651 hPalette = CreatePalette(pLogPal);
00652 palette_change_request = TRUE;
00653 break;
00654
00655 case 16:
00656
00657 pbmih->biCompression = BI_BITFIELDS;
00658
00659 if ((desktop_bpp == 15) || (desktop_bpp == 16))
00660 {
00661 *(U32 *) (&(pbmi->bmiColors[0])) = desktop_R_bitmask;
00662 *(U32 *) (&(pbmi->bmiColors[1])) = desktop_G_bitmask;
00663 *(U32 *) (&(pbmi->bmiColors[2])) = desktop_B_bitmask;
00664 DIB_R_bitmask = desktop_R_bitmask;
00665 DIB_G_bitmask = desktop_G_bitmask;
00666 DIB_B_bitmask = desktop_B_bitmask;
00667
00668 }
00669 else
00670 {
00671 *(U32 *) (&(pbmi->bmiColors[0])) = 0x00f800;
00672 *(U32 *) (&(pbmi->bmiColors[1])) = 0x0007e0;
00673 *(U32 *) (&(pbmi->bmiColors[2])) = 0x00001f;
00674 DIB_R_bitmask = 0x00f800;
00675 DIB_G_bitmask = 0x0007e0;
00676 DIB_B_bitmask = 0x00001f;
00677 }
00678 break;
00679
00680 case 24:
00681
00682 pbmih->biCompression = BI_BITFIELDS;
00683
00684 *(U32 *) (&(pbmi->bmiColors[0])) = 0xff0000;
00685 *(U32 *) (&(pbmi->bmiColors[1])) = 0x00ff00;
00686 *(U32 *) (&(pbmi->bmiColors[2])) = 0x0000ff;
00687 DIB_R_bitmask = 0xff0000;
00688 DIB_G_bitmask = 0x00ff00;
00689 DIB_B_bitmask = 0x0000ff;
00690 break;
00691 }
00692
00693 //
00694 // Allocate the DIB section ("back buffer")
00695 //
00696
00697 hdc = GetDC(hWnd);
00698
00699 hDIB = CreateDIBSection(hdc, // Device context
00700 pbmi, // BITMAPINFO structure
00701 DIB_RGB_COLORS, // Color data type
00702 (void **) &lpDIBBuffer, // Address of image map pointer
00703 NULL, // File
00704 0); // Bitmap file offset
00705
00706 ReleaseDC(hWnd, hdc);
00707
00708 if (hDIB == NULL)
00709 {
00710 SAL_error_box(NULL,"CreateDIBSection() failed\n");
00711 DIB_shutdown();
00712 return FALSE;
00713 }
00714
00715 //
00716 // Set global flag to indicate CreateDIBSection() is active
00717 //
00718
00719 DIB_active = 1;
00720
00721 return TRUE;
00722 }
|
|
||||||||||||
|
Definition at line 830 of file W32SAL.CPP. References current_bpp, current_size_X, current_size_Y, and lpDIBBuffer. Referenced by SAL_wipe_surface().
00832 {
00833 memset(lpDIBBuffer,
00834 color,
00835 current_size_X * current_size_Y * (current_bpp / 8));
00836 }
|
|
||||||||||||||||
|
Definition at line 162 of file W32SAL.CPP. References hDLLInstance, and TRUE.
00165 {
00166 if (fdwReason == DLL_PROCESS_ATTACH)
00167 {
00168 hDLLInstance = hinstDLL;
00169 }
00170
00171 return TRUE;
00172 }
|
|
|
Definition at line 1835 of file W32SAL.CPP. References DXDEF, HBITMAP, and hDIB.
01836 {
01837 return hDIB;
01838 }
|
|
||||||||||||
|
Definition at line 253 of file W32SAL.CPP.
00254 {
00255 }
|
|
||||||||||||
|
Definition at line 257 of file W32SAL.CPP.
00258 {
00259 }
|
|
||||||||||||
|
Definition at line 249 of file W32SAL.CPP.
00250 {
00251 }
|
|
||||||||||||||||||||
|
|
|
|
Definition at line 820 of file W32SAL.CPP. References DIB_flip_surface(), and DXDEF. Referenced by EndScene().
00821 {
00822 DIB_flip_surface();
00823 }
|
|
|
Definition at line 1284 of file W32SAL.CPP. References area, tagRECT::bottom, client_screen_rect(), DIB_active, DXDEF, SAL_WINAREA::height, tagRECT::left, tagRECT::right, tagRECT::top, SAL_WINAREA::width, SAL_WINAREA::x, and SAL_WINAREA::y.
|
|
|
Definition at line 1687 of file W32SAL.CPP. References constrain_request, constrain_state, DIB_active, and DXDEF.
01688 {
01689 constrain_state = 1;
01690
01691 if (DIB_active)
01692 {
01693 constrain_request = 1;
01694 }
01695 }
|
|
||||||||||||
|
Definition at line 1033 of file W32SAL.CPP. References debug_log_filename, DXDEF, log_to_file, and NULL. Referenced by DIB_startup(), SAL_error_box(), and SAL_serve_message_queue().
01034 {
01035 static char work_string[4096];
01036 FILE *log;
01037
01038 if ((fmt == NULL) || (strlen(fmt) > sizeof(work_string)))
01039 {
01040 strcpy(work_string, "(String missing or too large)");
01041 }
01042 else
01043 {
01044 va_list ap;
01045
01046 va_start(ap,
01047 fmt);
01048
01049 vsprintf(work_string,
01050 fmt,
01051 ap);
01052
01053 va_end (ap);
01054 }
01055
01056 if (log_to_file)
01057 {
01058 log = fopen(debug_log_filename,"a+t");
01059
01060 if (log != NULL)
01061 {
01062 fprintf(log,"%s\n",work_string);
01063 fclose(log);
01064 }
01065 }
01066
01067 OutputDebugString(work_string);
01068 }
|
|
||||||||||||||||
|
Definition at line 1076 of file W32SAL.CPP. References cursor_state, DXDEF, hWnd, NULL, S32, and SAL_debug_printf(). Referenced by DIB_startup().
01077 {
01078 static char work_string[4096];
01079 S32 restore_cursor;
01080
01081 restore_cursor = cursor_state;
01082
01083 if (!cursor_state)
01084 {
01085 #ifndef DISABLED_BEHAVIOR
01086 ShowCursor(1);
01087 #endif
01088 }
01089
01090 if ((fmt == NULL) || (strlen(fmt) > sizeof(work_string)))
01091 {
01092 strcpy(work_string, "(String missing or too large)");
01093 }
01094 else
01095 {
01096 va_list ap;
01097
01098 va_start(ap,
01099 fmt);
01100
01101 vsprintf(work_string,
01102 fmt,
01103 ap);
01104
01105 va_end (ap);
01106 }
01107
01108 SAL_debug_printf("%s\n",work_string);
01109
01110 //
01111 // If DirectDraw active, display GDI surface for dialog box
01112 //
01113
01114 //
01115 // If in 8-bpp mode, save current palette and switch to standard palette
01116 //
01117
01118 if (caption == NULL)
01119 {
01120 MessageBox(hWnd,
01121 work_string,
01122 "SAL Error",
01123 MB_OK);
01124 }
01125 else
01126 {
01127 MessageBox(hWnd,
01128 work_string,
01129 caption,
01130 MB_OK);
01131 }
01132
01133 if (!restore_cursor)
01134 {
01135 #ifndef DISABLED_BEHAVIOR
01136 ShowCursor(0);
01137 #endif
01138 }
01139 }
|
|
|
Definition at line 1548 of file W32SAL.CPP. References DIB_active, DIB_flip_surface(), and DXDEF. Referenced by DIB_release_surface(), and DIB_shutdown().
01549 {
01550 if (DIB_active)
01551 {
01552 DIB_flip_surface();
01553 }
01554 }
|
|
||||||||||||
|
Definition at line 1462 of file W32SAL.CPP. References DXDEF, and palette_state.
01464 {
01465 *entry = palette_state[index];
01466 }
|
|
||||||||||||||||
|
Definition at line 1532 of file W32SAL.CPP. References DXDEF, and palette_state.
01535 {
01536 for (int i=0; i < num_entries; i++)
01537 {
01538 entry_list[i] = palette_state[index+i];
01539 }
01540 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 1722 of file W32SAL.CPP. References current_bpp, DIB_active, DIB_B_bitmask, DIB_G_bitmask, DIB_R_bitmask, DXDEF, NULL, S32, and U32. Referenced by SysInit().
01734 {
01735 S32 red_shift;
01736 U32 red_mask;
01737 S32 red_width;
01738 S32 grn_shift;
01739 U32 grn_mask;
01740 S32 grn_width;
01741 S32 blu_shift;
01742 U32 blu_mask;
01743 S32 blu_width;
01744 S32 i;
01745
01746 //
01747 // Handle palettized (8 BPP) modes
01748 //
01749 // Write 8-bit pixel pitch and visible bytes/pixel fields
01750 // If we're in 8BPP mode, exit without altering RGB fields
01751 //
01752
01753 if (current_bpp == 8)
01754 {
01755 if (pixel_pitch != NULL) *pixel_pitch = 1;
01756 if (bytes_per_pixel != NULL) *bytes_per_pixel = 1;
01757
01758 return;
01759 }
01760
01761 //
01762 // Handle hi-color (16+ BPP) modes
01763 //
01764 // If using DirectDraw, do a GetPixelFormat() call
01765 //
01766 // If using CreateDIBSection(), return mask values used to create DIB
01767 //
01768
01769 if (DIB_active)
01770 {
01771 if (pixel_pitch != NULL) *pixel_pitch = (current_bpp / 8);
01772 if (bytes_per_pixel != NULL) *bytes_per_pixel = (current_bpp / 8);
01773
01774 red_mask = DIB_R_bitmask;
01775 grn_mask = DIB_G_bitmask;
01776 blu_mask = DIB_B_bitmask;
01777 }
01778
01779 //
01780 // Derive shift, width values from masks
01781 //
01782
01783 for (i=31; i >= 0; i--)
01784 {
01785 if (red_mask & (1 << i))
01786 {
01787 red_shift = i;
01788 }
01789
01790 if (grn_mask & (1 << i))
01791 {
01792 grn_shift = i;
01793 }
01794
01795 if (blu_mask & (1 << i))
01796 {
01797 blu_shift = i;
01798 }
01799 }
01800
01801 for (i=0; i <= 31; i++)
01802 {
01803 if (red_mask & (1 << i))
01804 {
01805 red_width = i - red_shift + 1;
01806 }
01807
01808 if (grn_mask & (1 << i))
01809 {
01810 grn_width = i - grn_shift + 1;
01811 }
01812
01813 if (blu_mask & (1 << i))
01814 {
01815 blu_width = i - blu_shift + 1;
01816 }
01817 }
01818 //
01819 // Pass all requested values back to the caller
01820 //
01821
01822 if (R_shift != NULL) *R_shift = red_shift;
01823 if (G_shift != NULL) *G_shift = grn_shift;
01824 if (B_shift != NULL) *B_shift = blu_shift;
01825
01826 if (R_mask != NULL) *R_mask = red_mask;
01827 if (G_mask != NULL) *G_mask = grn_mask;
01828 if (B_mask != NULL) *B_mask = blu_mask;
01829
01830 if (R_width != NULL) *R_width = red_width;
01831 if (G_width != NULL) *G_width = grn_width;
01832 if (B_width != NULL) *B_width = blu_width;
01833 }
|
|
|
Definition at line 1020 of file W32SAL.CPP. References DXDEF, S32, and SAL_preference.
01021 {
01022 return SAL_preference[number];
01023 }
|
|
|
Definition at line 1840 of file W32SAL.CPP. References DefaultBitmap, DIB_active, DXDEF, and hDIB.
01841 {
01842 if (DIB_active)
01843 {
01844 *dc = CreateCompatibleDC ( 0 );
01845 DefaultBitmap = SelectBitmap ( *dc, hDIB );
01846 }
01847 }
|
|
|
Definition at line 1660 of file W32SAL.CPP. References cursor_state, DXDEF, and show_count.
01661 {
01662 --show_count;
01663
01664 if (show_count == 0)
01665 {
01666 //
01667 // Show count has become 0, so hide mouse cursor if it's currently
01668 // visible
01669 //
01670
01671 if (cursor_state)
01672 {
01673 cursor_state = 0;
01674 #ifndef DISABLED_BEHAVIOR
01675 ShowCursor(0);
01676 #endif
01677 }
01678 }
01679 }
|
|
|
Definition at line 1328 of file W32SAL.CPP. References app_active, DXDEF, and S32. Referenced by DIB_flip_surface(), and DIB_shutdown().
01329 {
01330 return app_active;
01331 }
|
|
||||||||||||||||||||
|
Definition at line 1608 of file W32SAL.CPP. References DXDEF.
01612 {
01613
01614 }
|
|
||||||||||||||||
|
Definition at line 1577 of file W32SAL.CPP. References DIB_active, DIB_lock_surface(), and DXDEF. Referenced by BeginScene().
01580 {
01581 if (DIB_active)
01582 {
01583 DIB_lock_surface(surface, ptr, pitch);
01584 }
01585 }
|
|
|
Definition at line 1339 of file W32SAL.CPP. References DXDEF, and focus_callback.
01340 {
01341 SALFOCUSCB old;
01342
01343 old = focus_callback;
01344
01345 focus_callback = fn;
01346
01347 return old;
01348 }
|
|
|
Definition at line 1356 of file W32SAL.CPP. References DXDEF, and window_callback.
01357 {
01358 WNDPROC old;
01359
01360 old = window_callback;
01361
01362 window_callback = fn;
01363
01364 return old;
01365 }
|
|
||||||||||||
|
Definition at line 1622 of file W32SAL.CPP. References DXDEF.
01624 {
01625 }
|
|
||||||||||||
|
Definition at line 1593 of file W32SAL.CPP. References DIB_active, DIB_release_surface(), and DXDEF. Referenced by EndScene().
01595 {
01596 if (DIB_active)
01597 {
01598 DIB_release_surface(surface, perform_flip);
01599 }
01600 }
|
|
|
Definition at line 1849 of file W32SAL.CPP. References DefaultBitmap, DIB_active, and DXDEF.
01850 {
01851
01852 if (DIB_active)
01853 {
01854 SelectBitmap ( dc, DefaultBitmap );
01855 DeleteDC ( dc );
01856 DeleteObject ( DefaultBitmap );
01857 }
01858 }
|
|
|
Definition at line 1373 of file W32SAL.CPP. References current_bpp, current_size_X, current_size_Y, current_window_mode, DXDEF, mode_change_allowed, mode_change_request, S32, SAL_debug_printf(), SAL_FULLSCREEN, SAL_set_display_mode(), SAL_WINDOW, serve_queue(), and TRUE. Referenced by EndScene().
01374 {
01375 S32 result;
01376
01377 serve_queue();
01378
01379 if (mode_change_request && mode_change_allowed)
01380 {
01381 mode_change_request = 0;
01382
01383 result = SAL_set_display_mode(
01384 current_size_X,
01385 current_size_Y,
01386 current_bpp,
01387 current_window_mode ^ (SAL_FULLSCREEN ^ SAL_WINDOW),
01388 TRUE);
01389
01390 //
01391 // If window mode toggle did not succeed, restore original mode
01392 //
01393
01394 if (!result)
01395 {
01396 SAL_debug_printf("SAL: SAL_set_display_mode() failed, restoring old mode\n");
01397
01398 SAL_set_display_mode(
01399 current_size_X,
01400 current_size_Y,
01401 current_bpp,
01402 current_window_mode,
01403 TRUE);
01404 }
01405 }
01406 }
|
|
||||||||||||||||||||||||
|
Definition at line 1160 of file W32SAL.CPP. References current_bpp, current_size_X, current_size_Y, current_window_mode, cursor_state, DIB_active, DIB_shutdown(), DIB_startup(), DXDEF, FALSE, mode_change_allowed, S32, SAL_FULLSCREEN, SAL_TRY_FULLSCREEN, SAL_WINDOW, and show_count. Referenced by DrvInit(), and SAL_serve_message_queue().
01165 {
01166 S32 result;
01167
01168 //
01169 // Shut down current video mode
01170 //
01171
01172 if (DIB_active)
01173 {
01174 DIB_shutdown();
01175 }
01176
01177 //
01178 // Hide or show mouse cursor, as appropriate
01179 //
01180
01181 if (show_count < 1)
01182 {
01183 //
01184 // Hide mouse cursor if it's currently visible
01185 //
01186
01187 if (cursor_state)
01188 {
01189 cursor_state = 0;
01190 #ifndef DISABLED_BEHAVIOR
01191 ShowCursor(0);
01192 #endif
01193
01194 }
01195 }
01196 else
01197 {
01198 //
01199 // Show mouse cursor if it's currently hidden
01200 //
01201
01202 if (!cursor_state)
01203 {
01204 cursor_state = 1;
01205 #ifndef DISABLED_BEHAVIOR
01206 ShowCursor(1);
01207 #endif
01208 }
01209 }
01210
01211 //
01212 // Start up new video mode
01213 //
01214
01215 if (initial_window_mode == SAL_FULLSCREEN)
01216 {
01217 //
01218 // SAL_FULLSCREEN: Set up fullscreen video mode using DirectDraw
01219 //
01220
01221 }
01222 else if (initial_window_mode == SAL_WINDOW)
01223 {
01224 //
01225 // SAL_WINDOW: Set up window using CreateDIBSection()
01226 //
01227
01228 result = DIB_startup(display_size_X,
01229 display_size_Y,
01230 display_bpp);
01231 }
01232 else if (initial_window_mode == SAL_TRY_FULLSCREEN)
01233 {
01234 assert(0);
01235
01236 //
01237 // SAL_TRY_FULLSCREEN: Use DirectDraw if possible/available, otherwise
01238 // fall back automatically to CreateDIBSection()
01239 //
01240
01241 }
01242 else
01243 {
01244 //
01245 // Unknown window mode, return failure
01246 //
01247
01248 return FALSE;
01249 }
01250
01251 //
01252 // If successful, update global variables to reflect new video mode
01253 //
01254
01255 if (result)
01256 {
01257 mode_change_allowed = allow_mode_switch;
01258 current_window_mode = initial_window_mode;
01259 current_bpp = display_bpp;
01260 current_size_X = display_size_X;
01261 current_size_Y = display_size_Y;
01262 }
01263
01264 return result;
01265 }
|
|
|
Definition at line 1141 of file W32SAL.CPP. References app_active, DXDEF, hWnd, and TRUE. Referenced by DrvInit().
01142 {
01143 hWnd = hWindow;
01144
01145 app_active = TRUE;
01146
01147 // OldWindowProc = (WNDPROC)SetWindowLong( hWnd, GWL_WNDPROC, (LONG)MyWndProc);
01148
01149 // if (!OldWindowProc)
01150 // return FALSE;
01151
01152 return TRUE;
01153 }
|
|
||||||||||||||||
|
Definition at line 1414 of file W32SAL.CPP. References current_bpp, DIB_active, DXDEF, hPalette, NULL, palette_change_request, palette_state, pbmi, pLogPal, and TRUE.
01417 {
01418 //
01419 // If we're not in 8BPP mode, bail out
01420 //
01421
01422 if (current_bpp != 8)
01423 {
01424 return;
01425 }
01426
01427 //
01428 // Update global palette state
01429 //
01430
01431 palette_state[index] = *entry;
01432
01433 pLogPal->palPalEntry[index].peRed = pbmi->bmiColors[index].rgbRed = (unsigned char) entry->r;
01434 pLogPal->palPalEntry[index].peGreen = pbmi->bmiColors[index].rgbGreen = (unsigned char) entry->g;
01435 pLogPal->palPalEntry[index].peBlue = pbmi->bmiColors[index].rgbBlue = (unsigned char) entry->b;
01436 pLogPal->palPalEntry[index].peFlags = NULL;
01437
01438 //
01439 // Update DirectDraw palette, if appropriate
01440 //
01441
01442
01443 if (DIB_active)
01444 {
01445 if (hPalette != NULL)
01446 {
01447 DeleteObject(hPalette);
01448 }
01449
01450 hPalette = CreatePalette(pLogPal);
01451
01452 palette_change_request = TRUE;
01453 }
01454 }
|
|
||||||||||||||||||||
|
Definition at line 1474 of file W32SAL.CPP. References SAL_RGB32::b, current_bpp, DIB_active, DXDEF, SAL_RGB32::g, hPalette, NULL, palette_change_request, palette_state, pbmi, pLogPal, SAL_RGB32::r, S32, and TRUE.
01478 {
01479 S32 i;
01480 S32 j;
01481
01482 //
01483 // If we're not in 8BPP mode, bail out
01484 //
01485
01486 if (current_bpp != 8)
01487 {
01488 return;
01489 }
01490
01491 //
01492 // Update global palette state
01493 //
01494
01495 for (i=0; i < num_entries; i++)
01496 {
01497 palette_state[index+i] = entry_list[i];
01498 }
01499
01500 for (i=0, j=index; i < num_entries; i++, j++)
01501 {
01502 pLogPal->palPalEntry[j].peRed = pbmi->bmiColors[j].rgbRed = (unsigned char) entry_list[i].r;
01503 pLogPal->palPalEntry[j].peGreen = pbmi->bmiColors[j].rgbGreen = (unsigned char) entry_list[i].g;
01504 pLogPal->palPalEntry[j].peBlue = pbmi->bmiColors[j].rgbBlue = (unsigned char) entry_list[i].b;
01505 pLogPal->palPalEntry[j].peFlags = NULL;
01506 }
01507
01508 //
01509 // Update DirectDraw palette, if appropriate
01510 //
01511
01512
01513 if (DIB_active)
01514 {
01515 if (hPalette != NULL)
01516 {
01517 DeleteObject(hPalette);
01518 }
01519
01520 hPalette = CreatePalette(pLogPal);
01521
01522 palette_change_request = TRUE;
01523 }
01524 }
|
|
||||||||||||
|
Definition at line 1003 of file W32SAL.CPP. References DXDEF, S32, and SAL_preference.
01004 {
01005 S32 old;
01006
01007 old = SAL_preference[number];
01008
01009 SAL_preference[number] = value;
01010
01011 return old;
01012 }
|
|
|
Definition at line 1633 of file W32SAL.CPP. References cursor_state, DXDEF, and show_count.
01634 {
01635 ++show_count;
01636
01637 if (show_count == 1)
01638 {
01639 //
01640 // Show count has become 1, so show mouse cursor if it's currently
01641 // hidden
01642 //
01643
01644 if (!cursor_state)
01645 {
01646 cursor_state = 1;
01647 #ifndef DISABLED_BEHAVIOR
01648 ShowCursor(1);
01649 #endif
01650 }
01651 }
01652 }
|
|
|
Definition at line 968 of file W32SAL.CPP. References DIB_active, DIB_shutdown(), DXDEF, NULL, pbmi, and pLogPal. Referenced by DrvShutdown().
00969 {
00970 // if (OldWindowProc)
00971 // {
00972 // SetWindowLong( hWnd, GWL_WNDPROC, (LONG)OldWindowProc);
00973 // OldWindowProc = NULL;
00974 // }
00975
00976 if (DIB_active)
00977 {
00978 DIB_shutdown();
00979 }
00980
00981 if (pbmi != NULL)
00982 {
00983 free(pbmi);
00984 pbmi = NULL;
00985 }
00986
00987 if (pLogPal != NULL)
00988 {
00989 free(pLogPal);
00990 pLogPal = NULL;
00991 }
00992 }
|
|
|
Definition at line 886 of file W32SAL.CPP. References app_active, app_minimized, app_terminated, area, constrain_request, constrain_state, current_bpp, current_size_X, current_size_Y, current_window_mode, cursor_state, debug_log_filename, DIB_active, DXDEF, FALSE, focus_callback, hHook, hSem, hWnd, log_to_file, mode_change_allowed, mode_change_request, NULL, palette_change_request, pbmi, pbmih, pLogPal, S32, SAL_FULLSCREEN, show_count, TRUE, unconstrained_rect, SAL_WINAREA::width, and window_callback. Referenced by DrvInit().
00887 {
00888 log_to_file = FileLog;
00889 strcpy(debug_log_filename, "debug.txt");
00890
00891 app_active = FALSE; // App not activated yet
00892 app_terminated = FALSE; // App not terminated yet
00893 app_minimized = FALSE; // App not minimized by default
00894
00895 show_count = 0; // Mouse cursor show count
00896 cursor_state = 1; // (Windows cursor is on by default)
00897 constrain_state = 0; // Mouse is not constrained to window
00898 constrain_request = 0; // Mouse should not be constrained at next movement
00899
00900 area.width = -1;
00901
00902 focus_callback = NULL;
00903 window_callback = NULL;
00904 hWnd = NULL;
00905 hHook = NULL;
00906 mode_change_request = FALSE;
00907 hSem = NULL;
00908
00909 DIB_active = FALSE;
00910
00911 mode_change_allowed = FALSE;
00912 current_window_mode = SAL_FULLSCREEN;
00913 current_bpp = 0;
00914 current_size_X = 0;
00915 current_size_Y = 0;
00916
00917 palette_change_request = FALSE;
00918
00919 //
00920 // Get original mouse constraint area (normally entire screen)
00921 //
00922 #ifndef DISABLED_BEHAVIOR
00923 GetClipCursor(&unconstrained_rect);
00924 #endif
00925 //
00926 // Allocate palette and bitmap structures at startup time to avoid
00927 // memory fragmentation during mode switches
00928 //
00929 // Clear palette structure to black to avoid screen flash when
00930 // setting initial mode
00931 //
00932
00933 pLogPal = (LOGPALETTE *)
00934 malloc (sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY) * 256));
00935
00936 if (pLogPal == NULL)
00937 {
00938 return 0;
00939 }
00940
00941 memset(pLogPal,0, sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY) * 256));
00942
00943 pLogPal->palVersion = 0x300;
00944 pLogPal->palNumEntries = 256;
00945
00946 pbmi = (BITMAPINFO *)
00947 malloc(sizeof (BITMAPINFOHEADER) + (sizeof (RGBQUAD) * 256));
00948
00949 if (pbmi == NULL)
00950 {
00951 free(pLogPal);
00952 return 0;
00953 }
00954
00955 memset(pbmi, 0, sizeof (BITMAPINFOHEADER) + (sizeof (RGBQUAD) * 256));
00956
00957 pbmih = &(pbmi->bmiHeader);
00958
00959 return TRUE;
00960 }
|
|
|
Definition at line 1703 of file W32SAL.CPP. References constrain_request, constrain_state, DIB_active, DXDEF, and unconstrained_rect.
01704 {
01705 constrain_state = 0;
01706
01707 if (DIB_active)
01708 {
01709 #ifndef DISABLED_BEHAVIOR
01710 ClipCursor(&unconstrained_rect);
01711 #endif
01712 constrain_request = 0;
01713 }
01714 }
|
|
|
Definition at line 1306 of file W32SAL.CPP. References area, tagRECT::bottom, DIB_active, DXDEF, SAL_WINAREA::height, hWnd, tagRECT::left, tagRECT::right, tagRECT::top, SAL_WINAREA::width, SAL_WINAREA::x, and SAL_WINAREA::y.
01307 {
01308 RECT window_rect;
01309
01310 if (DIB_active)
01311 {
01312 GetWindowRect(hWnd, &window_rect);
01313
01314 area->x = window_rect.left;
01315 area->y = window_rect.top;
01316 area->width = window_rect.right - window_rect.left + 1;
01317 area->height = window_rect.bottom - window_rect.top + 1;
01318 }
01319
01320 }
|
|
|
Definition at line 1273 of file W32SAL.CPP. References current_window_mode, DXDEF, and S32.
01274 {
01275 return current_window_mode;
01276 }
|
|
||||||||||||
|
Definition at line 1562 of file W32SAL.CPP. References DIB_active, DIB_wipe_surface(), and DXDEF. Referenced by BeginScene(), and DIB_shutdown().
01564 {
01565 if (DIB_active)
01566 {
01567 DIB_wipe_surface(surface, color);
01568 }
01569 }
|
|
|
Definition at line 180 of file W32SAL.CPP. Referenced by SAL_serve_message_queue().
00181 {
00182 /*
00183 MSG msg;
00184
00185 if (app_terminated)
00186 {
00187 return;
00188 }
00189
00190 //
00191 // Serve message queue
00192 //
00193
00194 while (PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE))
00195 {
00196 if (!GetMessage(&msg, NULL, 0, 0 ))
00197 {
00198 app_active = FALSE;
00199 app_terminated = TRUE;
00200
00201 (exit_callback)();
00202
00203 //
00204 // Return statement should not be reached
00205 //
00206
00207 return;
00208 }
00209
00210 TranslateMessage(&msg);
00211 DispatchMessage(&msg);
00212 }
00213 */
00214 }
|
|
|
Definition at line 83 of file W32SAL.CPP. Referenced by SAL_is_app_active(), SAL_set_main_window(), and SAL_startup(). |
|
|
Definition at line 82 of file W32SAL.CPP. Referenced by SAL_startup(). |
|
|
Definition at line 84 of file W32SAL.CPP. Referenced by SAL_startup(). |
|
|
Definition at line 118 of file W32SAL.CPP. Referenced by DIB_startup(), SAL_client_area(), SAL_startup(), and SAL_window_area(). |
|
|
Definition at line 148 of file W32SAL.CPP. Referenced by DIB_shutdown(), DIB_startup(), SAL_constrain_mouse(), SAL_startup(), and SAL_unconstrain_mouse(). |
|
|
Definition at line 147 of file W32SAL.CPP. Referenced by DIB_shutdown(), DIB_startup(), SAL_constrain_mouse(), SAL_startup(), and SAL_unconstrain_mouse(). |
|
|
Definition at line 150 of file W32SAL.CPP. |
|
|
Definition at line 104 of file W32SAL.CPP. Referenced by DIB_lock_surface(), DIB_wipe_surface(), SAL_get_pixel_format(), SAL_serve_message_queue(), SAL_set_display_mode(), SAL_set_palette_entry(), SAL_set_palette_range(), and SAL_startup(). |
|
|
Definition at line 105 of file W32SAL.CPP. Referenced by DIB_lock_surface(), DIB_refresh_surface(), DIB_wipe_surface(), SAL_serve_message_queue(), SAL_set_display_mode(), and SAL_startup(). |
|
|
Definition at line 106 of file W32SAL.CPP. Referenced by DIB_refresh_surface(), DIB_wipe_surface(), SAL_serve_message_queue(), SAL_set_display_mode(), and SAL_startup(). |
|
|
Definition at line 103 of file W32SAL.CPP. Referenced by SAL_serve_message_queue(), SAL_set_display_mode(), SAL_startup(), and SAL_window_status(). |
|
|
Definition at line 76 of file W32SAL.CPP. Referenced by SAL_error_box(), SAL_hide_system_mouse(), SAL_set_display_mode(), SAL_show_system_mouse(), and SAL_startup(). |
|
|
Definition at line 79 of file W32SAL.CPP. Referenced by SAL_debug_printf(), and SAL_startup(). |
|
|
Definition at line 151 of file W32SAL.CPP. Referenced by SAL_GetBackBufferDC(), and SAL_ReleaseBackBufferDC(). |
|
|
Definition at line 123 of file W32SAL.CPP. Referenced by DIB_startup(). |
|
|
Definition at line 120 of file W32SAL.CPP. Referenced by DIB_refresh_surface(), and DIB_startup(). |
|
|
Definition at line 122 of file W32SAL.CPP. Referenced by DIB_startup(). |
|
|
Definition at line 74 of file W32SAL.CPP. Referenced by DIB_startup(). |
|
|
Definition at line 121 of file W32SAL.CPP. Referenced by DIB_startup(). |
|
|
Definition at line 73 of file W32SAL.CPP. Referenced by DIB_startup(). |
|
|
|
Definition at line 127 of file W32SAL.CPP. Referenced by DIB_startup(), and SAL_get_pixel_format(). |
|
|
Definition at line 131 of file W32SAL.CPP. |
|
|
Definition at line 126 of file W32SAL.CPP. Referenced by DIB_startup(), and SAL_get_pixel_format(). |
|
|
Definition at line 130 of file W32SAL.CPP. |
|
|
Definition at line 125 of file W32SAL.CPP. Referenced by DIB_startup(), and SAL_get_pixel_format(). |
|
|
Definition at line 129 of file W32SAL.CPP. |
|
|
Definition at line 86 of file W32SAL.CPP. |
|
|
Definition at line 87 of file W32SAL.CPP. Referenced by SAL_register_focus_callback(), and SAL_startup(). |
|
|
Definition at line 94 of file W32SAL.CPP. |
|
|
Definition at line 136 of file W32SAL.CPP. Referenced by DIB_shutdown(), DIB_startup(), GetDIBHandle(), and SAL_GetBackBufferDC(). |
|
|
Definition at line 95 of file W32SAL.CPP. Referenced by DllMain(). |
|
|
Definition at line 98 of file W32SAL.CPP. Referenced by SAL_startup(). |
|
|
Definition at line 137 of file W32SAL.CPP. Referenced by DIB_refresh_surface(), DIB_shutdown(), DIB_startup(), SAL_set_palette_entry(), and SAL_set_palette_range(). |
|
|
Definition at line 90 of file W32SAL.CPP. Referenced by SAL_startup(). |
|
|
Definition at line 97 of file W32SAL.CPP. Referenced by client_screen_rect(), DIB_refresh_surface(), DIB_startup(), SAL_error_box(), SAL_set_main_window(), SAL_startup(), and SAL_window_area(). |
|
|
Definition at line 80 of file W32SAL.CPP. Referenced by SAL_debug_printf(), and SAL_startup(). |
|
|
Definition at line 135 of file W32SAL.CPP. Referenced by DIB_lock_surface(), DIB_refresh_surface(), DIB_startup(), and DIB_wipe_surface(). |
|
|
Definition at line 102 of file W32SAL.CPP. Referenced by SAL_serve_message_queue(), SAL_set_display_mode(), and SAL_startup(). |
|
|
Definition at line 92 of file W32SAL.CPP. Referenced by SAL_serve_message_queue(), and SAL_startup(). |
|
|
Definition at line 144 of file W32SAL.CPP. Referenced by DIB_startup(). |
|
|
Definition at line 143 of file W32SAL.CPP. Referenced by DIB_startup(). |
|
|
Definition at line 89 of file W32SAL.CPP. |
|
|
Definition at line 142 of file W32SAL.CPP. Referenced by DIB_startup(). |
|
|
Definition at line 141 of file W32SAL.CPP. Referenced by DIB_startup(). |
|
|
Definition at line 139 of file W32SAL.CPP. Referenced by DIB_refresh_surface(), DIB_startup(), SAL_set_palette_entry(), SAL_set_palette_range(), and SAL_startup(). |
|
|
Definition at line 112 of file W32SAL.CPP. Referenced by SAL_get_palette_entry(), SAL_get_palette_range(), SAL_set_palette_entry(), and SAL_set_palette_range(). |
|
|
Definition at line 109 of file W32SAL.CPP. Referenced by DIB_refresh_surface(), DIB_startup(), SAL_set_palette_entry(), SAL_set_palette_range(), SAL_shutdown(), and SAL_startup(). |
|
|
Definition at line 110 of file W32SAL.CPP. Referenced by DIB_startup(), and SAL_startup(). |
|
|
Definition at line 108 of file W32SAL.CPP. Referenced by DIB_startup(), SAL_set_palette_entry(), SAL_set_palette_range(), SAL_shutdown(), and SAL_startup(). |
|
|
Definition at line 100 of file W32SAL.CPP. Referenced by SAL_get_preference(), and SAL_set_preference(). |
|
|
Definition at line 77 of file W32SAL.CPP. Referenced by SAL_hide_system_mouse(), SAL_set_display_mode(), SAL_show_system_mouse(), and SAL_startup(). |
|
|
Definition at line 96 of file W32SAL.CPP. |
|
|
Definition at line 146 of file W32SAL.CPP. Referenced by DIB_shutdown(), SAL_startup(), and SAL_unconstrain_mouse(). |
|
|
Definition at line 88 of file W32SAL.CPP. Referenced by SAL_register_WNDPROC(), and SAL_startup(). |
1.3.2