* 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
+5 -2
View File
@@ -6,10 +6,13 @@
Multi-Monitor Settings interface Multi-Monitor Settings interface
*/ */
#ifndef _MULTIMON_H #ifndef _MULTIMON_H
#define _MULTIMON_H #define _MULTIMON_H
#include <SupportDefs.h>
class BScreen; class BScreen;
status_t GetSwapDisplays( BScreen *screen, bool *swap ); status_t GetSwapDisplays( BScreen *screen, bool *swap );
@@ -24,4 +27,4 @@ status_t SetTVStandard( BScreen *screen, uint32 standard );
status_t TestMultiMonSupport( BScreen *screen ); status_t TestMultiMonSupport( BScreen *screen );
#endif #endif // _MULTIMON_H
+26 -25
View File
@@ -1,21 +1,21 @@
/* /*
Copyright (c) 2002, Thomas Kurschel Copyright (c) 2002, Thomas Kurschel
Part of Radeon driver Part of Radeon driver
Multi-Monitor Settings interface Multi-Monitor Settings interface
*/ */
#include <OS.h>
#include "multimon.h" #include "multimon.h"
#include "accelerant_ext.h" #include "accelerant_ext.h"
#include <stdio.h>
#include <string.h>
#include <OS.h>
#include <Screen.h> #include <Screen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// prepare parameters so they recognized as tunneled settings // prepare parameters so they recognized as tunneled settings
static void PrepareTunnel( static void PrepareTunnel(
@@ -181,38 +181,39 @@ status_t SetTVStandard( BScreen *screen, uint32 standard )
// Verify existence of Multi-Monitor Settings Tunnel // 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; display_mode low, high;
uint32 count; uint32 count;
status_t result; status_t result;
// take any valid mode // take any valid mode
result = screen->GetModeList( &mode_list, &count ); result = screen->GetModeList(&modeList, &count);
if( result != B_OK ) if (result != B_OK)
return result; return result;
if( count < 1 ) if (count < 1)
return B_ERROR; return B_ERROR;
// set request bits // set request bits
mode_list[0].timing.flags |= RADEON_MODE_MULTIMON_REQUEST; modeList[0].timing.flags |= RADEON_MODE_MULTIMON_REQUEST;
mode_list[0].timing.flags &= ~RADEON_MODE_MULTIMON_REPLY; modeList[0].timing.flags &= ~RADEON_MODE_MULTIMON_REPLY;
low = high = mode_list[0]; low = high = modeList[0];
result = screen->ProposeMode( &mode_list[0], &low, &high ); result = screen->ProposeMode(&modeList[0], &low, &high);
if( result != B_OK ) if (result != B_OK)
goto err; goto out;
// check reply bits // check reply bits
if( (mode_list[0].timing.flags & RADEON_MODE_MULTIMON_REQUEST) == 0 && if ((modeList[0].timing.flags & RADEON_MODE_MULTIMON_REQUEST) == 0
(mode_list[0].timing.flags & RADEON_MODE_MULTIMON_REPLY) != 0 ) && (modeList[0].timing.flags & RADEON_MODE_MULTIMON_REPLY) != 0)
result = B_OK; result = B_OK;
else else
result = B_ERROR; result = B_ERROR;
err: out:
delete mode_list; free(modeList);
return result; return result;
} }