Mercurial > sdl-ios-xcode
annotate src/video/directfb/SDL_DirectFB_window.c @ 5247:78ce7bfd0faf
Better window parameter checking
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 10 Feb 2011 10:37:35 -0800 |
parents | 164f20ba08eb |
children | 58265e606e4e |
rev | line source |
---|---|
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
21 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
22 SDL1.3 DirectFB driver by couriersud@arcor.de |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
23 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 #include "SDL_DirectFB_video.h" |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
27 #include "SDL_DirectFB_modes.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
28 #include "SDL_DirectFB_window.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
29 #include "SDL_DirectFB_shape.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
30 |
4636 | 31 #if SDL_DIRECTFB_OPENGL |
32 #include "SDL_DirectFB_opengl.h" | |
33 #endif | |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
35 #include "SDL_syswm.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
36 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
37 #include "../SDL_pixels_c.h" |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
38 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 int |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 DirectFB_CreateWindow(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 SDL_DFB_DEVICEDATA(_this); |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
43 SDL_DFB_DISPLAYDATA(window); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
44 DFB_WindowData *windata = NULL; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 DFBWindowOptions wopts; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 DFBWindowDescription desc; |
4636 | 47 int x, y; |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
48 int bshaped = 0; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
50 SDL_DFB_ALLOC_CLEAR(window->driverdata, sizeof(DFB_WindowData)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 windata = (DFB_WindowData *) window->driverdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
53 windata->is_managed = devdata->has_own_wm; |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
54 #if 1 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
55 SDL_DFB_CHECKERR(devdata->dfb->SetCooperativeLevel(devdata->dfb, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
56 DFSCL_NORMAL)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
57 SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
58 DLSCL_ADMINISTRATIVE)); |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
59 #endif |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
60 /* FIXME ... ughh, ugly */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
61 if (window->x == -1000 && window->y == -1000) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
62 bshaped = 1; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
63 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 /* Fill the window description. */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 if (window->x == SDL_WINDOWPOS_CENTERED) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 x = (dispdata->cw - window->w) / 2; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 x = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 } else { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 x = window->x; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 } |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
72 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 if (window->y == SDL_WINDOWPOS_CENTERED) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 y = (dispdata->ch - window->h) / 2; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 y = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 } else { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 y = window->y; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 } |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
80 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 x = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 y = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 |
4636 | 86 DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
88 /* Create Window */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
89 desc.caps = 0; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
90 desc.flags = |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
91 DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY | DWDESC_SURFACE_CAPS; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
92 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
93 if (bshaped) { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
94 desc.flags |= DWDESC_CAPS; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
95 desc.caps |= DWCAPS_ALPHACHANNEL; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
96 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
97 else |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
98 { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
99 desc.flags |= DWDESC_PIXELFORMAT; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
100 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
101 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
102 if (!(window->flags & SDL_WINDOW_BORDERLESS)) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
103 desc.caps |= DWCAPS_NODECORATION; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
104 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 desc.posx = x; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 desc.posy = y; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
107 desc.width = windata->size.w; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
108 desc.height = windata->size.h; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 desc.pixelformat = dispdata->pixelformat; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 desc.surface_caps = DSCAPS_PREMULTIPLIED; |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
111 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 /* Create the window. */ |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
113 SDL_DFB_CHECKERR(dispdata->layer->CreateWindow(dispdata->layer, &desc, |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
114 &windata->dfbwin)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
116 /* Set Options */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
117 SDL_DFB_CHECK(windata->dfbwin->GetOptions(windata->dfbwin, &wopts)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
119 /* explicit rescaling of surface */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
120 wopts |= DWOP_SCALE; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
121 if (window->flags & SDL_WINDOW_RESIZABLE) { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
122 wopts &= ~DWOP_KEEP_SIZE; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
123 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
124 else { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 wopts |= DWOP_KEEP_SIZE; |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
126 } |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
128 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_STACKING | DWOP_KEEP_SIZE; |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
130 SDL_DFB_CHECK(windata->dfbwin->SetStackingClass(windata->dfbwin, DWSC_UPPER)); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
131 } |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
132 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
133 if (bshaped) { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
134 wopts |= DWOP_SHAPED | DWOP_ALPHACHANNEL; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
135 wopts &= ~DWOP_OPAQUE_REGION; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
136 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
137 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
138 SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
140 /* See what we got */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
141 SDL_DFB_CHECK(DirectFB_WM_GetClientSize |
3040 | 142 (_this, window, &window->w, &window->h)); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
143 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 /* Get the window's surface. */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
145 SDL_DFB_CHECKERR(windata->dfbwin->GetSurface(windata->dfbwin, |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
146 &windata->window_surface)); |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
147 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
148 /* And get a subsurface for rendering */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
149 SDL_DFB_CHECKERR(windata->window_surface-> |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
150 GetSubSurface(windata->window_surface, &windata->client, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
151 &windata->surface)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
152 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
153 SDL_DFB_CHECK(windata->dfbwin->SetOpacity(windata->dfbwin, 0xFF)); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
154 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
155 /* Create Eventbuffer */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
156 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
157 SDL_DFB_CHECKERR(windata->dfbwin->CreateEventBuffer(windata->dfbwin, |
3040 | 158 &windata-> |
159 eventbuffer)); | |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
160 SDL_DFB_CHECKERR(windata->dfbwin-> |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
161 EnableEvents(windata->dfbwin, DWET_ALL)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
163 /* Create a font */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
164 /* FIXME: once during Video_Init */ |
4636 | 165 windata->font = NULL; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
166 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 /* Make it the top most window. */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
168 SDL_DFB_CHECK(windata->dfbwin->RaiseToTop(windata->dfbwin)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 /* remember parent */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
171 //windata->sdlwin = window; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 /* Add to list ... */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 windata->next = devdata->firstwin; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 windata->opacity = 0xFF; |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
177 devdata->firstwin = window; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
179 /* Draw Frame */ |
4636 | 180 DirectFB_WM_RedrawLayout(_this, window); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
181 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 return 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 error: |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
184 SDL_DFB_RELEASE(windata->surface); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
185 SDL_DFB_RELEASE(windata->dfbwin); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 return -1; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 int |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 DirectFB_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 SDL_Unsupported(); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 return -1; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 DirectFB_SetWindowTitle(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
199 SDL_DFB_WINDOWDATA(window); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
200 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
201 if (windata->is_managed) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
202 windata->wm_needs_redraw = 1; |
4636 | 203 DirectFB_WM_RedrawLayout(_this, window); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
204 } else |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
205 SDL_Unsupported(); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
206 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
207 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
208 void |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
209 DirectFB_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
210 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
211 SDL_DFB_DEVICEDATA(_this); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
212 SDL_DFB_WINDOWDATA(window); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
213 SDL_Surface *surface = NULL; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
214 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
215 if (icon) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
216 SDL_PixelFormat format; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
217 DFBSurfaceDescription dsc; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
218 Uint32 *dest; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
219 Uint32 *p; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
220 int pitch, i; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
221 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
222 /* Convert the icon to ARGB for modern window managers */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
223 SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
224 0xFF000000); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
225 surface = SDL_ConvertSurface(icon, &format, 0); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
226 if (!surface) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
227 return; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
228 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
229 dsc.flags = |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
230 DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
231 dsc.caps = DSCAPS_VIDEOONLY; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
232 dsc.width = surface->w; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
233 dsc.height = surface->h; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
234 dsc.pixelformat = DSPF_ARGB; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
235 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
236 SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
237 &windata->icon)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
238 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
239 SDL_DFB_CHECKERR(windata->icon->Lock(windata->icon, DSLF_WRITE, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
240 (void *) &dest, &pitch)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
241 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
242 p = surface->pixels; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
243 for (i = 0; i < surface->h; i++) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
244 memcpy((char *) dest + i * pitch, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
245 (char *) p + i * surface->pitch, 4 * surface->w); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
246 |
4636 | 247 SDL_DFB_CHECK(windata->icon->Unlock(windata->icon)); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
248 SDL_FreeSurface(surface); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
249 } else { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
250 SDL_DFB_RELEASE(windata->icon); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
251 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
252 return; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
253 error: |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
254 if (surface) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
255 SDL_FreeSurface(surface); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
256 SDL_DFB_RELEASE(windata->icon); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
257 return; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 DirectFB_SetWindowPosition(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 SDL_DFB_WINDOWDATA(window); |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
264 SDL_DFB_DISPLAYDATA(window); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 int x, y; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
267 if (window->x == SDL_WINDOWPOS_CENTERED) { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
268 x = (dispdata->cw - window->w) / 2; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
269 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
270 x = 0; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
271 } else { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
272 x = window->x; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
273 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
274 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
275 if (window->y == SDL_WINDOWPOS_CENTERED) { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
276 y = (dispdata->ch - window->h) / 2; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
277 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 y = 0; |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
279 } else { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 y = window->y; |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
281 } |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 x = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 y = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 } |
4636 | 287 DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h); |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
288 SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, x, y)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 DirectFB_SetWindowSize(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
294 SDL_DFB_WINDOWDATA(window); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
296 if(SDL_IsShapedWindow(window)) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
297 DirectFB_ResizeWindowShape(window); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
298 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 int cw; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 int ch; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 /* Make sure all events are disabled for this operation ! */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
304 SDL_DFB_CHECKERR(windata->dfbwin->DisableEvents(windata->dfbwin, |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
305 DWET_ALL)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
306 SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize(_this, window, &cw, &ch)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
307 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
308 if (cw != window->w || ch != window->h) { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 |
4636 | 310 DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h); |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
311 SDL_DFB_CHECKERR(windata->dfbwin->Resize(windata->dfbwin, |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
312 windata->size.w, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
313 windata->size.h)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
314 } |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 |
4636 | 316 SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize |
317 (_this, window, &window->w, &window->h)); | |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
318 DirectFB_AdjustWindowSurface(window); |
4636 | 319 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
320 SDL_DFB_CHECKERR(windata->dfbwin->EnableEvents(windata->dfbwin, |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
321 DWET_ALL)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
322 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 return; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 error: |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
326 SDL_DFB_CHECK(windata->dfbwin->EnableEvents(windata->dfbwin, DWET_ALL)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 return; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 DirectFB_ShowWindow(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
332 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 SDL_DFB_WINDOWDATA(window); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
335 SDL_DFB_CHECK(windata->dfbwin->SetOpacity(windata->dfbwin, windata->opacity)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
338 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 DirectFB_HideWindow(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 SDL_DFB_WINDOWDATA(window); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
344 SDL_DFB_CHECK(windata->dfbwin->GetOpacity(windata->dfbwin, &windata->opacity)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
345 SDL_DFB_CHECK(windata->dfbwin->SetOpacity(windata->dfbwin, 0)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
346 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 DirectFB_RaiseWindow(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 SDL_DFB_WINDOWDATA(window); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
353 SDL_DFB_CHECK(windata->dfbwin->RaiseToTop(windata->dfbwin)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
354 SDL_DFB_CHECK(windata->dfbwin->RequestFocus(windata->dfbwin)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
355 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 DirectFB_MaximizeWindow(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
360 SDL_DFB_WINDOWDATA(window); |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
361 SDL_VideoDisplay *display = window->display; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
362 DFBWindowOptions wopts; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
364 SDL_DFB_CHECK(windata->dfbwin->GetPosition(windata->dfbwin, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
365 &windata->restore.x, &windata->restore.y)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
366 SDL_DFB_CHECK(windata->dfbwin->GetSize(windata->dfbwin, &windata->restore.w, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
367 &windata->restore.h)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
368 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
369 DirectFB_WM_AdjustWindowLayout(window, window->flags | SDL_WINDOW_MAXIMIZED, display->current_mode.w, display->current_mode.h) ; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
370 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
371 SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, 0, 0)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
372 SDL_DFB_CHECK(windata->dfbwin->Resize(windata->dfbwin, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
373 display->current_mode.w, display->current_mode.h)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
374 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
375 /* Set Options */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
376 SDL_DFB_CHECK(windata->dfbwin->GetOptions(windata->dfbwin, &wopts)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
377 wopts |= DWOP_KEEP_SIZE | DWOP_KEEP_POSITION; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
378 SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 DirectFB_MinimizeWindow(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 /* FIXME: Size to 32x32 ? */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 SDL_Unsupported(); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 DirectFB_RestoreWindow(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
392 SDL_DFB_WINDOWDATA(window); |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
393 DFBWindowOptions wopts; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
394 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
395 /* Set Options */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
396 SDL_DFB_CHECK(windata->dfbwin->GetOptions(windata->dfbwin, &wopts)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
397 wopts &= ~(DWOP_KEEP_SIZE | DWOP_KEEP_POSITION); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
398 SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
399 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
400 /* Window layout */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
401 DirectFB_WM_AdjustWindowLayout(window, window->flags & ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED), |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
402 windata->restore.w, windata->restore.h); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
403 SDL_DFB_CHECK(windata->dfbwin->Resize(windata->dfbwin, windata->restore.w, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
404 windata->restore.h)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
405 SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, windata->restore.x, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
406 windata->restore.y)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
407 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
408 if (!(window->flags & SDL_WINDOW_RESIZABLE)) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
409 wopts |= DWOP_KEEP_SIZE; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
410 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
411 if (window->flags & SDL_WINDOW_FULLSCREEN) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
412 wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_SIZE; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
413 SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
414 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
415 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 DirectFB_SetWindowGrab(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 { |
4636 | 421 SDL_DFB_DEVICEDATA(_this); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 SDL_DFB_WINDOWDATA(window); |
4636 | 423 DFB_WindowData *gwindata = ((devdata->grabbed_window) ? (DFB_WindowData *) ((devdata->grabbed_window)->driverdata) : NULL); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
425 if ((window->flags & SDL_WINDOW_INPUT_GRABBED)) { |
4636 | 426 if (gwindata != NULL) |
427 { | |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
428 SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
429 SDL_DFB_CHECK(gwindata->dfbwin->UngrabKeyboard(gwindata->dfbwin)); |
4636 | 430 } |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
431 SDL_DFB_CHECK(windata->dfbwin->GrabPointer(windata->dfbwin)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
432 SDL_DFB_CHECK(windata->dfbwin->GrabKeyboard(windata->dfbwin)); |
4636 | 433 devdata->grabbed_window = window; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 } else { |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
435 SDL_DFB_CHECK(windata->dfbwin->UngrabPointer(windata->dfbwin)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
436 SDL_DFB_CHECK(windata->dfbwin->UngrabKeyboard(windata->dfbwin)); |
4636 | 437 devdata->grabbed_window = NULL; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 DirectFB_DestroyWindow(_THIS, SDL_Window * window) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 SDL_DFB_DEVICEDATA(_this); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 SDL_DFB_WINDOWDATA(window); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 DFB_WindowData *p; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 |
4636 | 448 /* Some cleanups */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
449 SDL_DFB_CHECK(windata->dfbwin->UngrabPointer(windata->dfbwin)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
450 SDL_DFB_CHECK(windata->dfbwin->UngrabKeyboard(windata->dfbwin)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 |
4636 | 452 #if SDL_DIRECTFB_OPENGL |
453 DirectFB_GL_DestroyWindowContexts(_this, window); | |
454 #endif | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
455 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
456 if (window->shaper) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
457 { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
458 SDL_ShapeData *data = window->shaper->driverdata; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
459 SDL_DFB_CHECK(data->surface->ReleaseSource(data->surface)); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
460 SDL_DFB_RELEASE(data->surface); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
461 SDL_DFB_FREE(data); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
462 SDL_DFB_FREE(window->shaper); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
463 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
464 |
4636 | 465 SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, NULL)); |
466 SDL_DFB_CHECK(windata->surface->ReleaseSource(windata->surface)); | |
467 SDL_DFB_CHECK(windata->window_surface->ReleaseSource(windata->window_surface)); | |
468 SDL_DFB_RELEASE(windata->icon); | |
469 SDL_DFB_RELEASE(windata->font); | |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
470 SDL_DFB_RELEASE(windata->eventbuffer); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
471 SDL_DFB_RELEASE(windata->surface); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
472 SDL_DFB_RELEASE(windata->window_surface); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
473 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
474 SDL_DFB_RELEASE(windata->dfbwin); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
475 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
476 /* Remove from list ... */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
478 p = devdata->firstwin->driverdata; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
479 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
480 while (p && p->next != window) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
481 p = (p->next ? p->next->driverdata : NULL); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
482 if (p) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
483 p->next = windata->next; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
484 else |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
485 devdata->firstwin = windata->next; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
486 SDL_free(windata); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
487 return; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
488 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
489 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
490 SDL_bool |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
491 DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 struct SDL_SysWMinfo * info) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 { |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
494 SDL_DFB_DEVICEDATA(_this); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
495 SDL_DFB_WINDOWDATA(window); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
496 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
497 if (info->version.major == SDL_MAJOR_VERSION && |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
498 info->version.minor == SDL_MINOR_VERSION) { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
499 info->subsystem = SDL_SYSWM_DIRECTFB; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
500 info->info.dfb.dfb = devdata->dfb; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
501 info->info.dfb.window = windata->dfbwin; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
502 info->info.dfb.surface = windata->surface; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
503 return SDL_TRUE; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
504 } else { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
505 SDL_SetError("Application not compiled with SDL %d.%d\n", |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
506 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
507 return SDL_FALSE; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
508 } |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
509 } |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
510 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
511 void |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
512 DirectFB_AdjustWindowSurface(SDL_Window * window) |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
513 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
514 SDL_DFB_WINDOWDATA(window); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
515 int adjust = windata->wm_needs_redraw; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
516 int cw, ch; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
517 |
4636 | 518 DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
519 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
520 SDL_DFB_CHECKERR(windata-> |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
521 window_surface->GetSize(windata->window_surface, &cw, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
522 &ch)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
523 if (cw != windata->size.w || ch != windata->size.h) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
524 adjust = 1; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
525 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
526 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
527 if (adjust) { |
4636 | 528 #if SDL_DIRECTFB_OPENGL |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
529 DirectFB_GL_FreeWindowContexts(window->display->device, window); |
4636 | 530 #endif |
531 | |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
532 #if (DFB_VERSION_ATLEAST(1,2,1)) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
533 SDL_DFB_CHECKERR(windata->dfbwin->ResizeSurface(windata->dfbwin, |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
534 windata->size.w, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
535 windata->size.h)); |
3040 | 536 SDL_DFB_CHECKERR(windata->surface->MakeSubSurface(windata->surface, |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
537 windata-> |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
538 window_surface, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
539 &windata->client)); |
3037
490f3e4fe753
Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents:
3023
diff
changeset
|
540 #else |
3040 | 541 DFBWindowOptions opts; |
542 | |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
543 SDL_DFB_CHECKERR(windata->dfbwin->GetOptions(windata->dfbwin, &opts)); |
3040 | 544 /* recreate subsurface */ |
545 SDL_DFB_RELEASE(windata->surface); | |
3039
829043b363d1
Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents:
3038
diff
changeset
|
546 |
3040 | 547 if (opts & DWOP_SCALE) |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
548 SDL_DFB_CHECKERR(windata->dfbwin->ResizeSurface(windata->dfbwin, |
3040 | 549 windata->size.w, |
550 windata->size.h)); | |
551 SDL_DFB_CHECKERR(windata->window_surface-> | |
552 GetSubSurface(windata->window_surface, | |
553 &windata->client, &windata->surface)); | |
3037
490f3e4fe753
Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents:
3023
diff
changeset
|
554 #endif |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
555 DirectFB_WM_RedrawLayout(window->display->device, window); |
4636 | 556 |
557 #if SDL_DIRECTFB_OPENGL | |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
558 DirectFB_GL_ReAllocWindowContexts(window->display->device, window); |
4636 | 559 #endif |
560 } | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
561 error: |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
562 return; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
563 } |