comparison src/video/bwindow/SDL_syswm.cc @ 3878:678576473849 SDL-1.2

Fixed bug #286 Date: Thu, 9 Feb 2006 17:06:51 +0300 From: "Oleg K [BeSman]" Subject: BeOS SDL patches Hello all. My name is Oleg K. [BeSman], Im a BeOS user from Russia.This mail contain a BeOs-specific patches to SDL (implementation of InputGrabbing and mouse_relative mode). See the source in attached file for details.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 24 Sep 2006 15:31:42 +0000
parents 376665398b25
children cb7b118b400a
comparison
equal deleted inserted replaced
3877:81f66f258d77 3878:678576473849
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 23
24 #include "SDL_BWin.h" 24 #include "SDL_BWin.h"
25 25
26 extern "C" { 26 extern "C" {
27
28 #include "SDL_syswm_c.h" 27 #include "SDL_syswm_c.h"
29 #include "SDL_error.h" 28 #include "SDL_error.h"
29 #include "../SDL_cursor_c.h"
30 30
31 void BE_SetWMCaption(_THIS, const char *title, const char *icon) 31 void BE_SetWMCaption(_THIS, const char *title, const char *icon)
32 { 32 {
33 SDL_Win->SetTitle(title); 33 SDL_Win->SetTitle(title);
34 } 34 }
35 35
36 int BE_IconifyWindow(_THIS) 36 int BE_IconifyWindow(_THIS)
37 { 37 {
38 SDL_Win->Minimize(true); 38 SDL_Win->Minimize(true);
39 }
40
41 SDL_GrabMode BE_GrabInput(_THIS, SDL_GrabMode mode)
42 {
43 if ( mode == SDL_GRAB_OFF ) {
44 // be_app->ShowCursor();
45 if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) {
46 /* BeSman: Jan 2, 2006
47 must be leaving relative mode, move mouse from
48 center of window to where it belongs ... */
49 BPoint pt;
50 int x, y;
51 SDL_GetMouseState(&x,&y);
52 pt.x = x;
53 pt.y = y;
54 SDL_Win->Lock();
55 SDL_Win->ConvertToScreen(&pt);
56 SDL_Win->Unlock();
57 set_mouse_position((int)pt.x, (int)pt.y);
58 }
59 } else {
60 // be_app->HideCursor();
61 if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) {
62 /* BeSman: Jan 2, 2006
63 must be entering relative mode, get ready by
64 moving mouse to center of window ... */
65 BPoint pt;
66 pt.x = (SDL_VideoSurface->w/2);
67 pt.y = (SDL_VideoSurface->h/2);
68 SDL_Win->Lock();
69 SDL_Win->ConvertToScreen(&pt);
70 SDL_Win->Unlock();
71 set_mouse_position((int)pt.x, (int)pt.y);
72 }
73 }
74 return(mode);
39 } 75 }
40 76
41 int BE_GetWMInfo(_THIS, SDL_SysWMinfo *info) 77 int BE_GetWMInfo(_THIS, SDL_SysWMinfo *info)
42 { 78 {
43 if (info->version.major <= SDL_MAJOR_VERSION) 79 if (info->version.major <= SDL_MAJOR_VERSION)