annotate src/video/directfb/SDL_DirectFB_window.c @ 3039:829043b363d1

Fix fullscreen crash with DirectFB <= 1.2.0
author Couriersud <couriersud@arcor.de>
date Tue, 13 Jan 2009 23:27:08 +0000
parents c73a5f8a03d2
children 62d4992e5a92
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
2859
99210400e8b9 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
3 Copyright (C) 1997-2009 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
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #include "SDL_syswm.h"
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #include "../SDL_sysvideo.h"
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #include "../../events/SDL_keyboard_c.h"
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include "SDL_DirectFB_video.h"
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
30
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 int
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 DirectFB_CreateWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 SDL_DFB_DEVICEDATA(_this);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 SDL_DFB_DISPLAYDATA(_this, window);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
36 DFB_WindowData *windata = NULL;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 DFBWindowOptions wopts;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 DFBWindowDescription desc;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
39 IDirectFBFont *font;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 int ret, x, y;
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_CALLOC(window->driverdata, 1, sizeof(DFB_WindowData));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 windata = (DFB_WindowData *) window->driverdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
45 windata->is_managed = devdata->has_own_wm;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
46
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
47 SDL_DFB_CHECKERR(devdata->dfb->SetCooperativeLevel(devdata->dfb,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
48 DFSCL_NORMAL));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
49 SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
50 DLSCL_ADMINISTRATIVE));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 /* Fill the window description. */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 if (window->x == SDL_WINDOWPOS_CENTERED) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 x = (dispdata->cw - window->w) / 2;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 } 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
56 x = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 } else {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 x = window->x;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 if (window->y == SDL_WINDOWPOS_CENTERED) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 y = (dispdata->ch - window->h) / 2;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 } 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
63 y = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 } else {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 y = window->y;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 if (window->flags & SDL_WINDOW_FULLSCREEN) {
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 y = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
72 DirectFB_WM_AdjustWindowLayout(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
74 /* Create Window */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
75 desc.flags =
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
76 DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_PIXELFORMAT | DWDESC_POSX
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
77 | DWDESC_POSY | DWDESC_SURFACE_CAPS;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 desc.posx = x;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 desc.posy = y;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
80 desc.width = windata->size.w;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
81 desc.height = windata->size.h;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 desc.pixelformat = dispdata->pixelformat;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 desc.surface_caps = DSCAPS_PREMULTIPLIED;
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 /* Create the window. */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
86 SDL_DFB_CHECKERR(dispdata->layer->CreateWindow(dispdata->layer, &desc,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
87 &windata->window));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
89 /* Set Options */
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 windata->window->GetOptions(windata->window, &wopts);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 if (window->flags & SDL_WINDOW_RESIZABLE)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 wopts |= DWOP_SCALE;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 wopts |= DWOP_KEEP_SIZE;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
97 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
98 wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_STACKING | DWOP_KEEP_SIZE;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
99 windata->window->SetStackingClass(windata->window, DWSC_UPPER);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
100 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
101 windata->window->SetOptions(windata->window, wopts);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
103 /* See what we got */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
104 SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize(_this, window, &window->w, &window->h));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
105
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 /* Get the window's surface. */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
107 SDL_DFB_CHECKERR(windata->window->GetSurface(windata->window,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
108 &windata->window_surface));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
109 /* And get a subsurface for rendering */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
110 SDL_DFB_CHECKERR(windata->window_surface->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
111 GetSubSurface(windata->window_surface, &windata->client,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
112 &windata->surface));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
113
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 windata->window->SetOpacity(windata->window, 0xFF);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
115
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
116 /* Create Eventbuffer */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
117 SDL_DFB_CHECKERR(windata->window->CreateEventBuffer(windata->window,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
118 &windata->eventbuffer));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
119 SDL_DFB_CHECKERR(windata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
120 window->EnableEvents(windata->window, DWET_ALL));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
122 /* Create a font */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
123 /* FIXME: once during Video_Init */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
124 if (windata->is_managed) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
125 DFBFontDescription fdesc;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
126
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
127 fdesc.flags = DFDESC_HEIGHT;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
128 fdesc.height = windata->theme.font_size;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
129 font = NULL;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
130 SDL_DFB_CHECK(devdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
131 dfb->CreateFont(devdata->dfb, windata->theme.font,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
132 &fdesc, &font));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
133 windata->window_surface->SetFont(windata->window_surface, font);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
134 SDL_DFB_RELEASE(font);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
135 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
136
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 /* Make it the top most window. */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 windata->window->RaiseToTop(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 /* remember parent */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
141 windata->sdl_id = window->id;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 /* Add to list ... */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 windata->next = devdata->firstwin;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 windata->opacity = 0xFF;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 devdata->firstwin = windata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
149 /* Draw Frame */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
150 DirectFB_WM_RedrawLayout(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
151
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 return 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 error:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 SDL_DFB_RELEASE(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 SDL_DFB_RELEASE(windata->surface);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 int
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 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
161 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 SDL_Unsupported();
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 DirectFB_SetWindowTitle(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
169 SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
170
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
171 if (windata->is_managed) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
172 windata->wm_needs_redraw = 1;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
173 } else
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
174 SDL_Unsupported();
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
175 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
176
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
177 void
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
178 DirectFB_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
179 {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
180 SDL_DFB_DEVICEDATA(_this);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
181 SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
182 SDL_Surface *surface = NULL;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
183 DFBResult ret;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
184
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
185 if (icon) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
186 SDL_PixelFormat format;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
187 DFBSurfaceDescription dsc;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
188 Uint32 *dest;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
189 Uint32 *p;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
190 int pitch, i;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
191
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
192 /* Convert the icon to ARGB for modern window managers */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
193 SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
194 0xFF000000);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
195 surface = SDL_ConvertSurface(icon, &format, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
196 if (!surface) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
197 return;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
198 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
199 dsc.flags =
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
200 DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
201 dsc.caps = DSCAPS_VIDEOONLY;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
202 dsc.width = surface->w;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
203 dsc.height = surface->h;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
204 dsc.pixelformat = DSPF_ARGB;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
205
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
206 SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
207 &windata->icon));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
208
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
209 SDL_DFB_CHECKERR(windata->icon->Lock(windata->icon, DSLF_WRITE,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
210 (void *) &dest, &pitch));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
211
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
212 p = surface->pixels;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
213 for (i = 0; i < surface->h; i++)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
214 memcpy((char *) dest + i * pitch,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
215 (char *) p + i * surface->pitch, 4 * surface->w);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
216
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
217 windata->icon->Unlock(windata->icon);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
218 SDL_FreeSurface(surface);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
219 } else {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
220 SDL_DFB_RELEASE(windata->icon);
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 return;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
223 error:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
224 if (surface)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
225 SDL_FreeSurface(surface);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
226 SDL_DFB_RELEASE(windata->icon);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
227 return;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231 DirectFB_SetWindowPosition(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 int x, y;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 if (window->y == SDL_WINDOWPOS_UNDEFINED)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 y = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 y = window->y;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 if (window->x == SDL_WINDOWPOS_UNDEFINED)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 x = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 x = window->x;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 if (window->flags & SDL_WINDOW_FULLSCREEN) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 x = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 y = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 }
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
250 DirectFB_WM_AdjustWindowLayout(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 windata->window->MoveTo(windata->window, x, y);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 DirectFB_SetWindowSize(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256 {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
257 SDL_DFB_DEVICEDATA(_this);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
258 SDL_DFB_WINDOWDATA(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
259 int ret;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 int cw;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263 int ch;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 /* Make sure all events are disabled for this operation ! */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
266 SDL_DFB_CHECKERR(windata->window->DisableEvents(windata->window,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
267 DWET_ALL));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
268
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
269 SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize(_this, window, &cw, &ch));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
270
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
271 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
272
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
273 DirectFB_WM_AdjustWindowLayout(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
274 SDL_DFB_CHECKERR(windata->window->Resize(windata->window,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
275 windata->size.w,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
276 windata->size.h));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
277 }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
279 SDL_DFB_CHECKERR(windata->window->EnableEvents(windata->window,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
280 DWET_ALL));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
281
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
282 SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize(_this, window, &window->w, &window->h));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284 SDL_OnWindowResized(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
286 return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 error:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288 windata->window->EnableEvents(windata->window, DWET_ALL);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289 return;
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
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293 DirectFB_ShowWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 windata->window->SetOpacity(windata->window, windata->opacity);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 DirectFB_HideWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 windata->window->GetOpacity(windata->window, &windata->opacity);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 windata->window->SetOpacity(windata->window, 0);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
310 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 DirectFB_RaiseWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 windata->window->RaiseToTop(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
316 windata->window->RequestFocus(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
317 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
319 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 DirectFB_MaximizeWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
321 {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
322 SDL_DFB_WINDOWDATA(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
323
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
324 if (windata->is_managed) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
325 DirectFB_WM_MaximizeWindow(_this, window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
326 } else
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
327 SDL_Unsupported();
2737
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_MinimizeWindow(_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 /* FIXME: Size to 32x32 ? */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
334
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 SDL_Unsupported();
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 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339 DirectFB_RestoreWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340 {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
341 SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
342
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
343 if (windata->is_managed) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
344 DirectFB_WM_RestoreWindow(_this, window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
345 } else
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
346 SDL_Unsupported();
2737
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
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
349 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
350 DirectFB_SetWindowGrab(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
353
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
354 if ((window->flags & SDL_WINDOW_INPUT_GRABBED)) {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355 windata->window->GrabPointer(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356 windata->window->GrabKeyboard(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
357 } else {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
358 windata->window->UngrabPointer(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359 windata->window->UngrabKeyboard(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
360 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
363 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364 DirectFB_DestroyWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
365 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
366 SDL_DFB_DEVICEDATA(_this);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
367 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368 DFB_WindowData *p;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
369
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
370 SDL_DFB_DEBUG("Trace\n");
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
372 /* Some cleanups */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
373 windata->window->UngrabPointer(windata->window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
374 windata->window->UngrabKeyboard(windata->window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
375
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
376 windata->window_surface->SetFont(windata->window_surface, NULL);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
377 SDL_DFB_RELEASE(windata->icon);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
378 SDL_DFB_RELEASE(windata->eventbuffer);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
379 SDL_DFB_RELEASE(windata->surface);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
380 SDL_DFB_RELEASE(windata->window_surface);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
381
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
382 SDL_DFB_RELEASE(windata->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 /* Remove from list ... */
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 p = devdata->firstwin;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387 while (p && p->next != windata)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388 p = p->next;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
389 if (p)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390 p->next = windata->next;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391 else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 devdata->firstwin = windata->next;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 SDL_free(windata);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
394 return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
395 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
396
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397 SDL_bool
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
398 DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399 struct SDL_SysWMinfo * info)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
401 SDL_Unsupported();
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
402 return SDL_FALSE;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
403 }
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
404
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
405 void
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
406 DirectFB_AdjustWindowSurface(SDL_Window * window)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
407 {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
408 SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
409 int adjust = windata->wm_needs_redraw;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
410 int cw, ch;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
411 int ret;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
412
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
413 DirectFB_WM_AdjustWindowLayout(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
414
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
415 SDL_DFB_CHECKERR(windata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
416 window_surface->GetSize(windata->window_surface, &cw,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
417 &ch));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
418 if (cw != windata->size.w || ch != windata->size.h) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
419 adjust = 1;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
420 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
421
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
422 if (adjust) {
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
423 #if DFB_VERSION_ATLEAST(1,2,1)
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
424 SDL_DFB_CHECKERR(windata->window->ResizeSurface(windata->window,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
425 windata->size.w,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
426 windata->size.h));
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
427 SDL_DFB_CHECKERR(windata->surface->MakeSubSurface(windata->surface,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
428 windata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
429 window_surface,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
430 &windata->client));
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
431 #else
3039
829043b363d1 Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3038
diff changeset
432 DFBWindowOptions opts;
829043b363d1 Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3038
diff changeset
433
829043b363d1 Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3038
diff changeset
434 SDL_DFB_CHECKERR(windata->window->GetOptions(windata->window, &opts));
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
435 /* recreate subsurface */
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
436 SDL_DFB_RELEASE(windata->surface);
3039
829043b363d1 Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3038
diff changeset
437
829043b363d1 Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3038
diff changeset
438 if (opts & DWOP_SCALE)
829043b363d1 Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3038
diff changeset
439 SDL_DFB_CHECKERR(windata->window->ResizeSurface(windata->window,
829043b363d1 Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3038
diff changeset
440 windata->size.w,
829043b363d1 Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3038
diff changeset
441 windata->size.h));
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
442 SDL_DFB_CHECKERR(windata->window_surface->
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
443 GetSubSurface(windata->window_surface, &windata->client,
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
444 &windata->surface));
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
445 #endif
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
446 DirectFB_WM_RedrawLayout(window);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
447 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
448 error:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
449 return;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
450 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
451