1 /* 2 SDL - Simple DirectMedia Layer 3 Copyright (C) 1997-2006 Sam Lantinga 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 19 Sam Lantinga 20 slouken (at) libsdl.org 21 */ 22 #include "SDL_config.h" 23 24 #include "SDL_BWin.h" 25 26 extern "C" { 27 #include "SDL_syswm_c.h" 28 #include "SDL_error.h" 29 #include "../SDL_cursor_c.h" 30 31 void BE_SetWMCaption(_THIS, const char *title, const char *icon) 32 { 33 SDL_Win->SetTitle(title); 34 } 35 36 int BE_IconifyWindow(_THIS) 37 { 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); 75 } 76 77 int BE_GetWMInfo(_THIS, SDL_SysWMinfo *info) 78 { 79 if (info->version.major <= SDL_MAJOR_VERSION) 80 { 81 return 1; 82 } 83 else 84 { 85 SDL_SetError("Application not compiled with SDL %d.%d\n", 86 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); 87 return -1; 88 } 89 } 90 91 }; /* Extern C */ 92