DirectWindow.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 //
00003 //  File:       DirectWindow.h
00004 //
00005 //  Description:    Client window class for direct screen access.
00006 //
00007 //  Copyright 1998, Be Incorporated, All Rights Reserved.
00008 //
00009 *******************************************************************************/
00010 
00011 
00012 #ifndef _DIRECT_WINDOW_H
00013 #define _DIRECT_WINDOW_H
00014 
00015 #include <Region.h>
00016 #include <Window.h>
00017 
00018 class BDirectDriver;
00019                     
00020 /* State of the direct access when called back through DirectConnected */
00021 enum direct_buffer_state {
00022     B_DIRECT_MODE_MASK  = 15,
00023 
00024     B_DIRECT_START      = 0,
00025     B_DIRECT_STOP       = 1,
00026     B_DIRECT_MODIFY     = 2,
00027     
00028     B_CLIPPING_MODIFIED = 16,
00029     B_BUFFER_RESIZED    = 32,
00030     B_BUFFER_MOVED      = 64,
00031     B_BUFFER_RESET      = 128
00032 };
00033 
00034 /* State of the direct driver and its hooks functions */
00035 enum direct_driver_state {
00036     B_DRIVER_CHANGED    = 0x0001,
00037     B_MODE_CHANGED      = 0x0002
00038 };
00039 
00040 /* Integer rect used to define a cliping rectangle. All bounds are included */
00041 /* Moved to Region.h */
00042 
00043 /* Frame buffer access descriptor */
00044 typedef struct {
00045     direct_buffer_state buffer_state;
00046     direct_driver_state driver_state;
00047     void                *bits;
00048     void                *pci_bits;
00049     int32               bytes_per_row;
00050     uint32              bits_per_pixel;
00051     color_space         pixel_format;
00052     buffer_layout       layout;
00053     buffer_orientation  orientation;
00054     uint32              _reserved[9];
00055     uint32              _dd_type_;
00056     uint32              _dd_token_;
00057     uint32              clip_list_count;
00058     clipping_rect       window_bounds;
00059     clipping_rect       clip_bounds;
00060     clipping_rect       clip_list[1];
00061 } direct_buffer_info;
00062 
00063 /* BDirectWindow class */
00064 class BDirectWindow : public BWindow {
00065 public:
00066         BDirectWindow(  BRect       frame,
00067                         const char  *title, 
00068                         window_type type,
00069                         uint32      flags,
00070                         uint32      workspace = B_CURRENT_WORKSPACE);
00071         BDirectWindow(  BRect       frame,
00072                         const char  *title, 
00073                         window_look look,
00074                         window_feel feel,
00075                         uint32      flags,
00076                         uint32      workspace = B_CURRENT_WORKSPACE);
00077 virtual ~BDirectWindow();
00078 static  BArchivable     *Instantiate(BMessage *data);
00079 virtual status_t        Archive(BMessage *data, bool deep = true) const;
00080 
00081 /* defined for future extension (fragile base class). Identical to BWindow */
00082 virtual void            Quit(void);
00083 virtual void            DispatchMessage(BMessage *message, BHandler *handler);
00084 virtual void            MessageReceived(BMessage *message);
00085 virtual void            FrameMoved(BPoint new_position);
00086 virtual void            WorkspacesChanged(uint32 old_ws, uint32 new_ws);
00087 virtual void            WorkspaceActivated(int32 ws, bool state);
00088 virtual void            FrameResized(float new_width, float new_height);
00089 virtual void            Minimize(bool minimize);
00090 virtual void            Zoom(   BPoint rec_position,
00091                                 float rec_width,
00092                                 float rec_height);
00093 virtual void            ScreenChanged(BRect screen_size, color_space depth);
00094 virtual void            MenusBeginning();
00095 virtual void            MenusEnded();
00096 virtual void            WindowActivated(bool state);
00097 virtual void            Show();
00098 virtual void            Hide();
00099 virtual BHandler        *ResolveSpecifier(BMessage *msg,
00100                                         int32 index,
00101                                         BMessage *specifier,
00102                                         int32 form,
00103                                         const char *property);
00104 virtual status_t        GetSupportedSuites(BMessage *data);
00105 virtual status_t        Perform(perform_code d, void *arg);
00106 
00107 private:
00108 virtual void            task_looper();
00109 virtual BMessage        *ConvertToMessage(void *raw, int32 code);
00110 
00111 /* new APIs */
00112 
00113 public:
00114 virtual void            DirectConnected(direct_buffer_info *info);
00115         status_t        GetClippingRegion(BRegion *region, BPoint *origin = NULL) const;
00116         status_t        SetFullScreen(bool enable);
00117         bool            IsFullScreen() const;
00118         
00119 static  bool            SupportsWindowMode(screen_id = B_MAIN_SCREEN_ID);
00120 
00121 /* private */
00122 private:
00123 
00124         typedef BWindow inherited;
00125 
00126 virtual void            _ReservedDirectWindow1();
00127 virtual void            _ReservedDirectWindow2();
00128 virtual void            _ReservedDirectWindow3();
00129 virtual void            _ReservedDirectWindow4();
00130         
00131 
00132         BDirectWindow();
00133         BDirectWindow(BDirectWindow &);
00134         BDirectWindow &operator=(BDirectWindow &);
00135 
00136         bool                deamon_killer;
00137         bool                connection_enable;
00138         bool                full_screen_enable;
00139         bool                direct_driver_ready;
00140         bool                in_direct_connect;
00141         int32               direct_lock;                
00142         sem_id              direct_sem;
00143         uint32              direct_lock_count;
00144         thread_id           direct_lock_owner;
00145         char                *direct_lock_stack;
00146         sem_id              disable_sem;
00147         sem_id              disable_sem_ack;
00148         uint32              dw_init_status;
00149         uint32              info_area_size;
00150         uint32              direct_driver_type;
00151         uint32              direct_driver_token;
00152         area_id             cloned_clipping_area;
00153         area_id             source_clipping_area;
00154         thread_id           direct_deamon_id;
00155         direct_buffer_info  *buffer_desc;
00156         BDirectDriver       *direct_driver;
00157         struct priv_ext     *extension;
00158         uint32              _reserved_[15];
00159 
00160 static  int32               DirectDeamonFunc(void *arg);
00161         bool                LockDirect() const;
00162         void                UnlockDirect() const;
00163         void                InitData();
00164         void                DisposeData();
00165         status_t            DriverSetup() const;
00166 };
00167 
00168 #endif
00169 
00170 
00171 
00172 
00173 

Copyright 2005 by yellowTAB GmbH, Be Inc., Palm Source Inc. and their respective legal successors
All rights reserved.