* You are supposed to free() the mode list returned by BScreen::GetModeList(),

and not to delete it.
* The header didn't include everything it needed.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16702 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-03-11 15:13:19 +00:00
parent 04d40ff247
commit f157272bee
2 changed files with 31 additions and 27 deletions

View File

@ -6,10 +6,13 @@
Multi-Monitor Settings interface
*/
#ifndef _MULTIMON_H
#define _MULTIMON_H
#include <SupportDefs.h>
class BScreen;
status_t GetSwapDisplays( BScreen *screen, bool *swap );
@ -24,4 +27,4 @@ status_t SetTVStandard( BScreen *screen, uint32 standard );
status_t TestMultiMonSupport( BScreen *screen );
#endif
#endif // _MULTIMON_H

View File

@ -1,21 +1,21 @@
/*
Copyright (c) 2002, Thomas Kurschel
Part of Radeon driver
Multi-Monitor Settings interface
*/
#include <OS.h>
#include "multimon.h"
#include "accelerant_ext.h"
#include <stdio.h>
#include <string.h>
#include <OS.h>
#include <Screen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// prepare parameters so they recognized as tunneled settings
static void PrepareTunnel(
@ -181,38 +181,39 @@ status_t SetTVStandard( BScreen *screen, uint32 standard )
// Verify existence of Multi-Monitor Settings Tunnel
status_t TestMultiMonSupport( BScreen *screen )
status_t
TestMultiMonSupport(BScreen *screen)
{
display_mode *mode_list;
display_mode *modeList = NULL;
display_mode low, high;
uint32 count;
status_t result;
// take any valid mode
result = screen->GetModeList( &mode_list, &count );
if( result != B_OK )
result = screen->GetModeList(&modeList, &count);
if (result != B_OK)
return result;
if( count < 1 )
if (count < 1)
return B_ERROR;
// set request bits
mode_list[0].timing.flags |= RADEON_MODE_MULTIMON_REQUEST;
mode_list[0].timing.flags &= ~RADEON_MODE_MULTIMON_REPLY;
low = high = mode_list[0];
modeList[0].timing.flags |= RADEON_MODE_MULTIMON_REQUEST;
modeList[0].timing.flags &= ~RADEON_MODE_MULTIMON_REPLY;
low = high = modeList[0];
result = screen->ProposeMode( &mode_list[0], &low, &high );
if( result != B_OK )
goto err;
result = screen->ProposeMode(&modeList[0], &low, &high);
if (result != B_OK)
goto out;
// check reply bits
if( (mode_list[0].timing.flags & RADEON_MODE_MULTIMON_REQUEST) == 0 &&
(mode_list[0].timing.flags & RADEON_MODE_MULTIMON_REPLY) != 0 )
if ((modeList[0].timing.flags & RADEON_MODE_MULTIMON_REQUEST) == 0
&& (modeList[0].timing.flags & RADEON_MODE_MULTIMON_REPLY) != 0)
result = B_OK;
else
result = B_ERROR;
err:
delete mode_list;
out:
free(modeList);
return result;
}