annotate src/video/directfb/SDL_DirectFB_window.c @ 4822:55f32099a4b5

Worked on Windows implementation and the quad-trees.
author egottlieb
date Mon, 02 Aug 2010 01:54:59 -0400
parents f7b03b6838cb
children 25b9cd8bdc30
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
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3685
diff changeset
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
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 */
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
104 SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
105 (_this, window, &window->w, &window->h));
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
106
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 /* Get the window's surface. */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
108 SDL_DFB_CHECKERR(windata->window->GetSurface(windata->window,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
109 &windata->window_surface));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
110 /* And get a subsurface for rendering */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
111 SDL_DFB_CHECKERR(windata->window_surface->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
112 GetSubSurface(windata->window_surface, &windata->client,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
113 &windata->surface));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
114
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 windata->window->SetOpacity(windata->window, 0xFF);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
116
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
117 /* Create Eventbuffer */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
118 SDL_DFB_CHECKERR(windata->window->CreateEventBuffer(windata->window,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
119 &windata->
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
120 eventbuffer));
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
121 SDL_DFB_CHECKERR(windata->window->
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
122 EnableEvents(windata->window, DWET_ALL));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
124 /* Create a font */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
125 /* FIXME: once during Video_Init */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
126 if (windata->is_managed) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
127 DFBFontDescription fdesc;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
128
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
129 fdesc.flags = DFDESC_HEIGHT;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
130 fdesc.height = windata->theme.font_size;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
131 font = NULL;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
132 SDL_DFB_CHECK(devdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
133 dfb->CreateFont(devdata->dfb, windata->theme.font,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
134 &fdesc, &font));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
135 windata->window_surface->SetFont(windata->window_surface, font);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
136 SDL_DFB_RELEASE(font);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
137 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
138
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 /* Make it the top most window. */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 windata->window->RaiseToTop(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 /* remember parent */
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
143 windata->window = window;
2737
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 /* Add to list ... */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 windata->next = devdata->firstwin;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 windata->opacity = 0xFF;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 devdata->firstwin = windata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
151 /* Draw Frame */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
152 DirectFB_WM_RedrawLayout(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
153
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 return 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 error:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 SDL_DFB_RELEASE(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 SDL_DFB_RELEASE(windata->surface);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 int
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 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
163 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 SDL_Unsupported();
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 DirectFB_SetWindowTitle(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
171 SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
172
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
173 if (windata->is_managed) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
174 windata->wm_needs_redraw = 1;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
175 } else
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
176 SDL_Unsupported();
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
177 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
178
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
179 void
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
180 DirectFB_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
181 {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
182 SDL_DFB_DEVICEDATA(_this);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
183 SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
184 SDL_Surface *surface = NULL;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
185 DFBResult ret;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
186
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
187 if (icon) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
188 SDL_PixelFormat format;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
189 DFBSurfaceDescription dsc;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
190 Uint32 *dest;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
191 Uint32 *p;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
192 int pitch, i;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
193
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
194 /* Convert the icon to ARGB for modern window managers */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
195 SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
196 0xFF000000);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
197 surface = SDL_ConvertSurface(icon, &format, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
198 if (!surface) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
199 return;
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 dsc.flags =
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
202 DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
203 dsc.caps = DSCAPS_VIDEOONLY;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
204 dsc.width = surface->w;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
205 dsc.height = surface->h;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
206 dsc.pixelformat = DSPF_ARGB;
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 SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
209 &windata->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_CHECKERR(windata->icon->Lock(windata->icon, DSLF_WRITE,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
212 (void *) &dest, &pitch));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
213
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
214 p = surface->pixels;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
215 for (i = 0; i < surface->h; i++)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
216 memcpy((char *) dest + i * pitch,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
217 (char *) p + i * surface->pitch, 4 * surface->w);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
218
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
219 windata->icon->Unlock(windata->icon);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
220 SDL_FreeSurface(surface);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
221 } else {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
222 SDL_DFB_RELEASE(windata->icon);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
223 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
224 return;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
225 error:
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 SDL_FreeSurface(surface);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
228 SDL_DFB_RELEASE(windata->icon);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
229 return;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 DirectFB_SetWindowPosition(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 int x, y;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 if (window->y == SDL_WINDOWPOS_UNDEFINED)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 y = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 y = window->y;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 if (window->x == SDL_WINDOWPOS_UNDEFINED)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 x = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 x = window->x;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 if (window->flags & SDL_WINDOW_FULLSCREEN) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 x = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 y = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 }
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
252 DirectFB_WM_AdjustWindowLayout(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 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
254 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 DirectFB_SetWindowSize(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258 {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
259 SDL_DFB_DEVICEDATA(_this);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
260 SDL_DFB_WINDOWDATA(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 int ret;
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 if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264 int cw;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 int ch;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267 /* Make sure all events are disabled for this operation ! */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
268 SDL_DFB_CHECKERR(windata->window->DisableEvents(windata->window,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
269 DWET_ALL));
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 SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize(_this, window, &cw, &ch));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
272
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
273 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
274
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
275 DirectFB_WM_AdjustWindowLayout(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
276 SDL_DFB_CHECKERR(windata->window->Resize(windata->window,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
277 windata->size.w,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
278 windata->size.h));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
279 }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
280
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
281 SDL_DFB_CHECKERR(windata->window->EnableEvents(windata->window,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
282 DWET_ALL));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
283
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
284 SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
285 (_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
286
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 SDL_OnWindowResized(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288 }
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 error:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 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
292 return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293 }
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 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296 DirectFB_ShowWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 SDL_DFB_WINDOWDATA(window);
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 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
301
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
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 DirectFB_HideWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 SDL_DFB_WINDOWDATA(window);
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 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
310 windata->window->SetOpacity(windata->window, 0);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 }
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 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 DirectFB_RaiseWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
316 SDL_DFB_WINDOWDATA(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 windata->window->RaiseToTop(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
319 windata->window->RequestFocus(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
321
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
322 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
323 DirectFB_MaximizeWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
324 {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
325 SDL_DFB_WINDOWDATA(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
326
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
327 if (windata->is_managed) {
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
328 DirectFB_WM_MaximizeWindow(_this, window);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
329 } else
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
330 SDL_Unsupported();
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
331 }
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 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
334 DirectFB_MinimizeWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 /* FIXME: Size to 32x32 ? */
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 SDL_Unsupported();
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342 DirectFB_RestoreWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343 {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
344 SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
345
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
346 if (windata->is_managed) {
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
347 DirectFB_WM_RestoreWindow(_this, window);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
348 } else
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
349 SDL_Unsupported();
2737
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
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
353 DirectFB_SetWindowGrab(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
354 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
357 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
358 windata->window->GrabPointer(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359 windata->window->GrabKeyboard(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
360 } else {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 windata->window->UngrabPointer(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362 windata->window->UngrabKeyboard(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
363 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364 }
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 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
367 DirectFB_DestroyWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
369 SDL_DFB_DEVICEDATA(_this);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
370 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371 DFB_WindowData *p;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
372
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
373 SDL_DFB_DEBUG("Trace\n");
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
374
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
375 /* Some cleanups */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
376 windata->window->UngrabPointer(windata->window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
377 windata->window->UngrabKeyboard(windata->window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
378
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
379 windata->window_surface->SetFont(windata->window_surface, NULL);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
380 SDL_DFB_RELEASE(windata->icon);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
381 SDL_DFB_RELEASE(windata->eventbuffer);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
382 SDL_DFB_RELEASE(windata->surface);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
383 SDL_DFB_RELEASE(windata->window_surface);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
384
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
385 SDL_DFB_RELEASE(windata->window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387 /* Remove from list ... */
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 p = devdata->firstwin;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390 while (p && p->next != windata)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391 p = p->next;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 if (p)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 p->next = windata->next;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
394 else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
395 devdata->firstwin = windata->next;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
396 SDL_free(windata);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397 return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
398 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 SDL_bool
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
401 DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
402 struct SDL_SysWMinfo * info)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
403 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
404 SDL_Unsupported();
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405 return SDL_FALSE;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
406 }
3023
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 void
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
409 DirectFB_AdjustWindowSurface(SDL_Window * window)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
410 {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
411 SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
412 int adjust = windata->wm_needs_redraw;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
413 int cw, ch;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
414 int ret;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
415
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
416 DirectFB_WM_AdjustWindowLayout(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
417
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
418 SDL_DFB_CHECKERR(windata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
419 window_surface->GetSize(windata->window_surface, &cw,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
420 &ch));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
421 if (cw != windata->size.w || ch != windata->size.h) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
422 adjust = 1;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
423 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
424
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
425 if (adjust) {
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
426 #if DFB_VERSION_ATLEAST(1,2,1)
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
427 SDL_DFB_CHECKERR(windata->window->ResizeSurface(windata->window,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
428 windata->size.w,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
429 windata->size.h));
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
430 SDL_DFB_CHECKERR(windata->surface->MakeSubSurface(windata->surface,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
431 windata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
432 window_surface,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
433 &windata->client));
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
434 #else
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
435 DFBWindowOptions opts;
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
436
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
437 SDL_DFB_CHECKERR(windata->window->GetOptions(windata->window, &opts));
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
438 /* recreate subsurface */
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
439 SDL_DFB_RELEASE(windata->surface);
3039
829043b363d1 Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3038
diff changeset
440
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
441 if (opts & DWOP_SCALE)
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
442 SDL_DFB_CHECKERR(windata->window->ResizeSurface(windata->window,
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
443 windata->size.w,
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
444 windata->size.h));
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
445 SDL_DFB_CHECKERR(windata->window_surface->
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
446 GetSubSurface(windata->window_surface,
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
447 &windata->client, &windata->surface));
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
448 #endif
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
449 DirectFB_WM_RedrawLayout(window);
3023
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 error:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
452 return;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
453 }