comparison src/video/windib/SDL_dibevents.c @ 1456:84de7511f79f

Fixed a bunch of 64-bit compatibility problems
author Sam Lantinga <slouken@libsdl.org>
date Wed, 01 Mar 2006 09:43:47 +0000
parents bb6839704ed6
children 4aac8563c296
comparison
equal deleted inserted replaced
1455:f487bb150acc 1456:84de7511f79f
82 82
83 #endif 83 #endif
84 84
85 85
86 /* The main Win32 event handler */ 86 /* The main Win32 event handler */
87 LONG 87 LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
88 DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
89 { 88 {
90 extern int posted; 89 extern int posted;
91 90
92 switch (msg) { 91 switch (msg) {
93 case WM_SYSKEYDOWN: 92 case WM_SYSKEYDOWN:
415 wchar_t *windowid_t = SDL_malloc((SDL_strlen(windowid) + 1) * sizeof(wchar_t)); 414 wchar_t *windowid_t = SDL_malloc((SDL_strlen(windowid) + 1) * sizeof(wchar_t));
416 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, windowid, -1, windowid_t, SDL_strlen(windowid) + 1); 415 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, windowid, -1, windowid_t, SDL_strlen(windowid) + 1);
417 SDL_Window = (HWND)wcstol(windowid_t, NULL, 0); 416 SDL_Window = (HWND)wcstol(windowid_t, NULL, 0);
418 SDL_free(windowid_t); 417 SDL_free(windowid_t);
419 #else 418 #else
420 SDL_Window = (HWND)SDL_strtol(windowid, NULL, 0); 419 SDL_Window = (HWND)SDL_strtoull(windowid, NULL, 0);
421 #endif 420 #endif
422 if ( SDL_Window == NULL ) { 421 if ( SDL_Window == NULL ) {
423 SDL_SetError("Couldn't get user specified window"); 422 SDL_SetError("Couldn't get user specified window");
424 return(-1); 423 return(-1);
425 } 424 }
426 425
427 /* DJM: we want all event's for the user specified 426 /* DJM: we want all event's for the user specified
428 window to be handled by SDL. 427 window to be handled by SDL.
429 */ 428 */
430 userWindowProc = (WNDPROCTYPE)GetWindowLong(SDL_Window, GWL_WNDPROC); 429 userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
431 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); 430 SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
432 } else { 431 } else {
433 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, 432 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
434 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), 433 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
435 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL); 434 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL);
436 if ( SDL_Window == NULL ) { 435 if ( SDL_Window == NULL ) {
443 } 442 }
444 443
445 void DIB_DestroyWindow(_THIS) 444 void DIB_DestroyWindow(_THIS)
446 { 445 {
447 if ( SDL_windowid ) { 446 if ( SDL_windowid ) {
448 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)userWindowProc); 447 SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
449 } else { 448 } else {
450 DestroyWindow(SDL_Window); 449 DestroyWindow(SDL_Window);
451 } 450 }
452 SDL_UnregisterApp(); 451 SDL_UnregisterApp();
453 } 452 }