Ticket #7994: BScreen_style_update_and_variable_renaming_2.diff

File BScreen_style_update_and_variable_renaming_2.diff, 15.3 KB (added by jscipione, 13 years ago)

Upon further reading of the style used in the source I found that the underscores in the parameters for GetBitmap() and GetModeList() were okay so I didn't remove them. The underscores in the params for GetMode() are not and they should be there for GetPixelClockLimits(). Still no functional changes intended.

  • headers/os/interface/Screen.h

    diff --git headers/os/interface/Screen.h headers/os/interface/Screen.h
    index 58cb2e4..a2d6076 100644
    public:  
    5252                                    BRect* frame = NULL);
    5353
    5454            rgb_color           DesktopColor();
    55             rgb_color           DesktopColor(uint32 index);
     55            rgb_color           DesktopColor(uint32 workspace);
    5656            void                SetDesktopColor(rgb_color color,
    5757                                    bool makeDefault = true);
    5858            void                SetDesktopColor(rgb_color color,
    59                                     uint32 index, bool makeDefault = true);
     59                                    uint32 workspace, bool makeDefault = true);
    6060
    6161            status_t            ProposeMode(display_mode* target,
    6262                                    const display_mode* low,
    6363                                    const display_mode* high);
    6464            status_t            GetModeList(display_mode** _modeList,
    6565                                    uint32* _count);
    66             status_t            GetMode(display_mode* _mode);
     66            status_t            GetMode(display_mode* mode);
    6767            status_t            GetMode(uint32 workspace,
    68                                     display_mode* _mode);
     68                                    display_mode* mode);
    6969            status_t            SetMode(display_mode* mode,
    7070                                    bool makeDefault = false);
    7171            status_t            SetMode(uint32 workspace,
    public:  
    7474            status_t            GetDeviceInfo(accelerant_device_info* info);
    7575            status_t            GetMonitorInfo(monitor_info* info);
    7676            status_t            GetPixelClockLimits(display_mode* mode,
    77                                     uint32* low, uint32* high);
     77                                    uint32* _low, uint32* _high);
    7878            status_t            GetTimingConstraints(
    7979                                    display_timing_constraints*
    8080                                        timingConstraints);
  • src/kits/interface/Screen.cpp

    diff --git src/kits/interface/Screen.cpp src/kits/interface/Screen.cpp
    index 7c75a55..0bb4fef 100644
     
    88 */
    99
    1010
    11 /*! BScreen lets you retrieve and change the display settings. */
    12 
    13 
    1411#include <Screen.h>
    1512
    1613#include <Window.h>
     
    2118using namespace BPrivate;
    2219
    2320
    24 /*! \brief Creates a BScreen object which represents the display with the given
    25         screen_id
    26     \param id The screen_id of the screen to get.
    27 
    28     In the current implementation, there is only one display (B_MAIN_SCREEN_ID).
    29     To be sure that the object was correctly constructed, call IsValid().
    30 */
    3121BScreen::BScreen(screen_id id)
    3222{
    3323    fScreen = BPrivateScreen::Get(id.id);
    3424}
    3525
    3626
    37 /*! \brief Creates a BScreen object which represents the display which contains
    38     the given BWindow.
    39     \param window A BWindow.
    40 */
    4127BScreen::BScreen(BWindow* window)
    4228{
    4329    fScreen = BPrivateScreen::Get(window);
    4430}
    4531
    4632
    47 /*! \brief Releases the resources allocated by the constructor.
    48 */
    4933BScreen::~BScreen()
    5034{
    5135    BPrivateScreen::Put(fScreen);
    5236}
    5337
    5438
    55 /*! \brief Checks if the BScreen object represents a real screen connected to
    56         the computer.
    57     \return \c true if the BScreen object is valid, \c false if not.
    58 */
    5939bool
    6040BScreen::IsValid()
    6141{
    BScreen::IsValid()  
    6343}
    6444
    6545
    66 /*! \brief In the current implementation, this function always returns B_ERROR.
    67     \return Always \c B_ERROR.
    68 */
    6946status_t
    7047BScreen::SetToNext()
    7148{
    BScreen::SetToNext()  
    8057}
    8158
    8259
    83 /*! \brief Returns the color space of the screen display.
    84     \return \c B_CMAP8, \c B_RGB15, or \c B_RGB32, or \c B_NO_COLOR_SPACE
    85         if the screen object is invalid.
    86 */
    8760color_space
    8861BScreen::ColorSpace()
    8962{
    9063    if (fScreen != NULL)
    9164        return fScreen->ColorSpace();
     65
    9266    return B_NO_COLOR_SPACE;
    9367}
    9468
    9569
    96 /*! \brief Returns the rectangle that locates the screen in the screen
    97         coordinate system.
    98     \return a BRect that locates the screen in the screen coordinate system.
    99 */
    10070BRect
    10171BScreen::Frame()
    10272{
    10373    if (fScreen != NULL)
    10474        return fScreen->Frame();
     75
    10576    return BRect(0, 0, 0, 0);
    10677}
    10778
    10879
    109 /*! \brief Returns the identifier for the screen.
    110     \return A screen_id struct that identifies the screen.
    111 
    112     In the current implementation, this function always returns
    113     \c B_MAIN_SCREEN_ID, even if the object is invalid.
    114 */
    11580screen_id
    11681BScreen::ID()
    11782{
    BScreen::ID()  
    12489}
    12590
    12691
    127 /*! \brief Blocks until the monitor has finished the current vertical retrace.
    128     \return \c B_OK, or \c B_ERROR if the screen object is invalid.
    129 */
    13092status_t
    13193BScreen::WaitForRetrace()
    13294{
    BScreen::WaitForRetrace()  
    13496}
    13597
    13698
    137 /*! \brief Blocks until the monitor has finished the current vertical retrace,
    138     or until the given timeout has passed.
    139     \param timeout A bigtime_t which indicates the time to wait before
    140         returning.
    141     \return \c B_OK if the monitor has retraced in the given amount of time,
    142         \c B_ERROR otherwise.
    143 */
    14499status_t
    145100BScreen::WaitForRetrace(bigtime_t timeout)
    146101{
    147102    if (fScreen != NULL)
    148103        return fScreen->WaitForRetrace(timeout);
     104
    149105    return B_ERROR;
    150106}
    151107
    152108
    153 /*! \brief Returns the index of the 8-bit color that,
    154         most closely matches the given 32-bit color.
    155     \param r The red value for a 32-bit color.
    156     \param g The green value for a 32-bit color.
    157     \param b The blue value for a 32-bit color.
    158     \param a The alpha value for a 32-bit color.
    159     \return An index for a 8-bit color in the screen's color map.
    160 */
    161109uint8
    162 BScreen::IndexForColor(uint8 r, uint8 g, uint8 b, uint8 a)
     110BScreen::IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha)
    163111{
    164112    if (fScreen != NULL)
    165         return fScreen->IndexForColor(r, g, b, a);
     113        return fScreen->IndexForColor(red, green, blue, alpha);
     114
    166115    return 0;
    167116}
    168117
    169118
    170 /*! \brief Returns the 32-bit color representation of a given 8-bit color index.
    171     \param index The 8-bit color index to convert.
    172     \return A rgb_color struct which represents the given 8-bit color index.
    173 */
    174119rgb_color
    175120BScreen::ColorForIndex(const uint8 index)
    176121{
    177122    if (fScreen != NULL)
    178123        return fScreen->ColorForIndex(index);
     124
    179125    return rgb_color();
    180126}
    181127
    182128
    183 /*! \brief Returns the "inversion" of the given 8-bit color.
    184     \param index An 8-bit color index.
    185     \return An 8-bit color index that represents the "inversion" of the given
    186         color.
    187 */
    188129uint8
    189130BScreen::InvertIndex(uint8 index)
    190131{
    191132    if (fScreen != NULL)
    192133        return fScreen->InvertIndex(index);
     134
    193135    return 0;
    194136}
    195137
    196138
    197 /*! \brief Returns the color map of the current display.
    198     \return A pointer to the object's color_map.
    199 */
    200139const color_map*
    201140BScreen::ColorMap()
    202141{
    203142    if (fScreen != NULL)
    204143        return fScreen->ColorMap();
     144
    205145    return NULL;
    206146}
    207147
    208148
    209 /*! \brief Copies the screen's contents into the first argument BBitmap.
    210     \param screen_shot A pointer to a BBitmap pointer, where the function will
    211         allocate a BBitmap for you.
    212     \param draw_cursor Specifies if you want the cursor to be drawn.
    213     \param bound Let you specify the area you want copied. If it's NULL, the
    214         entire screen is copied.
    215     \return \c B_OK if the operation was succesful, \c B_ERROR on failure.
    216 */
    217149status_t
    218150BScreen::GetBitmap(BBitmap** _bitmap, bool drawCursor, BRect* bounds)
    219151{
    220152    if (fScreen != NULL)
    221153        return fScreen->GetBitmap(_bitmap, drawCursor, bounds);
     154
    222155    return B_ERROR;
    223156}
    224157
    225158
    226 /*! \brief Copies the screen's contents into the first argument BBitmap.
    227     \param screen_shot A pointer to an allocated BBitmap, where the function
    228         will store the screen's content.
    229     \param draw_cursor Specifies if you want the cursor to be drawn.
    230     \param bound Let you specify the area you want copied. If it's NULL, the
    231         entire screen is copied.
    232     \return \c B_OK if the operation was succesful, \c B_ERROR on failure.
    233 
    234     The only difference between this method and GetBitmap() is that ReadBitmap
    235     requires you to allocate a BBitmap, while the latter will allocate a BBitmap
    236     for you.
    237 */
    238159status_t
    239 BScreen::ReadBitmap(BBitmap* buffer, bool drawCursor, BRect* bounds)
     160BScreen::ReadBitmap(BBitmap* bitmap, bool drawCursor, BRect* bounds)
    240161{
    241162    if (fScreen != NULL)
    242         return fScreen->ReadBitmap(buffer, drawCursor, bounds);
     163        return fScreen->ReadBitmap(bitmap, drawCursor, bounds);
     164
    243165    return B_ERROR;
    244166}
    245167
    246168
    247 /*! \brief Returns the color of the desktop.
    248     \return An rgb_color structure which is the color of the desktop.
    249 */
    250169rgb_color
    251170BScreen::DesktopColor()
    252171{
    BScreen::DesktopColor()  
    257176}
    258177
    259178
    260 /*! \brief Returns the color of the desktop in the given workspace.
    261     \param workspace The workspace of which you want to have the color.
    262     \return An rgb_color structure which is the color of the desktop in the
    263         given workspace.
    264 */
    265179rgb_color
    266180BScreen::DesktopColor(uint32 workspace)
    267181{
    BScreen::DesktopColor(uint32 workspace)  
    272186}
    273187
    274188
    275 /*! \brief Set the color of the desktop.
    276     \param rgb The color you want to paint the desktop background.
    277     \param stick If you pass \c true here, the color will be maintained across
    278         boots.
    279 */
    280189void
    281 BScreen::SetDesktopColor(rgb_color rgb, bool stick)
     190BScreen::SetDesktopColor(rgb_color color, bool stick)
    282191{
    283192    if (fScreen != NULL)
    284         fScreen->SetDesktopColor(rgb, B_CURRENT_WORKSPACE_INDEX, stick);
     193        fScreen->SetDesktopColor(color, B_CURRENT_WORKSPACE_INDEX, stick);
    285194}
    286195
    287196
    288 /*! \brief Set the color of the desktop in the given workspace.
    289     \param rgb The color you want to paint the desktop background.
    290     \param index The workspace you want to change the color.
    291     \param stick If you pass \c true here, the color will be maintained across
    292         boots.
    293 */
    294197void
    295 BScreen::SetDesktopColor(rgb_color rgb, uint32 index, bool stick)
     198BScreen::SetDesktopColor(rgb_color color, uint32 workspace, bool stick)
    296199{
    297200    if (fScreen != NULL)
    298         fScreen->SetDesktopColor(rgb, index, stick);
     201        fScreen->SetDesktopColor(color, workspace, stick);
    299202}
    300203
    301204
    302 /*! \brief Attempts to adjust the supplied mode so that it's a supported mode.
    303     \param target The mode you want to be adjusted.
    304     \param low The lower limit you want target to be adjusted.
    305     \param high The higher limit you want target to be adjusted.
    306     \return
    307         - \c B_OK if target (as returned) is supported and falls into the
    308             limits.
    309         - \c B_BAD_VALUE if target (as returned) is supported but doesn't fall
    310             into the limits.
    311         - \c B_ERROR if target isn't supported.
    312 */
    313205status_t
    314206BScreen::ProposeMode(display_mode* target, const display_mode* low,
    315207    const display_mode* high)
    316208{
    317209    if (fScreen != NULL)
    318210        return fScreen->ProposeMode(target, low, high);
     211
    319212    return B_ERROR;
    320213}
    321214
    322215
    323 /*! \brief allocates and returns a list of the display_modes
    324         that the graphics card supports.
    325     \param mode_list A pointer to a mode_list pointer, where the function will
    326         allocate an array of display_mode structures.
    327     \param count A pointer to an integer, where the function will store the
    328         amount of available display modes.
    329     \return \c B_OK.
    330 */
    331216status_t
    332217BScreen::GetModeList(display_mode** _modeList, uint32* _count)
    333218{
    334219    if (fScreen != NULL)
    335220        return fScreen->GetModeList(_modeList, _count);
     221
    336222    return B_ERROR;
    337223}
    338224
    339225
    340 /*! \brief Copies the current display_mode into mode.
    341     \param mode A pointer to a display_mode structure,
    342         where the current display_mode will be copied.
    343     \return \c B_OK if the operation was succesful.
    344 */
    345226status_t
    346227BScreen::GetMode(display_mode* mode)
    347228{
    348229    if (fScreen != NULL)
    349230        return fScreen->GetMode(B_CURRENT_WORKSPACE_INDEX, mode);
     231
    350232    return B_ERROR;
    351233}
    352234
    353235
    354 /*! \brief Copies the current display_mode of the given workspace into mode.
    355     \param workspace The index of the workspace to query.
    356     \param mode A pointer to a display_mode structure,
    357         where the current display_mode will be copied.
    358     \return \c B_OK if the operation was succesful.
    359 */
    360236status_t
    361237BScreen::GetMode(uint32 workspace, display_mode* mode)
    362238{
    363239    if (fScreen != NULL)
    364240        return fScreen->GetMode(workspace, mode);
     241
    365242    return B_ERROR;
    366243}
    367244
    368245
    369 /*! \brief Set the screen to the given mode.
    370     \param mode A pointer to a display_mode.
    371     \param makeDefault If true, the mode becomes the default for the screen.
    372     \return \c B_OK.
    373 */
    374246status_t
    375247BScreen::SetMode(display_mode* mode, bool makeDefault)
    376248{
    377249    if (fScreen != NULL)
    378250        return fScreen->SetMode(B_CURRENT_WORKSPACE_INDEX, mode, makeDefault);
     251
    379252    return B_ERROR;
    380253}
    381254
    382255
    383 /*! \brief Set the given workspace to the given mode.
    384     \param workspace The index of the workspace that you want to change.
    385     \param mode A pointer to a display_mode.
    386     \param makeDefault If true, the mode becomes the default for the workspace.
    387     \return \c B_OK.
    388 */
    389256status_t
    390257BScreen::SetMode(uint32 workspace, display_mode* mode, bool makeDefault)
    391258{
    392259    if (fScreen != NULL)
    393260        return fScreen->SetMode(workspace, mode, makeDefault);
     261
    394262    return B_ERROR;
    395263}
    396264
    397265
    398 /*! \brief Returns information about the graphics card.
    399     \param info An accelerant_device_info struct where to store the retrieved
    400         info.
    401     \return \c B_OK if the operation went fine, otherwise an error code.
    402 */
    403266status_t
    404267BScreen::GetDeviceInfo(accelerant_device_info* info)
    405268{
    406269    if (fScreen != NULL)
    407270        return fScreen->GetDeviceInfo(info);
     271
    408272    return B_ERROR;
    409273}
    410274
    BScreen::GetMonitorInfo(monitor_info* info)  
    414278{
    415279    if (fScreen != NULL)
    416280        return fScreen->GetMonitorInfo(info);
     281
    417282    return B_ERROR;
    418283}
    419284
    420285
    421 /*! \brief Returns, in low and high, the minimum and maximum pixel clock rates
    422         that are possible for the given mode.
    423     \param mode A pointer to a display_mode.
    424     \param low A pointer to an int where the function will store the lowest
    425         available pixel clock.
    426     \param high A pointer to an int where the function wills tore the highest
    427         available pixel clock.
    428     \return \c B_OK if the operation went fine, otherwise an error code.
    429 */
    430286status_t
    431287BScreen::GetPixelClockLimits(display_mode* mode, uint32* _low, uint32* _high)
    432288{
    433289    if (fScreen != NULL)
    434290        return fScreen->GetPixelClockLimits(mode, _low, _high);
     291
    435292    return B_ERROR;
    436293}
    437294
    438295
    439 /*! \brief Fills out the dtc structure with the timing constraints of the
    440         current display mode.
    441     \param dtc A pointer to a display_timing_constraints structure where the
    442         function will store the timing constraints of the current mode.
    443     \return \c B_OK if the operation went fine, otherwise an error code.
    444 */
    445296status_t
    446297BScreen::GetTimingConstraints(display_timing_constraints* constraints)
    447298{
    448299    if (fScreen != NULL)
    449300        return fScreen->GetTimingConstraints(constraints);
     301
    450302    return B_ERROR;
    451303}
    452304
    453305
    454 /*! \brief Lets you set the VESA Display Power Management Signaling state for
    455         the screen.
    456     \param dpms_state The DPMS state you want to be set.
    457         valid values are:
    458         - \c B_DPMS_ON
    459         - \c B_DPMS_STAND_BY
    460         - \c B_DPMS_SUSPEND
    461         - \c B_DPMS_OFF
    462     \return \c B_OK if the operation went fine, otherwise an error code.
    463 */
    464306status_t
    465307BScreen::SetDPMS(uint32 dpmsState)
    466308{
    467309    if (fScreen != NULL)
    468310        return fScreen->SetDPMS(dpmsState);
     311
    469312    return B_ERROR;
    470313}
    471314
    472315
    473 /*! \brief Returns the current DPMS state of the screen.
    474 */
    475316uint32
    476317BScreen::DPMSState()
    477318{
    478319    if (fScreen != NULL)
    479320        return fScreen->DPMSState();
     321
    480322    return 0;
    481323}
    482324
    483325
    484 /*! \brief Indicates which DPMS modes the monitor supports.
    485 */
    486326uint32
    487327BScreen::DPMSCapabilites()
    488328{
    489329    if (fScreen != NULL)
    490330        return fScreen->DPMSCapabilites();
     331
    491332    return 0;
    492333}
    493334
    BScreen::DPMSCapabilites()  
    495336//  #pragma mark - Deprecated methods
    496337
    497338
    498 /*! \brief Returns the BPrivateScreen used by the BScreen object.
    499     \return A pointer to the BPrivateScreen class internally used by the BScreen
    500         object.
    501 */
    502339BPrivate::BPrivateScreen*
    503340BScreen::private_screen()
    504341{
    BScreen::private_screen()  
    506343}
    507344
    508345
    509 /*! \brief Deprecated, use ProposeMode() instead.
    510 */
    511346status_t
    512347BScreen::ProposeDisplayMode(display_mode* target, const display_mode* low,
    513348    const display_mode* high)
    BScreen::ProposeDisplayMode(display_mode* target, const display_mode* low,  
    516351}
    517352
    518353
    519 /*! \brief Returns the base address of the framebuffer.
    520 */
    521354void*
    522355BScreen::BaseAddress()
    523356{
    524357    if (fScreen != NULL)
    525358        return fScreen->BaseAddress();
     359
    526360    return NULL;
    527361}
    528362
    529363
    530 /*! \brief Returns the amount of bytes per row of the framebuffer.
    531 */
    532364uint32
    533365BScreen::BytesPerRow()
    534366{
    535367    if (fScreen != NULL)
    536368        return fScreen->BytesPerRow();
     369
    537370    return 0;
    538371}