changes submitted by Christopher ML Zumwalt May
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2357 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+167
-173
@@ -1,173 +1,167 @@
|
||||
/*******************************************************************************
|
||||
//
|
||||
// File: DirectWindow.h
|
||||
//
|
||||
// Description: Client window class for direct screen access.
|
||||
//
|
||||
// Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
//
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _DIRECT_WINDOW_H
|
||||
#define _DIRECT_WINDOW_H
|
||||
|
||||
#include <Region.h>
|
||||
#include <Window.h>
|
||||
|
||||
class BDirectDriver;
|
||||
|
||||
/* State of the direct access when called back through DirectConnected */
|
||||
enum direct_buffer_state {
|
||||
B_DIRECT_MODE_MASK = 15,
|
||||
|
||||
B_DIRECT_START = 0,
|
||||
B_DIRECT_STOP = 1,
|
||||
B_DIRECT_MODIFY = 2,
|
||||
|
||||
B_CLIPPING_MODIFIED = 16,
|
||||
B_BUFFER_RESIZED = 32,
|
||||
B_BUFFER_MOVED = 64,
|
||||
B_BUFFER_RESET = 128
|
||||
};
|
||||
|
||||
/* State of the direct driver and its hooks functions */
|
||||
enum direct_driver_state {
|
||||
B_DRIVER_CHANGED = 0x0001,
|
||||
B_MODE_CHANGED = 0x0002
|
||||
};
|
||||
|
||||
/* Integer rect used to define a cliping rectangle. All bounds are included */
|
||||
/* Moved to Region.h */
|
||||
|
||||
/* Frame buffer access descriptor */
|
||||
typedef struct {
|
||||
direct_buffer_state buffer_state;
|
||||
direct_driver_state driver_state;
|
||||
void *bits;
|
||||
void *pci_bits;
|
||||
int32 bytes_per_row;
|
||||
uint32 bits_per_pixel;
|
||||
color_space pixel_format;
|
||||
buffer_layout layout;
|
||||
buffer_orientation orientation;
|
||||
uint32 _reserved[9];
|
||||
uint32 _dd_type_;
|
||||
uint32 _dd_token_;
|
||||
uint32 clip_list_count;
|
||||
clipping_rect window_bounds;
|
||||
clipping_rect clip_bounds;
|
||||
clipping_rect clip_list[1];
|
||||
} direct_buffer_info;
|
||||
|
||||
/* BDirectWindow class */
|
||||
class BDirectWindow : public BWindow {
|
||||
public:
|
||||
BDirectWindow( BRect frame,
|
||||
const char *title,
|
||||
window_type type,
|
||||
uint32 flags,
|
||||
uint32 workspace = B_CURRENT_WORKSPACE);
|
||||
BDirectWindow( BRect frame,
|
||||
const char *title,
|
||||
window_look look,
|
||||
window_feel feel,
|
||||
uint32 flags,
|
||||
uint32 workspace = B_CURRENT_WORKSPACE);
|
||||
virtual ~BDirectWindow();
|
||||
static BArchivable *Instantiate(BMessage *data);
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
|
||||
/* defined for future extension (fragile base class). Identical to BWindow */
|
||||
virtual void Quit(void);
|
||||
virtual void DispatchMessage(BMessage *message, BHandler *handler);
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void FrameMoved(BPoint new_position);
|
||||
virtual void WorkspacesChanged(uint32 old_ws, uint32 new_ws);
|
||||
virtual void WorkspaceActivated(int32 ws, bool state);
|
||||
virtual void FrameResized(float new_width, float new_height);
|
||||
virtual void Minimize(bool minimize);
|
||||
virtual void Zoom( BPoint rec_position,
|
||||
float rec_width,
|
||||
float rec_height);
|
||||
virtual void ScreenChanged(BRect screen_size, color_space depth);
|
||||
virtual void MenusBeginning();
|
||||
virtual void MenusEnded();
|
||||
virtual void WindowActivated(bool state);
|
||||
virtual void Show();
|
||||
virtual void Hide();
|
||||
virtual BHandler *ResolveSpecifier(BMessage *msg,
|
||||
int32 index,
|
||||
BMessage *specifier,
|
||||
int32 form,
|
||||
const char *property);
|
||||
virtual status_t GetSupportedSuites(BMessage *data);
|
||||
virtual status_t Perform(perform_code d, void *arg);
|
||||
|
||||
private:
|
||||
virtual void task_looper();
|
||||
virtual BMessage *ConvertToMessage(void *raw, int32 code);
|
||||
|
||||
/* new APIs */
|
||||
|
||||
public:
|
||||
virtual void DirectConnected(direct_buffer_info *info);
|
||||
status_t GetClippingRegion(BRegion *region, BPoint *origin = NULL) const;
|
||||
status_t SetFullScreen(bool enable);
|
||||
bool IsFullScreen() const;
|
||||
|
||||
static bool SupportsWindowMode(screen_id = B_MAIN_SCREEN_ID);
|
||||
|
||||
/* private */
|
||||
private:
|
||||
|
||||
typedef BWindow inherited;
|
||||
|
||||
virtual void _ReservedDirectWindow1();
|
||||
virtual void _ReservedDirectWindow2();
|
||||
virtual void _ReservedDirectWindow3();
|
||||
virtual void _ReservedDirectWindow4();
|
||||
|
||||
|
||||
BDirectWindow();
|
||||
BDirectWindow(BDirectWindow &);
|
||||
BDirectWindow &operator=(BDirectWindow &);
|
||||
|
||||
bool deamon_killer;
|
||||
bool connection_enable;
|
||||
bool full_screen_enable;
|
||||
bool direct_driver_ready;
|
||||
bool in_direct_connect;
|
||||
int32 direct_lock;
|
||||
sem_id direct_sem;
|
||||
uint32 direct_lock_count;
|
||||
thread_id direct_lock_owner;
|
||||
char *direct_lock_stack;
|
||||
sem_id disable_sem;
|
||||
sem_id disable_sem_ack;
|
||||
uint32 dw_init_status;
|
||||
uint32 info_area_size;
|
||||
uint32 direct_driver_type;
|
||||
uint32 direct_driver_token;
|
||||
area_id cloned_clipping_area;
|
||||
area_id source_clipping_area;
|
||||
thread_id direct_deamon_id;
|
||||
direct_buffer_info *buffer_desc;
|
||||
BDirectDriver *direct_driver;
|
||||
struct priv_ext *extension;
|
||||
uint32 _reserved_[15];
|
||||
|
||||
static int32 DirectDeamonFunc(void *arg);
|
||||
bool LockDirect() const;
|
||||
void UnlockDirect() const;
|
||||
void InitData();
|
||||
void DisposeData();
|
||||
status_t DriverSetup() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: DirectWindow.h
|
||||
// Author: Christopher ML Zumwalt May ([email protected])
|
||||
// Description: BFileGameSound allow the developer to directly draw to the
|
||||
// app_server's frame buffer.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _DIRECTWINDOW_H
|
||||
#define _DIRECTWINDOW_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <Region.h>
|
||||
#include <Window.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
enum direct_buffer_state {
|
||||
B_DIRECT_MODE_MASK = 15,
|
||||
|
||||
B_DIRECT_START = 0,
|
||||
B_DIRECT_STOP = 1,
|
||||
B_DIRECT_MODIFY = 2,
|
||||
|
||||
B_CLIPPING_MODIFIED = 16,
|
||||
B_BUFFER_RESIZED = 32,
|
||||
B_BUFFER_MOVED = 64,
|
||||
B_BUFFER_RESET = 128
|
||||
};
|
||||
|
||||
enum direct_driver_state {
|
||||
B_DRIVER_CHANGED = 0x0001,
|
||||
B_MODE_CHANGED = 0x0002
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
direct_buffer_state buffer_state;
|
||||
direct_driver_state driver_state;
|
||||
void *bits;
|
||||
void *pci_bits;
|
||||
int32 bytes_per_row;
|
||||
uint32 bits_per_pixel;
|
||||
color_space pixel_format;
|
||||
buffer_layout layout;
|
||||
buffer_orientation orientation;
|
||||
uint32 _reserved[9];
|
||||
uint32 _dd_type_;
|
||||
uint32 _dd_token_;
|
||||
uint32 clip_list_count;
|
||||
clipping_rect window_bounds;
|
||||
clipping_rect clip_bounds;
|
||||
clipping_rect clip_list[1];
|
||||
} direct_buffer_info;
|
||||
|
||||
// PushGameSound ---------------------------------------------------------------
|
||||
class BDirectWindow : public BWindow
|
||||
{
|
||||
public:
|
||||
BDirectWindow(BRect frame,
|
||||
const char *title,
|
||||
window_type type,
|
||||
uint32 flags,
|
||||
uint32 workspace = B_CURRENT_WORKSPACE);
|
||||
BDirectWindow(BRect frame,
|
||||
const char *title,
|
||||
window_look look,
|
||||
window_feel feel,
|
||||
uint32 flags,
|
||||
uint32 workspace = B_CURRENT_WORKSPACE);
|
||||
virtual ~BDirectWindow();
|
||||
|
||||
static BArchivable *Instantiate(BMessage *data);
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
virtual void Quit(void);
|
||||
virtual void DispatchMessage(BMessage *message, BHandler *handler);
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void FrameMoved(BPoint new_position);
|
||||
virtual void WorkspacesChanged(uint32 old_ws, uint32 new_ws);
|
||||
virtual void WorkspaceActivated(int32 ws, bool state);
|
||||
virtual void FrameResized(float new_width, float new_height);
|
||||
virtual void Minimize(bool minimize);
|
||||
virtual void Zoom(BPoint rec_position,
|
||||
float rec_width,
|
||||
float rec_height);
|
||||
virtual void ScreenChanged(BRect screen_size, color_space depth);
|
||||
virtual void MenusBeginning();
|
||||
virtual void MenusEnded();
|
||||
virtual void WindowActivated(bool state);
|
||||
virtual void Show();
|
||||
virtual void Hide();
|
||||
virtual BHandler *ResolveSpecifier(BMessage *msg,
|
||||
int32 index,
|
||||
BMessage *specifier,
|
||||
int32 form,
|
||||
const char *property);
|
||||
virtual status_t GetSupportedSuites(BMessage *data);
|
||||
virtual status_t Perform(perform_code d, void *arg);
|
||||
|
||||
private:
|
||||
virtual void _ReservedDirectWindow1();
|
||||
virtual void _ReservedDirectWindow2();
|
||||
|
||||
public:
|
||||
// BDirectWindow API
|
||||
virtual void DirectConnected(direct_buffer_info *info);
|
||||
status_t GetClippingRegion(BRegion *region, BPoint *origin = NULL) const;
|
||||
status_t SetFullScreen(bool enable);
|
||||
bool IsFullScreen() const;
|
||||
|
||||
static bool SupportsWindowMode(screen_id = B_MAIN_SCREEN_ID);
|
||||
|
||||
private:
|
||||
|
||||
typedef BWindow inherited;
|
||||
|
||||
virtual void _ReservedDirectWindow3();
|
||||
virtual void _ReservedDirectWindow4();
|
||||
virtual void _ReservedDirectWindow5();
|
||||
virtual void _ReservedDirectWindow6();
|
||||
|
||||
BDirectWindow();
|
||||
BDirectWindow(BDirectWindow &);
|
||||
BDirectWindow &operator=(BDirectWindow &);
|
||||
|
||||
void InitData(BRect frame);
|
||||
|
||||
void DoDirectConnected();
|
||||
void Connect();
|
||||
void Disconnect();
|
||||
|
||||
void CreateClippingList();
|
||||
void GetFrameBuffer();
|
||||
|
||||
bool fIsFullScreen;
|
||||
bool fIsConnected;
|
||||
direct_buffer_info *fBufferInfo;
|
||||
uint32 _reserved_[31];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+407
-290
@@ -1,290 +1,407 @@
|
||||
/*
|
||||
* Copyright 2002, Marcus Overhagen. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <DirectWindow.h>
|
||||
|
||||
BDirectWindow::BDirectWindow(BRect frame,
|
||||
const char *title,
|
||||
window_type type,
|
||||
uint32 flags,
|
||||
uint32 workspace)
|
||||
: BWindow(frame, title, type, flags, workspace)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BDirectWindow::BDirectWindow(BRect frame,
|
||||
const char *title,
|
||||
window_look look,
|
||||
window_feel feel,
|
||||
uint32 flags,
|
||||
uint32 workspace)
|
||||
: BWindow(frame, title, look, feel, flags, workspace)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BDirectWindow::~BDirectWindow()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BArchivable *
|
||||
BDirectWindow::Instantiate(BMessage *data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::Archive(BMessage *data,
|
||||
bool deep) const
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::Quit(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::DispatchMessage(BMessage *message,
|
||||
BHandler *handler)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::MessageReceived(BMessage *message)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::FrameMoved(BPoint new_position)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::WorkspacesChanged(uint32 old_ws,
|
||||
uint32 new_ws)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::WorkspaceActivated(int32 ws,
|
||||
bool state)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::FrameResized(float new_width,
|
||||
float new_height)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::Minimize(bool minimize)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::Zoom(BPoint rec_position,
|
||||
float rec_width,
|
||||
float rec_height)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::ScreenChanged(BRect screen_size,
|
||||
color_space depth)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::MenusBeginning()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::MenusEnded()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::WindowActivated(bool state)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::Show()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::Hide()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BHandler *
|
||||
BDirectWindow::ResolveSpecifier(BMessage *msg,
|
||||
int32 index,
|
||||
BMessage *specifier,
|
||||
int32 form,
|
||||
const char *property)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::GetSupportedSuites(BMessage *data)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::Perform(perform_code d,
|
||||
void *arg)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::task_looper()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BMessage *
|
||||
BDirectWindow::ConvertToMessage(void *raw,
|
||||
int32 code)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::DirectConnected(direct_buffer_info *info)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::GetClippingRegion(BRegion *region,
|
||||
BPoint *origin) const
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::SetFullScreen(bool enable)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BDirectWindow::IsFullScreen() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BDirectWindow::SupportsWindowMode(screen_id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::_ReservedDirectWindow1()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::_ReservedDirectWindow2()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::_ReservedDirectWindow3()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::_ReservedDirectWindow4()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* unimplemented for protection of the user:
|
||||
*
|
||||
* BDirectWindow::BDirectWindow()
|
||||
* BDirectWindow::BDirectWindow(BDirectWindow &)
|
||||
* BDirectWindow &BDirectWindow::operator=(BDirectWindow &)
|
||||
*/
|
||||
|
||||
int32
|
||||
BDirectWindow::DirectDeamonFunc(void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BDirectWindow::LockDirect() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::UnlockDirect() const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::InitData()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::DisposeData()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::DriverSetup() const
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: DirectWindow.cpp
|
||||
// Author: Christopher ML Zumwalt May ([email protected])
|
||||
// Description: BFileGameSound allow the developer to directly draw to the
|
||||
// app_server's frame buffer.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <memory.h>
|
||||
|
||||
#include "DirectWindow.h"
|
||||
|
||||
BDirectWindow::BDirectWindow(BRect frame,
|
||||
const char *title,
|
||||
window_type type,
|
||||
uint32 flags,
|
||||
uint32 workspace)
|
||||
: BWindow(frame, title, type, flags, workspace),
|
||||
fIsFullScreen(false),
|
||||
fIsConnected(false)
|
||||
{
|
||||
InitData(frame);
|
||||
}
|
||||
|
||||
|
||||
BDirectWindow::BDirectWindow(BRect frame,
|
||||
const char *title,
|
||||
window_look look,
|
||||
window_feel feel,
|
||||
uint32 flags,
|
||||
uint32 workspace)
|
||||
: BWindow(frame, title, look, feel, flags, workspace),
|
||||
fIsFullScreen(false),
|
||||
fIsConnected(false)
|
||||
{
|
||||
InitData(frame);
|
||||
}
|
||||
|
||||
|
||||
BDirectWindow::~BDirectWindow()
|
||||
{
|
||||
if (fIsConnected)
|
||||
{
|
||||
fBufferInfo->buffer_state = B_DIRECT_STOP;
|
||||
DoDirectConnected();
|
||||
}
|
||||
|
||||
delete fBufferInfo;
|
||||
}
|
||||
|
||||
BArchivable *
|
||||
BDirectWindow::Instantiate(BMessage *data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::Archive(BMessage *data,
|
||||
bool deep) const
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::Quit(void)
|
||||
{
|
||||
if (fIsConnected) Disconnect();
|
||||
|
||||
BWindow::Quit();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::DispatchMessage(BMessage *message,
|
||||
BHandler *handler)
|
||||
{
|
||||
BWindow::DispatchMessage(message, handler);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::MessageReceived(BMessage *message)
|
||||
{
|
||||
BWindow::MessageReceived(message);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::FrameMoved(BPoint new_position)
|
||||
{
|
||||
clipping_rect * bounds = &fBufferInfo->window_bounds;
|
||||
|
||||
int32 dx = int32(new_position.x - bounds->left);
|
||||
int32 dy = int32(new_position.y - bounds->top);
|
||||
|
||||
bounds->top += dy;
|
||||
bounds->left += dx;
|
||||
bounds->right += dx;
|
||||
bounds->bottom += dy;
|
||||
|
||||
fBufferInfo->buffer_state = direct_buffer_state(B_DIRECT_MODIFY | B_BUFFER_MOVED);
|
||||
DoDirectConnected();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::WorkspacesChanged(uint32 old_ws,
|
||||
uint32 new_ws)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::WorkspaceActivated(int32 ws,
|
||||
bool state)
|
||||
{
|
||||
if (state)
|
||||
Connect();
|
||||
else
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::FrameResized(float new_width,
|
||||
float new_height)
|
||||
{
|
||||
clipping_rect * bounds = &fBufferInfo->window_bounds;
|
||||
|
||||
bounds->right = int32(bounds->left + new_width);
|
||||
bounds->bottom = int32(bounds->top + new_height);
|
||||
|
||||
fBufferInfo->buffer_state = direct_buffer_state(B_DIRECT_MODIFY | B_BUFFER_RESIZED);
|
||||
DoDirectConnected();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::Minimize(bool minimize)
|
||||
{
|
||||
if (minimize)
|
||||
{
|
||||
Disconnect();
|
||||
BWindow::Minimize(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
BWindow::Minimize(true);
|
||||
Connect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::Zoom(BPoint rec_position,
|
||||
float rec_width,
|
||||
float rec_height)
|
||||
{
|
||||
BWindow::Zoom(rec_position, rec_width, rec_height);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::ScreenChanged(BRect screen_size,
|
||||
color_space depth)
|
||||
{
|
||||
direct_buffer_state state = B_DIRECT_MODIFY;
|
||||
|
||||
if (fIsConnected && fIsFullScreen)
|
||||
{
|
||||
ResizeTo(screen_size.right, screen_size.bottom);
|
||||
state = direct_buffer_state(state | B_BUFFER_RESIZED);
|
||||
}
|
||||
|
||||
GetFrameBuffer();
|
||||
|
||||
fBufferInfo->buffer_state = direct_buffer_state(state | B_BUFFER_RESET);
|
||||
DoDirectConnected();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::MenusBeginning()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::MenusEnded()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::WindowActivated(bool state)
|
||||
{
|
||||
CreateClippingList();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::Show()
|
||||
{
|
||||
BWindow::Show();
|
||||
|
||||
Connect();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::Hide()
|
||||
{
|
||||
Disconnect();
|
||||
|
||||
BWindow::Hide();
|
||||
}
|
||||
|
||||
|
||||
BHandler *
|
||||
BDirectWindow::ResolveSpecifier(BMessage *msg,
|
||||
int32 index,
|
||||
BMessage *specifier,
|
||||
int32 form,
|
||||
const char *property)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::GetSupportedSuites(BMessage *data)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::Perform(perform_code d,
|
||||
void *arg)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//BMessage *
|
||||
//BDirectWindow::ConvertToMessage(void *raw,
|
||||
// int32 code)
|
||||
//{
|
||||
// return NULL;
|
||||
//}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::DirectConnected(direct_buffer_info *info)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::GetClippingRegion(BRegion *region,
|
||||
BPoint *origin) const
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDirectWindow::SetFullScreen(bool enable)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BDirectWindow::IsFullScreen() const
|
||||
{
|
||||
return fIsFullScreen;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BDirectWindow::SupportsWindowMode(screen_id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::_ReservedDirectWindow1()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::_ReservedDirectWindow2()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::_ReservedDirectWindow3()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::_ReservedDirectWindow4()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::_ReservedDirectWindow5()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::_ReservedDirectWindow6()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* unimplemented for protection of the user:
|
||||
*
|
||||
* BDirectWindow::BDirectWindow()
|
||||
* BDirectWindow::BDirectWindow(BDirectWindow &)
|
||||
* BDirectWindow &BDirectWindow::operator=(BDirectWindow &)
|
||||
*/
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::InitData(BRect frame)
|
||||
{
|
||||
fBufferInfo = new direct_buffer_info;
|
||||
memset(fBufferInfo, 0, sizeof(direct_buffer_info));
|
||||
|
||||
fBufferInfo->window_bounds.top = int32(frame.top);
|
||||
fBufferInfo->window_bounds.left = int32(frame.left);
|
||||
fBufferInfo->window_bounds.right = int32(frame.right);
|
||||
fBufferInfo->window_bounds.bottom = int32(frame.bottom);
|
||||
|
||||
GetFrameBuffer();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDirectWindow::DoDirectConnected()
|
||||
{
|
||||
if (fIsConnected)
|
||||
{
|
||||
direct_buffer_info * info = new direct_buffer_info;
|
||||
memcpy(info, fBufferInfo, sizeof(direct_buffer_info));
|
||||
|
||||
DirectConnected(info);
|
||||
|
||||
delete info;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BDirectWindow::Connect()
|
||||
{
|
||||
fIsConnected = true;
|
||||
fBufferInfo->buffer_state = B_DIRECT_START;
|
||||
DoDirectConnected();
|
||||
}
|
||||
|
||||
void
|
||||
BDirectWindow::Disconnect()
|
||||
{
|
||||
fBufferInfo->buffer_state = B_DIRECT_STOP;
|
||||
DoDirectConnected();
|
||||
fIsConnected = false;
|
||||
}
|
||||
|
||||
void
|
||||
BDirectWindow::CreateClippingList()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BDirectWindow::GetFrameBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user