1 /* 2 SDL - Simple DirectMedia Layer 3 Copyright (C) 1997-2012 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 return 1; 40 } 41 42 SDL_GrabMode BE_GrabInput(_THIS, SDL_GrabMode mode) 43 { 44 if ( mode == SDL_GRAB_OFF ) { 45 // be_app->ShowCursor(); 46 if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) { 47 /* BeSman: Jan 2, 2006 48 must be leaving relative mode, move mouse from 49 center of window to where it belongs ... */ 50 BPoint pt; 51 int x, y; 52 SDL_GetMouseState(&x,&y); 53 pt.x = x; 54 pt.y = y; 55 SDL_Win->Lock(); 56 SDL_Win->ConvertToScreen(&pt); 57 SDL_Win->Unlock(); 58 set_mouse_position((int)pt.x, (int)pt.y); 59 } 60 } else { 61 // be_app->HideCursor(); 62 if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) { 63 /* BeSman: Jan 2, 2006 64 must be entering relative mode, get ready by 65 moving mouse to center of window ... */ 66 BPoint pt; 67 pt.x = (SDL_VideoSurface->w/2); 68 pt.y = (SDL_VideoSurface->h/2); 69 SDL_Win->Lock(); 70 SDL_Win->ConvertToScreen(&pt); 71 SDL_Win->Unlock(); 72 set_mouse_position((int)pt.x, (int)pt.y); 73 } 74 } 75 return(mode); 76 } 77 78 int BE_GetWMInfo(_THIS, SDL_SysWMinfo *info) 79 { 80 if (info->version.major <= SDL_MAJOR_VERSION) 81 { 82 return 1; 83 } 84 else 85 { 86 SDL_SetError("Application not compiled with SDL %d.%d\n", 87 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); 88 return -1; 89 } 90 } 91 92 }; /* Extern C */ 93