2007-10-22 14:29:44 +04:00
|
|
|
/*
|
2008-02-04 18:01:34 +03:00
|
|
|
* Copyright 2001-2008, Haiku.
|
2007-10-22 14:29:44 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
2008-02-04 18:01:34 +03:00
|
|
|
* Stefano Ceccherini <stefano.ceccherini@gmail.com>
|
2007-10-22 14:29:44 +04:00
|
|
|
*/
|
2003-09-18 17:39:39 +04:00
|
|
|
#ifndef _DIRECT_WINDOW_H
|
|
|
|
#define _DIRECT_WINDOW_H
|
|
|
|
|
|
|
|
#include <Region.h>
|
|
|
|
#include <Window.h>
|
|
|
|
|
2007-10-22 14:29:44 +04:00
|
|
|
|
2003-09-18 17:39:39 +04:00
|
|
|
enum direct_buffer_state {
|
|
|
|
B_DIRECT_MODE_MASK = 15,
|
|
|
|
|
|
|
|
B_DIRECT_START = 0,
|
|
|
|
B_DIRECT_STOP = 1,
|
|
|
|
B_DIRECT_MODIFY = 2,
|
|
|
|
|
2008-01-25 13:43:58 +03:00
|
|
|
B_CLIPPING_MODIFIED = 16,
|
2003-09-18 17:39:39 +04:00
|
|
|
B_BUFFER_RESIZED = 32,
|
|
|
|
B_BUFFER_MOVED = 64,
|
|
|
|
B_BUFFER_RESET = 128
|
|
|
|
};
|
|
|
|
|
2007-10-22 14:29:44 +04:00
|
|
|
|
2003-09-18 17:39:39 +04:00
|
|
|
enum direct_driver_state {
|
2008-01-25 13:43:58 +03:00
|
|
|
B_DRIVER_CHANGED = 0x0001,
|
|
|
|
B_MODE_CHANGED = 0x0002
|
2003-09-18 17:39:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
direct_buffer_state buffer_state;
|
|
|
|
direct_driver_state driver_state;
|
2008-01-25 13:43:58 +03:00
|
|
|
void *bits;
|
|
|
|
void *pci_bits;
|
|
|
|
int32 bytes_per_row;
|
|
|
|
uint32 bits_per_pixel;
|
|
|
|
color_space pixel_format;
|
2003-09-18 17:39:39 +04:00
|
|
|
buffer_layout layout;
|
|
|
|
buffer_orientation orientation;
|
2008-01-25 13:43:58 +03:00
|
|
|
uint32 _reserved[9];
|
|
|
|
uint32 _dd_type_;
|
|
|
|
uint32 _dd_token_;
|
|
|
|
uint32 clip_list_count;
|
2003-09-18 17:39:39 +04:00
|
|
|
clipping_rect window_bounds;
|
|
|
|
clipping_rect clip_bounds;
|
|
|
|
clipping_rect clip_list[1];
|
|
|
|
} direct_buffer_info;
|
|
|
|
|
2007-10-22 14:29:44 +04:00
|
|
|
|
2003-09-18 17:39:39 +04:00
|
|
|
class BDirectWindow : public BWindow {
|
2007-10-22 14:29:44 +04:00
|
|
|
public:
|
|
|
|
BDirectWindow(BRect frame, const char *title, window_type type,
|
2008-02-04 18:01:34 +03:00
|
|
|
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);
|
2007-10-22 14:29:44 +04:00
|
|
|
virtual ~BDirectWindow();
|
2008-02-04 18:01:34 +03:00
|
|
|
|
|
|
|
static BArchivable* Instantiate(BMessage *data);
|
2007-10-22 14:29:44 +04:00
|
|
|
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
|
|
|
|
2008-02-04 18:01:34 +03:00
|
|
|
virtual void Quit();
|
2007-10-22 14:29:44 +04:00
|
|
|
virtual void DispatchMessage(BMessage *message, BHandler *handler);
|
|
|
|
virtual void MessageReceived(BMessage *message);
|
|
|
|
virtual void FrameMoved(BPoint newPosition);
|
2008-02-04 18:01:34 +03:00
|
|
|
virtual void WorkspacesChanged(uint32 oldWorkspaces,
|
|
|
|
uint32 newWorkspaces);
|
2007-10-22 14:29:44 +04:00
|
|
|
virtual void WorkspaceActivated(int32 workspaceIndex, bool state);
|
|
|
|
virtual void FrameResized(float newWidth, float newHeight);
|
|
|
|
virtual void Minimize(bool minimize);
|
2008-02-04 18:01:34 +03:00
|
|
|
virtual void Zoom(BPoint recPosition, float recWidth,
|
|
|
|
float recHeight);
|
2007-10-22 14:29:44 +04:00
|
|
|
virtual void ScreenChanged(BRect screenFrame, color_space depth);
|
|
|
|
virtual void MenusBeginning();
|
|
|
|
virtual void MenusEnded();
|
|
|
|
virtual void WindowActivated(bool state);
|
|
|
|
virtual void Show();
|
|
|
|
virtual void Hide();
|
|
|
|
virtual BHandler* ResolveSpecifier(BMessage *message, int32 index,
|
|
|
|
BMessage *specifier, int32 form,
|
|
|
|
const char *property);
|
|
|
|
virtual status_t GetSupportedSuites(BMessage *data);
|
|
|
|
virtual status_t Perform(perform_code code, void *arg);
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual void task_looper();
|
|
|
|
virtual BMessage* ConvertToMessage(void *raw, int32 code);
|
|
|
|
|
|
|
|
public:
|
2008-02-04 18:01:34 +03:00
|
|
|
virtual void DirectConnected(direct_buffer_info *info);
|
|
|
|
status_t GetClippingRegion(BRegion *region,
|
|
|
|
BPoint *origin = NULL) const;
|
|
|
|
status_t SetFullScreen(bool enable);
|
|
|
|
bool IsFullScreen() const;
|
2007-10-22 14:29:44 +04:00
|
|
|
|
2008-02-04 18:01:34 +03:00
|
|
|
static bool SupportsWindowMode(screen_id id = B_MAIN_SCREEN_ID);
|
2003-09-18 17:39:39 +04:00
|
|
|
|
2007-10-22 14:29:44 +04:00
|
|
|
private:
|
2003-09-18 17:39:39 +04:00
|
|
|
typedef BWindow inherited;
|
|
|
|
|
2008-02-04 18:01:34 +03:00
|
|
|
virtual void _ReservedDirectWindow1();
|
|
|
|
virtual void _ReservedDirectWindow2();
|
|
|
|
virtual void _ReservedDirectWindow3();
|
|
|
|
virtual void _ReservedDirectWindow4();
|
|
|
|
|
2003-09-18 17:39:39 +04:00
|
|
|
BDirectWindow();
|
2008-02-04 18:01:34 +03:00
|
|
|
BDirectWindow(BDirectWindow& other);
|
|
|
|
BDirectWindow& operator=(BDirectWindow& other);
|
2003-09-18 17:39:39 +04:00
|
|
|
|
2008-02-04 18:01:34 +03:00
|
|
|
static int32 _daemon_thread(void* arg);
|
2007-10-22 14:29:44 +04:00
|
|
|
int32 _DirectDaemon();
|
|
|
|
bool _LockDirect() const;
|
|
|
|
void _UnlockDirect() const;
|
|
|
|
|
|
|
|
void _InitData();
|
|
|
|
void _DisposeData();
|
|
|
|
|
|
|
|
bool fDaemonKiller;
|
|
|
|
bool fConnectionEnable;
|
|
|
|
bool fIsFullScreen;
|
|
|
|
bool _unused;
|
|
|
|
bool fInDirectConnect;
|
2008-02-04 18:01:34 +03:00
|
|
|
|
2007-10-22 14:29:44 +04:00
|
|
|
int32 fDirectLock;
|
|
|
|
sem_id fDirectSem;
|
|
|
|
uint32 fDirectLockCount;
|
|
|
|
thread_id fDirectLockOwner;
|
2008-02-04 18:01:34 +03:00
|
|
|
char* fDirectLockStack;
|
|
|
|
|
2007-10-22 14:29:44 +04:00
|
|
|
sem_id fDisableSem;
|
|
|
|
sem_id fDisableSemAck;
|
2008-02-04 18:01:34 +03:00
|
|
|
|
2007-10-22 14:29:44 +04:00
|
|
|
uint32 fInitStatus;
|
|
|
|
uint32 fInfoAreaSize;
|
2008-02-04 18:01:34 +03:00
|
|
|
|
2007-10-22 14:29:44 +04:00
|
|
|
uint32 _reserved[2];
|
2008-02-04 18:01:34 +03:00
|
|
|
|
2007-10-22 14:29:44 +04:00
|
|
|
area_id fClonedClippingArea;
|
|
|
|
area_id fSourceClippingArea;
|
|
|
|
thread_id fDirectDaemonId;
|
2008-02-04 18:01:34 +03:00
|
|
|
direct_buffer_info* fBufferDesc;
|
|
|
|
|
2007-10-22 14:29:44 +04:00
|
|
|
uint32 _more_reserved_[17];
|
2003-09-18 17:39:39 +04:00
|
|
|
};
|
|
|
|
|
2008-02-04 18:01:34 +03:00
|
|
|
#endif // _DIRECT_WINDOW_H
|