src/video/bwindow/SDL_BWin.h
author Ryan C. Gordon <icculus@icculus.org>
Fri, 14 Sep 2012 11:07:47 -0400
changeset 6424 bfaafcf78560
parent 6422 fd0ac1b56115
child 6885 700f1b25f77f
permissions -rwxr-xr-x
Patched to compile on Haiku.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     2
  Simple DirectMedia Layer
6138
4c64952a58fb Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 6037
diff changeset
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     7
  arising from the use of this software.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    11
  freely, subject to the following restrictions:
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    20
*/
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    21
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    22
#ifndef _SDL_BWin_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    23
#define _SDL_BWin_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    24
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    25
#ifdef __cplusplus
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    26
extern "C" {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    27
#endif
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    28
1367
e440d5c488c1 Fixes for BeOS and Solaris builds
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
    29
#include "SDL_config.h"
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    30
#include "SDL.h"
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    31
#include "SDL_syswm.h"
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
    32
#include "SDL_bframebuffer.h"
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    33
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    34
#ifdef __cplusplus
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    35
}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    36
#endif
1367
e440d5c488c1 Fixes for BeOS and Solaris builds
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
    37
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    38
#include <stdio.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    39
#include <AppKit.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    40
#include <InterfaceKit.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    41
#include <be/game/DirectWindow.h>
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
    42
#if SDL_VIDEO_OPENGL
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    43
#include <be/opengl/GLView.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    44
#endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    45
#include "SDL_events.h"
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    46
#include "../../main/beos/SDL_BApp.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    47
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
    48
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    49
enum WinCommands {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    50
	BWIN_MOVE_WINDOW,
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    51
	BWIN_RESIZE_WINDOW,
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    52
	BWIN_SHOW_WINDOW,
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    53
	BWIN_HIDE_WINDOW,
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    54
	BWIN_MAXIMIZE_WINDOW,
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    55
	BWIN_MINIMIZE_WINDOW,
5939
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
    56
	BWIN_RESTORE_WINDOW,
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    57
	BWIN_SET_TITLE,
6422
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
    58
	BWIN_SET_BORDERED,
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    59
	BWIN_FULLSCREEN
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    60
};
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    61
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    62
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
    63
class SDL_BWin:public BDirectWindow
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    64
{
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
    65
  public:
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    66
  	/* Constructor/Destructor */
6421
798d88be4de9 BeOS/Haiku support for SDL_WINDOW_BORDERLESS.
Ryan C. Gordon <icculus@icculus.org>
parents: 6138
diff changeset
    67
    SDL_BWin(BRect bounds, window_look look, uint32 flags)
798d88be4de9 BeOS/Haiku support for SDL_WINDOW_BORDERLESS.
Ryan C. Gordon <icculus@icculus.org>
parents: 6138
diff changeset
    68
        : BDirectWindow(bounds, "Untitled", look, B_NORMAL_WINDOW_FEEL, flags)
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
    69
    {
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
    70
        _last_buttons = 0;
5923
460ce3fb104c Corrected memory leak with rendering.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5922
diff changeset
    71
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
    72
#if SDL_VIDEO_OPENGL
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
    73
        _SDL_GLView = NULL;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    74
#endif
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
    75
        _shown = false;
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
    76
        _inhibit_resize = false;
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
    77
        _mouse_focused = false;
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
    78
        _prev_frame = NULL;
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
    79
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
    80
        /* Handle framebuffer stuff */
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
    81
        _connected = _connection_disabled = false;
5929
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
    82
        _buffer_created = _buffer_dirty = false;
5930
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
    83
        _trash_window_buffer = false;
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
    84
        _buffer_locker = new BLocker();
5933
5f8a7ebc88e5 Replaced window backbuffer with BBitmap
Nathan Heisey <nathanheisey@gmail.com>
parents: 5932
diff changeset
    85
        _bitmap = NULL;
5936
116b7457e73a Reduced SEGFAULT occurence on resize?
Nathan Heisey <nathanheisey@gmail.com>
parents: 5934
diff changeset
    86
#ifdef DRAWTHREAD
5929
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
    87
        _draw_thread_id = spawn_thread(BE_DrawThread, "drawing_thread",
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
    88
        					B_NORMAL_PRIORITY, (void*) this);
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
    89
        resume_thread(_draw_thread_id);
5936
116b7457e73a Reduced SEGFAULT occurence on resize?
Nathan Heisey <nathanheisey@gmail.com>
parents: 5934
diff changeset
    90
#endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
    91
    }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
    92
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
    93
    virtual ~ SDL_BWin()
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
    94
    {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
    95
        Lock();
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
    96
        _connection_disabled = true;
5929
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
    97
        int32 result;
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
    98
        
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
    99
#if SDL_VIDEO_OPENGL
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   100
        if (_SDL_GLView) {
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   101
            _SDL_GLView->UnlockGL();
5937
74870d003e32 Fixed some problems with switching to/from fullscreen
Nathan Heisey <nathanheisey@gmail.com>
parents: 5936
diff changeset
   102
            RemoveChild(_SDL_GLView);	/* Why was this outside the if
74870d003e32 Fixed some problems with switching to/from fullscreen
Nathan Heisey <nathanheisey@gmail.com>
parents: 5936
diff changeset
   103
            								statement before? */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   104
        }
5937
74870d003e32 Fixed some problems with switching to/from fullscreen
Nathan Heisey <nathanheisey@gmail.com>
parents: 5936
diff changeset
   105
        
5923
460ce3fb104c Corrected memory leak with rendering.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5922
diff changeset
   106
#endif    
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   107
        Unlock();
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   108
#if SDL_VIDEO_OPENGL
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   109
        if (_SDL_GLView) {
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   110
            delete _SDL_GLView;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   111
        }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   112
#endif
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   113
        
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   114
        /* Clean up framebuffer stuff */
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   115
        _buffer_locker->Lock();
5936
116b7457e73a Reduced SEGFAULT occurence on resize?
Nathan Heisey <nathanheisey@gmail.com>
parents: 5934
diff changeset
   116
#ifdef DRAWTHREAD
5929
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
   117
        wait_for_thread(_draw_thread_id, &result);
5936
116b7457e73a Reduced SEGFAULT occurence on resize?
Nathan Heisey <nathanheisey@gmail.com>
parents: 5934
diff changeset
   118
#endif
5923
460ce3fb104c Corrected memory leak with rendering.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5922
diff changeset
   119
        free(_clips);
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   120
        delete _buffer_locker;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   121
    }
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   122
    
5923
460ce3fb104c Corrected memory leak with rendering.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5922
diff changeset
   123
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   124
    /* * * * * OpenGL functionality * * * * */
5923
460ce3fb104c Corrected memory leak with rendering.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5922
diff changeset
   125
#if SDL_VIDEO_OPENGL
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   126
    virtual BGLView *CreateGLView(Uint32 gl_flags) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   127
        Lock();
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   128
        if (_SDL_GLView == NULL) {
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   129
            _SDL_GLView = new BGLView(Bounds(), "SDL GLView",
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   130
                                     B_FOLLOW_ALL_SIDES,
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   131
                                     (B_WILL_DRAW | B_FRAME_EVENTS),
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   132
                                     gl_flags);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   133
        }
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   134
        AddChild(_SDL_GLView);
5937
74870d003e32 Fixed some problems with switching to/from fullscreen
Nathan Heisey <nathanheisey@gmail.com>
parents: 5936
diff changeset
   135
        _SDL_GLView->EnableDirectMode(true);
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   136
        _SDL_GLView->LockGL();	/* "New" GLViews are created */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   137
        Unlock();
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   138
        return (_SDL_GLView);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   139
    }
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   140
    
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   141
    virtual void RemoveGLView() {
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   142
    	Lock();
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   143
    	if(_SDL_GLView) {
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   144
    		_SDL_GLView->UnlockGL();
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   145
    		RemoveChild(_SDL_GLView);
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   146
    	}
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   147
    	Unlock();
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   148
    }
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   149
    
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   150
    virtual void SwapBuffers(void) {
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   151
		_SDL_GLView->UnlockGL();
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   152
		_SDL_GLView->LockGL();
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   153
		_SDL_GLView->SwapBuffers();
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   154
	}
5923
460ce3fb104c Corrected memory leak with rendering.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5922
diff changeset
   155
#endif
5921
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   156
    
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   157
    /* * * * * Framebuffering* * * * */
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   158
    virtual void DirectConnected(direct_buffer_info *info) {
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   159
    	if(!_connected && _connection_disabled) {
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   160
    		return;
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   161
    	}
5930
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
   162
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
   163
		/* Determine if the pixel buffer is usable after this update */
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
   164
		_trash_window_buffer =		_trash_window_buffer
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
   165
								|| ((info->buffer_state & B_BUFFER_RESIZED)
5934
01531d8d1e01 Some video fixes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5933
diff changeset
   166
    							|| (info->buffer_state & B_BUFFER_RESET)
01531d8d1e01 Some video fixes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5933
diff changeset
   167
    							|| (info->driver_state == B_MODE_CHANGED));
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   168
    	LockBuffer();
5930
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
   169
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   170
    	switch(info->buffer_state & B_DIRECT_MODE_MASK) {
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   171
    	case B_DIRECT_START:
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   172
    		_connected = true;
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   173
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   174
    	case B_DIRECT_MODIFY:
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   175
    		if(_clips) {
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   176
    			free(_clips);
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   177
    			_clips = NULL;
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   178
    		}
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   179
    		
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   180
    		_num_clips = info->clip_list_count;
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   181
    		_clips = (clipping_rect *)malloc(_num_clips*sizeof(clipping_rect));
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   182
    		if(_clips) {
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   183
    			memcpy(_clips, info->clip_list,
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   184
    				_num_clips*sizeof(clipping_rect));
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   185
    			
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   186
    			_bits = (uint8*) info->bits;
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   187
    			_row_bytes = info->bytes_per_row;
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   188
    			_bounds = info->window_bounds;
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   189
    			_bytes_per_px = info->bits_per_pixel / 8;
5930
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
   190
    			_buffer_dirty = true;
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   191
    		}
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   192
    		break;
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   193
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   194
    	case B_DIRECT_STOP:
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   195
    		_connected = false;
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   196
    		break;
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   197
    	}
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   198
#if SDL_VIDEO_OPENGL
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   199
		if(_SDL_GLView) {
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   200
			_SDL_GLView->DirectConnected(info);
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   201
		}
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   202
#endif
5930
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
   203
    	
5934
01531d8d1e01 Some video fixes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5933
diff changeset
   204
    	
01531d8d1e01 Some video fixes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5933
diff changeset
   205
    	/* Call the base object directconnected */
01531d8d1e01 Some video fixes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5933
diff changeset
   206
    	BDirectWindow::DirectConnected(info);
01531d8d1e01 Some video fixes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5933
diff changeset
   207
    	
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   208
    	UnlockBuffer();
5934
01531d8d1e01 Some video fixes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5933
diff changeset
   209
    	
5921
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   210
    }
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   211
    
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   212
    
5923
460ce3fb104c Corrected memory leak with rendering.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5922
diff changeset
   213
    
460ce3fb104c Corrected memory leak with rendering.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5922
diff changeset
   214
    
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   215
    /* * * * * Event sending * * * * */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   216
    /* Hook functions */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   217
    virtual void FrameMoved(BPoint origin) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   218
    	/* Post a message to the BApp so that it can handle the window event */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   219
    	BMessage msg(BAPP_WINDOW_MOVED);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   220
		msg.AddInt32("window-x", (int)origin.x);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   221
		msg.AddInt32("window-y", (int)origin.y);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   222
    	_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   223
		
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   224
		/* Perform normal hook operations */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   225
    	BDirectWindow::FrameMoved(origin);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   226
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   227
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   228
    virtual void FrameResized(float width, float height) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   229
    	/* Post a message to the BApp so that it can handle the window event */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   230
    	BMessage msg(BAPP_WINDOW_RESIZED);
5939
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   231
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   232
		msg.AddInt32("window-w", (int)width + 1);
5931
edf9a8e68b34 Framebuffer code moved to SDL_bframebuffer.*, OpenGL support began
Nathan Heisey <nathanheisey@gmail.com>
parents: 5930
diff changeset
   233
		msg.AddInt32("window-h", (int)height + 1);
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   234
    	_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   235
		
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   236
		/* Perform normal hook operations */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   237
    	BDirectWindow::FrameResized(width, height);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   238
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   239
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   240
	virtual bool QuitRequested() {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   241
    	BMessage msg(BAPP_WINDOW_CLOSE_REQUESTED);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   242
    	_PostWindowEvent(msg);
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   243
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   244
    	/* We won't allow a quit unless asked by DestroyWindow() */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   245
    	return false;	
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   246
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   247
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   248
    virtual void WindowActivated(bool active) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   249
    	BMessage msg(BAPP_KEYBOARD_FOCUS);	/* Mouse focus sold separately */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   250
    	_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   251
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   252
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   253
    virtual void Zoom(BPoint origin,
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   254
				float width,
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   255
				float height) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   256
		BMessage msg(BAPP_MAXIMIZE);	/* Closest thing to maximization Haiku has */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   257
    	_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   258
    	
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   259
    	/* Before the window zooms, record its size */
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   260
    	if( !_prev_frame )
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   261
    		_prev_frame = new BRect(Frame());
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   262
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   263
    	/* Perform normal hook operations */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   264
    	BDirectWindow::Zoom(origin, width, height);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   265
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   266
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   267
    /* Member functions */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   268
    virtual void Show() {
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   269
    	while(IsHidden()) {
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   270
    		BDirectWindow::Show();
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   271
    	}
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   272
    	_shown = true;
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   273
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   274
    	BMessage msg(BAPP_SHOW);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   275
    	_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   276
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   277
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   278
    virtual void Hide() {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   279
    	BDirectWindow::Hide();
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   280
    	_shown = false;
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   281
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   282
    	BMessage msg(BAPP_HIDE);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   283
    	_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   284
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   285
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   286
    virtual void Minimize(bool minimize) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   287
    	BDirectWindow::Minimize(minimize);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   288
    	int32 minState = (minimize ? BAPP_MINIMIZE : BAPP_RESTORE);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   289
    	
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   290
    	BMessage msg(minState);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   291
    	_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   292
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   293
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   294
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   295
    /* BView message interruption */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   296
    virtual void DispatchMessage(BMessage * msg, BHandler * target)
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   297
    {
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   298
        BPoint where;	/* Used by mouse moved */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   299
        int32 buttons;	/* Used for mouse button events */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   300
        int32 key;		/* Used for key events */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   301
        
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   302
        switch (msg->what) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   303
        case B_MOUSE_MOVED:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   304
            int32 transit;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   305
            if (msg->FindPoint("where", &where) == B_OK
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   306
                && msg->FindInt32("be:transit", &transit) == B_OK) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   307
            	_MouseMotionEvent(where, transit);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   308
            }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   309
            
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   310
            /* FIXME: Apparently a button press/release event might be dropped
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   311
               if made before before a different button is released.  Does
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   312
               B_MOUSE_MOVED have the data needed to check if a mouse button
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   313
               state has changed? */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   314
            if (msg->FindInt32("buttons", &buttons) == B_OK) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   315
				_MouseButtonEvent(buttons);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   316
            }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   317
            break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   318
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   319
        case B_MOUSE_DOWN:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   320
        case B_MOUSE_UP:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   321
            /* _MouseButtonEvent() detects any and all buttons that may have
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   322
               changed state, as well as that button's new state */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   323
            if (msg->FindInt32("buttons", &buttons) == B_OK) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   324
				_MouseButtonEvent(buttons);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   325
            }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   326
            break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   327
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   328
        case B_MOUSE_WHEEL_CHANGED:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   329
        	float x, y;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   330
        	if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   331
        		&& msg->FindFloat("be:wheel_delta_y", &y) == B_OK) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   332
        			_MouseWheelEvent((int)x, (int)y);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   333
        	}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   334
        	break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   335
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   336
        case B_KEY_DOWN:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   337
        case B_UNMAPPED_KEY_DOWN:      /* modifier keys are unmapped */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   338
        	if (msg->FindInt32("key", &key) == B_OK) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   339
        		_KeyEvent((SDL_Scancode)key, SDL_PRESSED);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   340
        	}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   341
        	break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   342
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   343
        case B_KEY_UP:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   344
        case B_UNMAPPED_KEY_UP:        /* modifier keys are unmapped */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   345
        	if (msg->FindInt32("key", &key) == B_OK) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   346
            	_KeyEvent(key, SDL_RELEASED);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   347
            }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   348
            break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   349
        	
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   350
        default:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   351
            /* move it after switch{} so it's always handled
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   352
               that way we keep BeOS feautures like:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   353
               - CTRL+Q to close window (and other shortcuts)
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   354
               - PrintScreen to make screenshot into /boot/home
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   355
               - etc.. */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   356
            //BDirectWindow::DispatchMessage(msg, target);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   357
            break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   358
        }
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   359
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   360
        BDirectWindow::DispatchMessage(msg, target);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   361
    }
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   362
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   363
    /* Handle command messages */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   364
    virtual void MessageReceived(BMessage* message) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   365
    	switch (message->what) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   366
    		/* Handle commands from SDL */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   367
    		case BWIN_SET_TITLE:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   368
    			_SetTitle(message);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   369
    			break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   370
    		case BWIN_MOVE_WINDOW: 
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   371
    			_MoveTo(message);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   372
    			break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   373
    		case BWIN_RESIZE_WINDOW:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   374
    			_ResizeTo(message);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   375
    			break;
6422
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   376
    		case BWIN_SET_BORDERED:
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   377
    			_SetBordered(message);
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   378
    			break;
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   379
    		case BWIN_SHOW_WINDOW:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   380
    			Show();
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   381
    			break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   382
    		case BWIN_HIDE_WINDOW:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   383
    			Hide();
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   384
    			break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   385
    		case BWIN_MAXIMIZE_WINDOW:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   386
    			BWindow::Zoom();
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   387
    			break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   388
			case BWIN_MINIMIZE_WINDOW:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   389
				Minimize(true);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   390
    			break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   391
    		case BWIN_RESTORE_WINDOW:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   392
    			_Restore();
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   393
    			break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   394
    		case BWIN_FULLSCREEN:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   395
    			_SetFullScreen(message);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   396
    			break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   397
    		default:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   398
    			/* Perform normal message handling */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   399
    			BDirectWindow::MessageReceived(message);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   400
    			break;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   401
    	}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   402
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   403
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   404
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   405
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   406
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   407
	/* Accessor methods */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   408
	bool IsShown() { return _shown; }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   409
	int32 GetID() { return _id; }
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   410
	uint32 GetRowBytes() { return _row_bytes; }
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   411
	int32 GetFbX() { return _bounds.left; }
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   412
	int32 GetFbY() { return _bounds.top; }
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   413
	bool ConnectionEnabled() { return !_connection_disabled; }
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   414
	bool Connected() { return _connected; }
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   415
	clipping_rect *GetClips() { return _clips; }
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   416
	int32 GetNumClips() { return _num_clips; }
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   417
	uint8* GetBufferPx() { return _bits; }
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   418
	int32 GetBytesPerPx() { return _bytes_per_px; }
5930
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
   419
	bool CanTrashWindowBuffer() { return _trash_window_buffer; }
5929
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
   420
	bool BufferExists() { return _buffer_created; }
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
   421
	bool BufferIsDirty() { return _buffer_dirty; }
5933
5f8a7ebc88e5 Replaced window backbuffer with BBitmap
Nathan Heisey <nathanheisey@gmail.com>
parents: 5932
diff changeset
   422
	BBitmap *GetBitmap() { return _bitmap; }
5934
01531d8d1e01 Some video fixes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5933
diff changeset
   423
#if SDL_VIDEO_OPENGL
01531d8d1e01 Some video fixes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5933
diff changeset
   424
	BGLView *GetGLView() { return _SDL_GLView; }
01531d8d1e01 Some video fixes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5933
diff changeset
   425
#endif
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   426
	
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   427
	/* Setter methods */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   428
	void SetID(int32 id) { _id = id; }
5930
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
   429
	void SetBufferExists(bool bufferExists) { _buffer_created = bufferExists; }
5929
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
   430
	void LockBuffer() {	_buffer_locker->Lock(); }
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
   431
	void UnlockBuffer() { _buffer_locker->Unlock(); }
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
   432
	void SetBufferDirty(bool bufferDirty) { _buffer_dirty = bufferDirty; }
5930
a2372d470620 Render thread partially corrected
Nathan Heisey <nathanheisey@gmail.com>
parents: 5929
diff changeset
   433
	void SetTrashBuffer(bool trash) { _trash_window_buffer = trash; 	}
5933
5f8a7ebc88e5 Replaced window backbuffer with BBitmap
Nathan Heisey <nathanheisey@gmail.com>
parents: 5932
diff changeset
   434
	void SetBitmap(BBitmap *bitmap) { _bitmap = bitmap; }
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   435
	
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   436
	
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   437
private:
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   438
	/* Event redirection */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   439
    void _MouseMotionEvent(BPoint &where, int32 transit) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   440
    	if(transit == B_EXITED_VIEW) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   441
    		/* Change mouse focus */
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   442
    		if(_mouse_focused) {
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   443
    			_MouseFocusEvent(false);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   444
    		}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   445
    	} else {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   446
    		/* Change mouse focus */
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   447
    		if (!_mouse_focused) {
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   448
    			_MouseFocusEvent(true);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   449
    		}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   450
    		BMessage msg(BAPP_MOUSE_MOVED);
5927
463b84c19645 Fixed mouse move problem
Nathan Heisey <nathanheisey@gmail.com>
parents: 5925
diff changeset
   451
    		msg.AddInt32("x", (int)where.x);
463b84c19645 Fixed mouse move problem
Nathan Heisey <nathanheisey@gmail.com>
parents: 5925
diff changeset
   452
    		msg.AddInt32("y", (int)where.y);
463b84c19645 Fixed mouse move problem
Nathan Heisey <nathanheisey@gmail.com>
parents: 5925
diff changeset
   453
 		
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   454
    		_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   455
    	}
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   456
    }
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   457
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   458
    void _MouseFocusEvent(bool focusGained) {
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   459
    	_mouse_focused = focusGained;
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   460
    	BMessage msg(BAPP_MOUSE_FOCUS);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   461
    	msg.AddBool("focusGained", focusGained);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   462
    	_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   463
    	
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   464
//FIXME: Why were these here?
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   465
// if false: be_app->SetCursor(B_HAND_CURSOR);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   466
// if true:  SDL_SetCursor(NULL);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   467
    }
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   468
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   469
    void _MouseButtonEvent(int32 buttons) {
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   470
    	int32 buttonStateChange = buttons ^ _last_buttons;
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   471
    	
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   472
    	/* Make sure at least one button has changed state */ 
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   473
    	if( !(buttonStateChange) ) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   474
    		return;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   475
    	}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   476
    	
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   477
    	/* Add any mouse button events */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   478
    	if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
5921
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   479
    		_SendMouseButton(SDL_BUTTON_LEFT, buttons &
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   480
    			B_PRIMARY_MOUSE_BUTTON);
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   481
    	}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   482
    	if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
5921
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   483
    		_SendMouseButton(SDL_BUTTON_RIGHT, buttons &
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   484
    			B_PRIMARY_MOUSE_BUTTON);
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   485
    	}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   486
    	if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
5921
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   487
    		_SendMouseButton(SDL_BUTTON_MIDDLE, buttons &
4cec9ba57dfb Framebuffer support in progress.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5916
diff changeset
   488
    			B_PRIMARY_MOUSE_BUTTON);
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   489
    	}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   490
    	
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   491
    	_last_buttons = buttons;
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   492
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   493
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   494
    void _SendMouseButton(int32 button, int32 state) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   495
    	BMessage msg(BAPP_MOUSE_BUTTON);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   496
    	msg.AddInt32("button-id", button);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   497
    	msg.AddInt32("button-state", state);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   498
    	_PostWindowEvent(msg);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   499
    }
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   500
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   501
    void _MouseWheelEvent(int32 x, int32 y) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   502
    	/* Create a message to pass along to the BeApp thread */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   503
    	BMessage msg(BAPP_MOUSE_WHEEL);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   504
    	msg.AddInt32("xticks", x);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   505
    	msg.AddInt32("yticks", y);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   506
    	_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   507
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   508
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   509
    void _KeyEvent(int32 keyCode, int32 keyState) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   510
    	/* Create a message to pass along to the BeApp thread */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   511
    	BMessage msg(BAPP_KEY);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   512
    	msg.AddInt32("key-state", keyState);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   513
    	msg.AddInt32("key-scancode", keyCode);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   514
    	be_app->PostMessage(&msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   515
    	/* Apparently SDL only uses the scancode */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   516
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   517
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   518
    void _RepaintEvent() {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   519
    	/* Force a repaint: Call the SDL exposed event */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   520
    	BMessage msg(BAPP_REPAINT);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   521
    	_PostWindowEvent(msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   522
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   523
    void _PostWindowEvent(BMessage &msg) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   524
    	msg.AddInt32("window-id", _id);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   525
    	be_app->PostMessage(&msg);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   526
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   527
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   528
	/* Command methods (functions called upon by SDL) */
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   529
    void _SetTitle(BMessage *msg) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   530
    	const char *title;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   531
    	if(
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   532
			msg->FindString("window-title", &title) != B_OK
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   533
		) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   534
			return;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   535
		}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   536
		SetTitle(title);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   537
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   538
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   539
    void _MoveTo(BMessage *msg) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   540
    	int32 x, y;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   541
    	if(
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   542
			msg->FindInt32("window-x", &x) != B_OK ||
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   543
			msg->FindInt32("window-y", &y) != B_OK
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   544
		) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   545
			return;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   546
		}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   547
		MoveTo(x, y);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   548
    }
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   549
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   550
    void _ResizeTo(BMessage *msg) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   551
    	int32 w, h;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   552
    	if(
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   553
			msg->FindInt32("window-w", &w) != B_OK ||
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   554
			msg->FindInt32("window-h", &h) != B_OK
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   555
		) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   556
			return;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   557
		}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   558
    	ResizeTo(w, h);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   559
    }
6422
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   560
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   561
    void _SetBordered(BMessage *msg) {
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   562
    	bool bEnabled;
6424
bfaafcf78560 Patched to compile on Haiku.
Ryan C. Gordon <icculus@icculus.org>
parents: 6422
diff changeset
   563
    	if(msg->FindBool("window-border", &bEnabled) != B_OK) {
6422
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   564
			return;
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   565
		}
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   566
    	SetLook(bEnabled ? B_BORDERED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK);
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   567
    }
fd0ac1b56115 Added SDL_SetWindowBordered() API.
Ryan C. Gordon <icculus@icculus.org>
parents: 6421
diff changeset
   568
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   569
    void _Restore() {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   570
    	if(IsMinimized()) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   571
    		Minimize(false);
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   572
    	} else if(IsHidden()) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   573
    		Show();
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   574
    	} else if(_prev_frame != NULL) {	/* Zoomed */
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   575
    		MoveTo(_prev_frame->left, _prev_frame->top);
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   576
    		ResizeTo(_prev_frame->Width(), _prev_frame->Height());
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   577
    	}
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   578
    }
907
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
   579
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   580
    void _SetFullScreen(BMessage *msg) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   581
    	bool fullscreen;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   582
    	if(
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   583
			msg->FindBool("fullscreen", &fullscreen) != B_OK
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   584
		) {
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   585
			return;
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   586
    	}
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   587
    	SetFullScreen(fullscreen);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1614
diff changeset
   588
    }
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   589
    
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   590
    /* Members */
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
   591
#if SDL_VIDEO_OPENGL
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   592
    BGLView * _SDL_GLView;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   593
#endif
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   594
    
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   595
    int32 _last_buttons;
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   596
    int32 _id;	/* Window id used by SDL_BApp */
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   597
    bool  _mouse_focused;		/* Does this window have mouse focus? */
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   598
    bool  _shown;
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   599
    bool  _inhibit_resize;
5915
af3e8e1f14e3 Replaced private event functionality with event sending.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5535
diff changeset
   600
    
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   601
    BRect *_prev_frame;	/* Previous position and size of the window */
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   602
    
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   603
    /* Framebuffer members */
5929
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
   604
    bool			_connected,
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
   605
    				_connection_disabled,
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
   606
    				_buffer_created,
5939
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   607
    				_buffer_dirty,
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   608
    				_trash_window_buffer;
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   609
    uint8		   *_bits;
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   610
    uint32			_row_bytes;
5922
efd1498efdff Drawing code works, but it flashes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5921
diff changeset
   611
    clipping_rect	_bounds;
5925
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   612
    BLocker 	   *_buffer_locker;
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   613
    clipping_rect  *_clips;
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   614
    int32			_num_clips;
262ce29aabf6 Variable name/debugging output changes
Nathan Heisey <nathanheisey@gmail.com>
parents: 5923
diff changeset
   615
    int32			_bytes_per_px;
5929
03298541cc4f Moved draw code to a separate thread
Nathan Heisey <nathanheisey@gmail.com>
parents: 5927
diff changeset
   616
    thread_id		_draw_thread_id;
5933
5f8a7ebc88e5 Replaced window backbuffer with BBitmap
Nathan Heisey <nathanheisey@gmail.com>
parents: 5932
diff changeset
   617
    
5f8a7ebc88e5 Replaced window backbuffer with BBitmap
Nathan Heisey <nathanheisey@gmail.com>
parents: 5932
diff changeset
   618
    BBitmap		   *_bitmap;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   619
};
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   620
5939
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   621
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   622
/* FIXME:
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   623
 * An explanation of framebuffer flags.
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   624
 *
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   625
 * _connected -           Original variable used to let the drawing thread know
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   626
 *                         when changes are being made to the other framebuffer
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   627
 *                         members.
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   628
 * _connection_disabled - Used to signal to the drawing thread that the window
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   629
 *                         is closing, and the thread should exit.
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   630
 * _buffer_created -      True if the current buffer is valid
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   631
 * _buffer_dirty -        True if the window should be redrawn.
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   632
 * _trash_window_buffer - True if the window buffer needs to be trashed partway
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   633
 *                         through a draw cycle.  Occurs when the previous
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   634
 *                         buffer provided by DirectConnected() is invalidated.
d9e9c343d264 Partially cleaned out code
Nathan Heisey <nathanheisey@gmail.com>
parents: 5938
diff changeset
   635
 */
5916
fdbd7677d563 Rewrote most of Haiku video support to conform with 1.3 functionality.
Nathan Heisey <nathanheisey@gmail.com>
parents: 5915
diff changeset
   636
#endif