annotate src/video/bwindow/SDL_syswm.cc @ 4159:a1b03ba2fcd0 SDL-1.2

Updated copyright date
author Sam Lantinga <slouken@libsdl.org>
date Mon, 08 Dec 2008 00:25:42 +0000
parents cb7b118b400a
children
rev   line source
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 /*
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
4159
a1b03ba2fcd0 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 4122
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
6 modify it under the terms of the GNU Lesser General Public
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
13 Lesser General Public License for more details.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 Sam Lantinga
252
e8157fcb3114 Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents: 0
diff changeset
20 slouken@libsdl.org
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 */
1403
376665398b25 Catch the C++ and Objective C sources too...
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
22 #include "SDL_config.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
23
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 #include "SDL_BWin.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
25
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26 extern "C" {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27 #include "SDL_syswm_c.h"
906
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
28 #include "SDL_error.h"
3878
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
29 #include "../SDL_cursor_c.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31 void BE_SetWMCaption(_THIS, const char *title, const char *icon)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 SDL_Win->SetTitle(title);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35
906
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
36 int BE_IconifyWindow(_THIS)
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
37 {
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
38 SDL_Win->Minimize(true);
4122
cb7b118b400a Fixed return value for iconifying the window in a couple spots.
Sam Lantinga <slouken@libsdl.org>
parents: 3878
diff changeset
39 return 1;
906
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
40 }
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
41
3878
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
42 SDL_GrabMode BE_GrabInput(_THIS, SDL_GrabMode mode)
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
43 {
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
44 if ( mode == SDL_GRAB_OFF ) {
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
45 // be_app->ShowCursor();
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
46 if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) {
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
47 /* BeSman: Jan 2, 2006
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
48 must be leaving relative mode, move mouse from
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
49 center of window to where it belongs ... */
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
50 BPoint pt;
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
51 int x, y;
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
52 SDL_GetMouseState(&x,&y);
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
53 pt.x = x;
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
54 pt.y = y;
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
55 SDL_Win->Lock();
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
56 SDL_Win->ConvertToScreen(&pt);
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
57 SDL_Win->Unlock();
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
58 set_mouse_position((int)pt.x, (int)pt.y);
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
59 }
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
60 } else {
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
61 // be_app->HideCursor();
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
62 if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) {
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
63 /* BeSman: Jan 2, 2006
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
64 must be entering relative mode, get ready by
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
65 moving mouse to center of window ... */
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
66 BPoint pt;
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
67 pt.x = (SDL_VideoSurface->w/2);
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
68 pt.y = (SDL_VideoSurface->h/2);
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
69 SDL_Win->Lock();
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
70 SDL_Win->ConvertToScreen(&pt);
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
71 SDL_Win->Unlock();
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
72 set_mouse_position((int)pt.x, (int)pt.y);
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
73 }
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
74 }
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
75 return(mode);
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
76 }
678576473849 Fixed bug #286
Sam Lantinga <slouken@libsdl.org>
parents: 1403
diff changeset
77
906
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
78 int BE_GetWMInfo(_THIS, SDL_SysWMinfo *info)
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
79 {
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
80 if (info->version.major <= SDL_MAJOR_VERSION)
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
81 {
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
82 return 1;
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
83 }
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
84 else
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
85 {
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
86 SDL_SetError("Application not compiled with SDL %d.%d\n",
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
87 SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
88 return -1;
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
89 }
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
90 }
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
91
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
92 }; /* Extern C */