src/video/directfb/SDL_DirectFB_window.c
author Sam Lantinga <slouken@libsdl.org>
Mon, 14 Mar 2011 23:14:51 -0700
changeset 5489 e0c63a55b67d
parent 5488 c20436fd5627
child 5495 b3680e05286d
permissions -rw-r--r--
SDL will treat the functionality as unsupported if the functions aren't filled in.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
5262
b530ef003506 Happy 2011! :)
Sam Lantinga <slouken@libsdl.org>
parents: 5246
diff changeset
     3
    Copyright (C) 1997-2011 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
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    21
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    22
    SDL1.3 DirectFB driver by couriersud@arcor.de
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    23
	
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
*/
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
#include "SDL_DirectFB_video.h"
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    27
#include "SDL_DirectFB_modes.h"
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    28
#include "SDL_DirectFB_window.h"
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    29
#include "SDL_DirectFB_shape.h"
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    30
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
    31
#if SDL_DIRECTFB_OPENGL
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
    32
#include "SDL_DirectFB_opengl.h"
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
    33
#endif
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    35
#include "SDL_syswm.h"
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    36
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    37
#include "../SDL_pixels_c.h"
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
    38
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    39
int
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    40
DirectFB_CreateWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    41
{
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    42
    SDL_DFB_DEVICEDATA(_this);
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    43
    SDL_DFB_DISPLAYDATA(window);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
    44
    DFB_WindowData *windata = NULL;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
    DFBWindowOptions wopts;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    46
    DFBWindowDescription desc;
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
    47
    int x, y;
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    48
    int bshaped = 0;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    49
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    50
    SDL_DFB_ALLOC_CLEAR(window->driverdata, sizeof(DFB_WindowData));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    51
    windata = (DFB_WindowData *) window->driverdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    52
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
    53
    windata->is_managed = devdata->has_own_wm;
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    54
#if 1
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
    55
    SDL_DFB_CHECKERR(devdata->dfb->SetCooperativeLevel(devdata->dfb,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
    56
                                                       DFSCL_NORMAL));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
    57
    SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
    58
                                                          DLSCL_ADMINISTRATIVE));
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    59
#endif
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    60
	/* FIXME ... ughh, ugly */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    61
	if (window->x == -1000 && window->y == -1000)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    62
		bshaped = 1;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    63
	
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    64
    /* Fill the window description. */
5246
58265e606e4e Window coordinates are in the global space and windows are not tied to a particular display.
Sam Lantinga <slouken@libsdl.org>
parents: 5199
diff changeset
    65
    if (SDL_WINDOWPOS_ISCENTERED(window->x)) {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    66
        x = (dispdata->cw - window->w) / 2;
5246
58265e606e4e Window coordinates are in the global space and windows are not tied to a particular display.
Sam Lantinga <slouken@libsdl.org>
parents: 5199
diff changeset
    67
    } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    68
        x = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    69
    } else {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    70
        x = window->x;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    71
    }
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    72
    
5246
58265e606e4e Window coordinates are in the global space and windows are not tied to a particular display.
Sam Lantinga <slouken@libsdl.org>
parents: 5199
diff changeset
    73
    if (SDL_WINDOWPOS_ISCENTERED(window->y)) {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    74
        y = (dispdata->ch - window->h) / 2;
5246
58265e606e4e Window coordinates are in the global space and windows are not tied to a particular display.
Sam Lantinga <slouken@libsdl.org>
parents: 5199
diff changeset
    75
    } else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    76
        y = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    77
    } else {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    78
        y = window->y;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    79
    }
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    80
    
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    81
    if (window->flags & SDL_WINDOW_FULLSCREEN) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    82
        x = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    83
        y = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    84
    }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    85
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
    86
    DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    87
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
    88
    /* Create Window */
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    89
	desc.caps = 0;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
    90
    desc.flags =
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    91
        DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY | DWDESC_SURFACE_CAPS;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    92
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    93
    if (bshaped) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    94
    	desc.flags |= DWDESC_CAPS;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    95
    	desc.caps |= DWCAPS_ALPHACHANNEL;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    96
    }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    97
    else
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    98
    {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
    99
    	desc.flags |= DWDESC_PIXELFORMAT;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   100
    }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   101
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   102
    if (!(window->flags & SDL_WINDOW_BORDERLESS))
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   103
		desc.caps |= DWCAPS_NODECORATION;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   104
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   105
    desc.posx = x;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   106
    desc.posy = y;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   107
    desc.width = windata->size.w;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   108
    desc.height = windata->size.h;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   109
    desc.pixelformat = dispdata->pixelformat;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   110
    desc.surface_caps = DSCAPS_PREMULTIPLIED;
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   111
    
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   112
    /* Create the window. */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   113
    SDL_DFB_CHECKERR(dispdata->layer->CreateWindow(dispdata->layer, &desc,
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   114
                                                   &windata->dfbwin));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   115
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   116
    /* Set Options */
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   117
    SDL_DFB_CHECK(windata->dfbwin->GetOptions(windata->dfbwin, &wopts));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   118
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   119
    /* explicit rescaling of surface */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   120
    wopts |= DWOP_SCALE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   121
    if (window->flags & SDL_WINDOW_RESIZABLE) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   122
        wopts &= ~DWOP_KEEP_SIZE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   123
    }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   124
    else {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   125
        wopts |= DWOP_KEEP_SIZE;
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   126
    }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   127
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   128
    if (window->flags & SDL_WINDOW_FULLSCREEN) {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   129
        wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_STACKING | DWOP_KEEP_SIZE;
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   130
        SDL_DFB_CHECK(windata->dfbwin->SetStackingClass(windata->dfbwin, DWSC_UPPER));
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   131
    }
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   132
    
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   133
    if (bshaped) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   134
        wopts |= DWOP_SHAPED | DWOP_ALPHACHANNEL;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   135
        wopts &= ~DWOP_OPAQUE_REGION;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   136
    }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   137
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   138
    SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   139
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   140
    /* See what we got */
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   141
    SDL_DFB_CHECK(DirectFB_WM_GetClientSize
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   142
                     (_this, window, &window->w, &window->h));
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   143
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   144
    /* Get the window's surface. */
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   145
    SDL_DFB_CHECKERR(windata->dfbwin->GetSurface(windata->dfbwin,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   146
                                                 &windata->window_surface));
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   147
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   148
    /* And get a subsurface for rendering */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   149
    SDL_DFB_CHECKERR(windata->window_surface->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   150
                     GetSubSurface(windata->window_surface, &windata->client,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   151
                                   &windata->surface));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   152
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   153
    SDL_DFB_CHECK(windata->dfbwin->SetOpacity(windata->dfbwin, 0xFF));
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   154
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   155
    /* Create Eventbuffer */
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   156
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   157
    SDL_DFB_CHECKERR(windata->dfbwin->CreateEventBuffer(windata->dfbwin,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   158
                                                        &windata->
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   159
                                                        eventbuffer));
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   160
    SDL_DFB_CHECKERR(windata->dfbwin->
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   161
                     EnableEvents(windata->dfbwin, DWET_ALL));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   162
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   163
    /* Create a font */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   164
    /* FIXME: once during Video_Init */
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   165
    windata->font = NULL;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   166
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   167
    /* Make it the top most window. */
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   168
    SDL_DFB_CHECK(windata->dfbwin->RaiseToTop(windata->dfbwin));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   169
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   170
    /* remember parent */
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   171
    //windata->sdlwin = window;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   172
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   173
    /* Add to list ... */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   174
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   175
    windata->next = devdata->firstwin;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   176
    windata->opacity = 0xFF;
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   177
    devdata->firstwin = window;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   178
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   179
    /* Draw Frame */
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   180
    DirectFB_WM_RedrawLayout(_this, window);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   181
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   182
    return 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   183
  error:
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   184
	SDL_DFB_RELEASE(windata->surface);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   185
    SDL_DFB_RELEASE(windata->dfbwin);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   186
    return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   187
}
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   188
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   189
int
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   190
DirectFB_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   191
{
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   192
    SDL_Unsupported();
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   193
    return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   194
}
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   195
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   196
void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   197
DirectFB_SetWindowTitle(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   198
{
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   199
    SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   200
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   201
    if (windata->is_managed) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   202
        windata->wm_needs_redraw = 1;
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   203
        DirectFB_WM_RedrawLayout(_this, window);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   204
    } else
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   205
        SDL_Unsupported();
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   206
}
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   207
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   208
void
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   209
DirectFB_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   210
{
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   211
    SDL_DFB_DEVICEDATA(_this);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   212
    SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   213
    SDL_Surface *surface = NULL;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   214
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   215
    if (icon) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   216
        SDL_PixelFormat format;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   217
        DFBSurfaceDescription dsc;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   218
        Uint32 *dest;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   219
        Uint32 *p;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   220
        int pitch, i;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   221
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   222
        /* Convert the icon to ARGB for modern window managers */
5288
d4381f3b0d1e A few fixes:
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   223
        SDL_InitFormat(&format, SDL_PIXELFORMAT_ARGB8888);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   224
        surface = SDL_ConvertSurface(icon, &format, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   225
        if (!surface) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   226
            return;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   227
        }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   228
        dsc.flags =
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   229
            DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   230
        dsc.caps = DSCAPS_VIDEOONLY;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   231
        dsc.width = surface->w;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   232
        dsc.height = surface->h;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   233
        dsc.pixelformat = DSPF_ARGB;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   234
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   235
        SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   236
                                                     &windata->icon));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   237
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   238
        SDL_DFB_CHECKERR(windata->icon->Lock(windata->icon, DSLF_WRITE,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   239
                                             (void *) &dest, &pitch));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   240
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   241
        p = surface->pixels;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   242
        for (i = 0; i < surface->h; i++)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   243
            memcpy((char *) dest + i * pitch,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   244
                   (char *) p + i * surface->pitch, 4 * surface->w);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   245
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   246
        SDL_DFB_CHECK(windata->icon->Unlock(windata->icon));
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   247
        SDL_FreeSurface(surface);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   248
    } else {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   249
        SDL_DFB_RELEASE(windata->icon);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   250
    }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   251
    return;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   252
  error:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   253
    if (surface)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   254
        SDL_FreeSurface(surface);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   255
    SDL_DFB_RELEASE(windata->icon);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   256
    return;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   257
}
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   258
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   259
void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   260
DirectFB_SetWindowPosition(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   261
{
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   262
    SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   263
    int x, y;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   264
5478
6b65ff3cee62 Fixed bug 1167 (SDL_WINDOWPOS_CENTERED doesn't work if used right after fullscreen -> windowed switch)
Sam Lantinga <slouken@libsdl.org>
parents: 5288
diff changeset
   265
    x = window->x;
6b65ff3cee62 Fixed bug 1167 (SDL_WINDOWPOS_CENTERED doesn't work if used right after fullscreen -> windowed switch)
Sam Lantinga <slouken@libsdl.org>
parents: 5288
diff changeset
   266
    y = window->y;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   267
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   268
    DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   269
    SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, x, y));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   270
}
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   271
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   272
void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   273
DirectFB_SetWindowSize(_THIS, SDL_Window * window)
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
    SDL_DFB_WINDOWDATA(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   276
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   277
    if(SDL_IsShapedWindow(window))
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   278
        DirectFB_ResizeWindowShape(window);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   279
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   280
    if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   281
        int cw;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   282
        int ch;
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
        /* Make sure all events are disabled for this operation ! */
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   285
        SDL_DFB_CHECKERR(windata->dfbwin->DisableEvents(windata->dfbwin,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   286
                                                        DWET_ALL));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   287
        SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize(_this, window, &cw, &ch));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   288
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   289
        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
   290
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   291
		    DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   292
            SDL_DFB_CHECKERR(windata->dfbwin->Resize(windata->dfbwin,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   293
                                                     windata->size.w,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   294
                                                     windata->size.h));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   295
        }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   296
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   297
        SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   298
                     (_this, window, &window->w, &window->h));
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   299
        DirectFB_AdjustWindowSurface(window);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   300
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   301
        SDL_DFB_CHECKERR(windata->dfbwin->EnableEvents(windata->dfbwin,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   302
                                                       DWET_ALL));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   303
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   304
    }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   305
    return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   306
  error:
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   307
    SDL_DFB_CHECK(windata->dfbwin->EnableEvents(windata->dfbwin, DWET_ALL));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   308
    return;
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
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   311
void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   312
DirectFB_ShowWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   313
{
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   314
    SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   315
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   316
    SDL_DFB_CHECK(windata->dfbwin->SetOpacity(windata->dfbwin, windata->opacity));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   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
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   320
void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   321
DirectFB_HideWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   322
{
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   323
    SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   324
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   325
    SDL_DFB_CHECK(windata->dfbwin->GetOpacity(windata->dfbwin, &windata->opacity));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   326
    SDL_DFB_CHECK(windata->dfbwin->SetOpacity(windata->dfbwin, 0));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   327
}
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
void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   330
DirectFB_RaiseWindow(_THIS, SDL_Window * window)
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
    SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   333
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   334
    SDL_DFB_CHECK(windata->dfbwin->RaiseToTop(windata->dfbwin));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   335
    SDL_DFB_CHECK(windata->dfbwin->RequestFocus(windata->dfbwin));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   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_MaximizeWindow(_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);
5246
58265e606e4e Window coordinates are in the global space and windows are not tied to a particular display.
Sam Lantinga <slouken@libsdl.org>
parents: 5199
diff changeset
   342
    SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   343
    DFBWindowOptions wopts;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   344
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   345
    SDL_DFB_CHECK(windata->dfbwin->GetPosition(windata->dfbwin,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   346
                                 &windata->restore.x, &windata->restore.y));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   347
    SDL_DFB_CHECK(windata->dfbwin->GetSize(windata->dfbwin, &windata->restore.w,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   348
                             &windata->restore.h));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   349
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   350
    DirectFB_WM_AdjustWindowLayout(window, window->flags | SDL_WINDOW_MAXIMIZED, display->current_mode.w, display->current_mode.h) ;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   351
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   352
    SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, 0, 0));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   353
    SDL_DFB_CHECK(windata->dfbwin->Resize(windata->dfbwin,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   354
                            display->current_mode.w, display->current_mode.h));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   355
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   356
    /* Set Options */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   357
    SDL_DFB_CHECK(windata->dfbwin->GetOptions(windata->dfbwin, &wopts));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   358
    wopts |= DWOP_KEEP_SIZE | DWOP_KEEP_POSITION;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   359
    SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   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
void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   363
DirectFB_MinimizeWindow(_THIS, SDL_Window * window)
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
    /* FIXME: Size to 32x32 ? */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   366
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   367
    SDL_Unsupported();
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
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   370
void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   371
DirectFB_RestoreWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   372
{
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   373
    SDL_DFB_WINDOWDATA(window);
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   374
    DFBWindowOptions wopts;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   375
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   376
    /* Set Options */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   377
    SDL_DFB_CHECK(windata->dfbwin->GetOptions(windata->dfbwin, &wopts));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   378
    wopts &= ~(DWOP_KEEP_SIZE | DWOP_KEEP_POSITION);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   379
    SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   380
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   381
    /* Window layout */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   382
    DirectFB_WM_AdjustWindowLayout(window, window->flags & ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED),
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   383
    	windata->restore.w, windata->restore.h);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   384
    SDL_DFB_CHECK(windata->dfbwin->Resize(windata->dfbwin, windata->restore.w,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   385
                            windata->restore.h));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   386
    SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, windata->restore.x,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   387
                            windata->restore.y));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   388
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   389
    if (!(window->flags & SDL_WINDOW_RESIZABLE))
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   390
        wopts |= DWOP_KEEP_SIZE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   391
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   392
    if (window->flags & SDL_WINDOW_FULLSCREEN)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   393
        wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_SIZE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   394
    SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   395
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   396
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   397
}
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
void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   400
DirectFB_SetWindowGrab(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   401
{
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   402
    SDL_DFB_DEVICEDATA(_this);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   403
    SDL_DFB_WINDOWDATA(window);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   404
    DFB_WindowData *gwindata = ((devdata->grabbed_window) ? (DFB_WindowData *) ((devdata->grabbed_window)->driverdata) : NULL);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   405
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   406
    if ((window->flags & SDL_WINDOW_INPUT_GRABBED)) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   407
        if (gwindata != NULL)
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   408
        {
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   409
		    SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   410
		    SDL_DFB_CHECK(gwindata->dfbwin->UngrabKeyboard(gwindata->dfbwin));
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   411
        }
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   412
        SDL_DFB_CHECK(windata->dfbwin->GrabPointer(windata->dfbwin));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   413
        SDL_DFB_CHECK(windata->dfbwin->GrabKeyboard(windata->dfbwin));
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   414
        devdata->grabbed_window = window;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   415
    } else {
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   416
        SDL_DFB_CHECK(windata->dfbwin->UngrabPointer(windata->dfbwin));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   417
        SDL_DFB_CHECK(windata->dfbwin->UngrabKeyboard(windata->dfbwin));
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   418
        devdata->grabbed_window = NULL;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   419
    }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   420
}
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   421
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   422
void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   423
DirectFB_DestroyWindow(_THIS, SDL_Window * window)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   424
{
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   425
    SDL_DFB_DEVICEDATA(_this);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   426
    SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   427
    DFB_WindowData *p;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   428
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   429
    /* Some cleanups */
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   430
    SDL_DFB_CHECK(windata->dfbwin->UngrabPointer(windata->dfbwin));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   431
    SDL_DFB_CHECK(windata->dfbwin->UngrabKeyboard(windata->dfbwin));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   432
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   433
#if SDL_DIRECTFB_OPENGL
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   434
	DirectFB_GL_DestroyWindowContexts(_this, window);
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   435
#endif
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   436
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   437
	if (window->shaper)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   438
	{
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   439
	    SDL_ShapeData *data = window->shaper->driverdata;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   440
	    SDL_DFB_CHECK(data->surface->ReleaseSource(data->surface));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   441
    	SDL_DFB_RELEASE(data->surface);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   442
    	SDL_DFB_FREE(data);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   443
    	SDL_DFB_FREE(window->shaper);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   444
	}
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   445
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   446
    SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, NULL));
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   447
    SDL_DFB_CHECK(windata->surface->ReleaseSource(windata->surface));
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   448
    SDL_DFB_CHECK(windata->window_surface->ReleaseSource(windata->window_surface));
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   449
  	SDL_DFB_RELEASE(windata->icon);
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   450
    SDL_DFB_RELEASE(windata->font);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   451
    SDL_DFB_RELEASE(windata->eventbuffer);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   452
    SDL_DFB_RELEASE(windata->surface);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   453
    SDL_DFB_RELEASE(windata->window_surface);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   454
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   455
    SDL_DFB_RELEASE(windata->dfbwin);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   456
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   457
    /* Remove from list ... */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   458
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   459
    p = devdata->firstwin->driverdata;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   460
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   461
    while (p && p->next != window)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   462
        p = (p->next ? p->next->driverdata : NULL);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   463
    if (p)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   464
        p->next = windata->next;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   465
    else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   466
        devdata->firstwin = windata->next;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   467
    SDL_free(windata);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   468
    return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   469
}
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   470
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   471
SDL_bool
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   472
DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   473
                         struct SDL_SysWMinfo * info)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   474
{
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   475
    SDL_DFB_DEVICEDATA(_this);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   476
    SDL_DFB_WINDOWDATA(window);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   477
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   478
    if (info->version.major == SDL_MAJOR_VERSION &&
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   479
        info->version.minor == SDL_MINOR_VERSION) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   480
        info->subsystem = SDL_SYSWM_DIRECTFB;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   481
        info->info.dfb.dfb = devdata->dfb;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   482
        info->info.dfb.window = windata->dfbwin;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   483
        info->info.dfb.surface = windata->surface;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   484
        return SDL_TRUE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   485
    } else {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   486
        SDL_SetError("Application not compiled with SDL %d.%d\n",
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   487
                     SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   488
        return SDL_FALSE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   489
    }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   490
}
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   491
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   492
void
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   493
DirectFB_AdjustWindowSurface(SDL_Window * window)
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   494
{
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   495
    SDL_DFB_WINDOWDATA(window);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   496
    int adjust = windata->wm_needs_redraw;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   497
    int cw, ch;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   498
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   499
    DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   500
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   501
    SDL_DFB_CHECKERR(windata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   502
                     window_surface->GetSize(windata->window_surface, &cw,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   503
                                             &ch));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   504
    if (cw != windata->size.w || ch != windata->size.h) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   505
        adjust = 1;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   506
    }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   507
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   508
    if (adjust) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   509
#if SDL_DIRECTFB_OPENGL
5246
58265e606e4e Window coordinates are in the global space and windows are not tied to a particular display.
Sam Lantinga <slouken@libsdl.org>
parents: 5199
diff changeset
   510
		DirectFB_GL_FreeWindowContexts(SDL_GetVideoDevice(), window);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   511
#endif
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   512
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   513
#if (DFB_VERSION_ATLEAST(1,2,1))
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   514
        SDL_DFB_CHECKERR(windata->dfbwin->ResizeSurface(windata->dfbwin,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   515
                                                        windata->size.w,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   516
                                                        windata->size.h));
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   517
        SDL_DFB_CHECKERR(windata->surface->MakeSubSurface(windata->surface,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   518
                                                          windata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   519
                                                          window_surface,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   520
                                                          &windata->client));
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
   521
#else
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   522
        DFBWindowOptions opts;
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   523
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   524
        SDL_DFB_CHECKERR(windata->dfbwin->GetOptions(windata->dfbwin, &opts));
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   525
        /* recreate subsurface */
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   526
        SDL_DFB_RELEASE(windata->surface);
3039
829043b363d1 Fix fullscreen crash with DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3038
diff changeset
   527
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   528
        if (opts & DWOP_SCALE)
5199
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
   529
            SDL_DFB_CHECKERR(windata->dfbwin->ResizeSurface(windata->dfbwin,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   530
                                                            windata->size.w,
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   531
                                                            windata->size.h));
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   532
        SDL_DFB_CHECKERR(windata->window_surface->
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   533
                         GetSubSurface(windata->window_surface,
Sam Lantinga <slouken@libsdl.org>
parents: 3039
diff changeset
   534
                                       &windata->client, &windata->surface));
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
   535
#endif
5246
58265e606e4e Window coordinates are in the global space and windows are not tied to a particular display.
Sam Lantinga <slouken@libsdl.org>
parents: 5199
diff changeset
   536
        DirectFB_WM_RedrawLayout(SDL_GetVideoDevice(), window);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   537
        
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   538
#if SDL_DIRECTFB_OPENGL
5246
58265e606e4e Window coordinates are in the global space and windows are not tied to a particular display.
Sam Lantinga <slouken@libsdl.org>
parents: 5199
diff changeset
   539
		DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   540
#endif
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
   541
   }
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   542
  error:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   543
    return;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
   544
}