clean up (white spaces, spacing and parenthesis)
added a TODO about using kMaxWorkspaces in ScreenMode.cpp git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36242 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -231,7 +231,8 @@ ScreenMode::GetOriginalMode(screen_mode& mode, int32 workspace) const
|
|||||||
{
|
{
|
||||||
if (workspace == ~0)
|
if (workspace == ~0)
|
||||||
workspace = current_workspace();
|
workspace = current_workspace();
|
||||||
else if(workspace > 31)
|
// TODO this should use kMaxWorkspaces
|
||||||
|
else if (workspace > 31)
|
||||||
return B_BAD_INDEX;
|
return B_BAD_INDEX;
|
||||||
|
|
||||||
mode = fOriginal[workspace];
|
mode = fOriginal[workspace];
|
||||||
|
|||||||
@@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
|
|
||||||
// prepare parameters so they recognized as tunneled settings
|
// prepare parameters so they recognized as tunneled settings
|
||||||
static void PrepareTunnel(
|
static void
|
||||||
display_mode *mode, display_mode *low, display_mode *high )
|
PrepareTunnel(display_mode *mode, display_mode *low, display_mode *high)
|
||||||
{
|
{
|
||||||
memset( mode, 0, sizeof( *mode ));
|
memset(mode, 0, sizeof(*mode));
|
||||||
|
|
||||||
// mark modes as settings tunnel
|
// mark modes as settings tunnel
|
||||||
mode->space = low->space = high->space = 0;
|
mode->space = low->space = high->space = 0;
|
||||||
@@ -36,147 +36,151 @@ static void PrepareTunnel(
|
|||||||
|
|
||||||
|
|
||||||
// retrieve value of setting "code"
|
// retrieve value of setting "code"
|
||||||
static status_t GetSetting(
|
static status_t
|
||||||
BScreen *screen, uint16 code, uint32 *setting )
|
GetSetting(BScreen *screen, uint16 code, uint32 *setting)
|
||||||
{
|
{
|
||||||
display_mode mode, low, high;
|
display_mode mode, low, high;
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
result = TestMultiMonSupport( screen );
|
result = TestMultiMonSupport(screen);
|
||||||
if( result != B_OK )
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
PrepareTunnel( &mode, &low, &high );
|
PrepareTunnel(&mode, &low, &high);
|
||||||
|
|
||||||
mode.h_display_start = code;
|
mode.h_display_start = code;
|
||||||
mode.v_display_start = 0;
|
mode.v_display_start = 0;
|
||||||
|
|
||||||
result = screen->ProposeMode( &mode, &low, &high );
|
result = screen->ProposeMode(&mode, &low, &high);
|
||||||
if( result != B_OK )
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
*setting = mode.timing.flags;
|
*setting = mode.timing.flags;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// set setting "code" to "value"
|
// set setting "code" to "value"
|
||||||
static status_t SetSetting(
|
static status_t
|
||||||
BScreen *screen, uint16 code, uint32 value )
|
SetSetting(BScreen *screen, uint16 code, uint32 value)
|
||||||
{
|
{
|
||||||
display_mode mode, low, high;
|
display_mode mode, low, high;
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
result = TestMultiMonSupport( screen );
|
result = TestMultiMonSupport(screen);
|
||||||
if( result != B_OK )
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
PrepareTunnel( &mode, &low, &high );
|
PrepareTunnel(&mode, &low, &high);
|
||||||
|
|
||||||
mode.h_display_start = code;
|
mode.h_display_start = code;
|
||||||
mode.v_display_start = 1;
|
mode.v_display_start = 1;
|
||||||
mode.timing.flags = value;
|
mode.timing.flags = value;
|
||||||
|
|
||||||
return screen->ProposeMode( &mode, &low, &high );
|
return screen->ProposeMode(&mode, &low, &high);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// retrieve n-th supported value of setting "code"
|
// retrieve n-th supported value of setting "code"
|
||||||
static status_t GetNthSupportedSetting(
|
static status_t
|
||||||
BScreen *screen, uint16 code, int32 idx, uint32 *setting )
|
GetNthSupportedSetting(BScreen *screen, uint16 code, int32 idx,
|
||||||
|
uint32 *setting)
|
||||||
{
|
{
|
||||||
display_mode mode, low, high;
|
display_mode mode, low, high;
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
result = TestMultiMonSupport( screen );
|
result = TestMultiMonSupport(screen);
|
||||||
if( result != B_OK )
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
PrepareTunnel( &mode, &low, &high );
|
PrepareTunnel(&mode, &low, &high);
|
||||||
|
|
||||||
mode.h_display_start = code;
|
mode.h_display_start = code;
|
||||||
mode.v_display_start = 2;
|
mode.v_display_start = 2;
|
||||||
mode.timing.flags = idx;
|
mode.timing.flags = idx;
|
||||||
|
|
||||||
result = screen->ProposeMode( &mode, &low, &high );
|
result = screen->ProposeMode(&mode, &low, &high);
|
||||||
if( result != B_OK )
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
*setting = mode.timing.flags;
|
*setting = mode.timing.flags;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get current Swap Displays settings
|
// get current Swap Displays settings
|
||||||
status_t GetSwapDisplays(
|
status_t
|
||||||
BScreen *screen, bool *swap )
|
GetSwapDisplays(BScreen *screen, bool *swap)
|
||||||
{
|
{
|
||||||
status_t result;
|
status_t result;
|
||||||
uint32 tmp;
|
uint32 tmp;
|
||||||
|
|
||||||
result = GetSetting( screen, ms_swap, &tmp );
|
result = GetSetting(screen, ms_swap, &tmp);
|
||||||
if( result != B_OK )
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
*swap = tmp != 0;
|
*swap = tmp != 0;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// set "Swap Displays"
|
// set "Swap Displays"
|
||||||
status_t SetSwapDisplays(
|
status_t
|
||||||
BScreen *screen, bool swap )
|
SetSwapDisplays(BScreen *screen, bool swap)
|
||||||
{
|
{
|
||||||
return SetSetting( screen, ms_swap, swap );
|
return SetSetting(screen, ms_swap, swap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get current "Use Laptop Panel" settings
|
// get current "Use Laptop Panel" settings
|
||||||
status_t GetUseLaptopPanel(
|
status_t
|
||||||
BScreen *screen, bool *use )
|
GetUseLaptopPanel(BScreen *screen, bool *use)
|
||||||
{
|
{
|
||||||
status_t result;
|
status_t result;
|
||||||
uint32 tmp;
|
uint32 tmp;
|
||||||
|
|
||||||
result = GetSetting( screen, ms_use_laptop_panel, &tmp );
|
result = GetSetting(screen, ms_use_laptop_panel, &tmp);
|
||||||
if( result != B_OK )
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
*use = tmp != 0;
|
*use = tmp != 0;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// set "Use Laptop Panel"
|
// set "Use Laptop Panel"
|
||||||
status_t SetUseLaptopPanel(
|
status_t
|
||||||
BScreen *screen, bool use )
|
SetUseLaptopPanel(BScreen *screen, bool use)
|
||||||
{
|
{
|
||||||
return SetSetting( screen, ms_use_laptop_panel, use );
|
return SetSetting(screen, ms_use_laptop_panel, use);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get n-th supported TV standard
|
// get n-th supported TV standard
|
||||||
status_t GetNthSupportedTVStandard( BScreen *screen, int idx, uint32 *standard )
|
status_t
|
||||||
|
GetNthSupportedTVStandard(BScreen *screen, int idx, uint32 *standard)
|
||||||
{
|
{
|
||||||
return GetNthSupportedSetting(
|
return GetNthSupportedSetting(
|
||||||
screen, ms_tv_standard, (int32)idx, standard );
|
screen, ms_tv_standard, (int32)idx, standard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get current TV Standard settings
|
// get current TV Standard settings
|
||||||
status_t GetTVStandard( BScreen *screen, uint32 *standard )
|
status_t
|
||||||
|
GetTVStandard(BScreen *screen, uint32 *standard)
|
||||||
{
|
{
|
||||||
return GetSetting( screen, ms_tv_standard, standard );
|
return GetSetting(screen, ms_tv_standard, standard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// set TV Standard
|
// set TV Standard
|
||||||
status_t SetTVStandard( BScreen *screen, uint32 standard )
|
status_t
|
||||||
|
SetTVStandard(BScreen *screen, uint32 standard)
|
||||||
{
|
{
|
||||||
return SetSetting( screen, ms_tv_standard, standard );
|
return SetSetting(screen, ms_tv_standard, standard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -189,7 +193,7 @@ TestMultiMonSupport(BScreen *screen)
|
|||||||
uint32 count;
|
uint32 count;
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
// take any valid mode
|
// take any valid mode
|
||||||
result = screen->GetModeList(&modeList, &count);
|
result = screen->GetModeList(&modeList, &count);
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
@@ -197,7 +201,7 @@ TestMultiMonSupport(BScreen *screen)
|
|||||||
if (count < 1)
|
if (count < 1)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
// set request bits
|
// set request bits
|
||||||
modeList[0].timing.flags |= RADEON_MODE_MULTIMON_REQUEST;
|
modeList[0].timing.flags |= RADEON_MODE_MULTIMON_REQUEST;
|
||||||
modeList[0].timing.flags &= ~RADEON_MODE_MULTIMON_REPLY;
|
modeList[0].timing.flags &= ~RADEON_MODE_MULTIMON_REPLY;
|
||||||
low = high = modeList[0];
|
low = high = modeList[0];
|
||||||
@@ -206,7 +210,7 @@ TestMultiMonSupport(BScreen *screen)
|
|||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
// check reply bits
|
// check reply bits
|
||||||
if ((modeList[0].timing.flags & RADEON_MODE_MULTIMON_REQUEST) == 0
|
if ((modeList[0].timing.flags & RADEON_MODE_MULTIMON_REQUEST) == 0
|
||||||
&& (modeList[0].timing.flags & RADEON_MODE_MULTIMON_REPLY) != 0)
|
&& (modeList[0].timing.flags & RADEON_MODE_MULTIMON_REPLY) != 0)
|
||||||
result = B_OK;
|
result = B_OK;
|
||||||
|
|||||||
+14
-14
@@ -22,7 +22,7 @@
|
|||||||
// File Name: Angle.cpp
|
// File Name: Angle.cpp
|
||||||
// Author: DarkWyrm <[email protected]>
|
// Author: DarkWyrm <[email protected]>
|
||||||
// Description: Angle class for speeding up trig functions
|
// Description: Angle class for speeding up trig functions
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
#include "Angle.h"
|
#include "Angle.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@@ -62,7 +62,7 @@ Angle::~Angle()
|
|||||||
void
|
void
|
||||||
Angle::Normalize()
|
Angle::Normalize()
|
||||||
{
|
{
|
||||||
// if the value of the angle is >=360 or <0, make it so that it is
|
// if the value of the angle is >=360 or <0, make it so that it is
|
||||||
// within those bounds
|
// within those bounds
|
||||||
fAngleValue = fmodf(fAngleValue, 360);
|
fAngleValue = fmodf(fAngleValue, 360);
|
||||||
if (fAngleValue < 0)
|
if (fAngleValue < 0)
|
||||||
@@ -87,15 +87,15 @@ Angle::Sine()
|
|||||||
Angle
|
Angle
|
||||||
Angle::InvSine(float value)
|
Angle::InvSine(float value)
|
||||||
{
|
{
|
||||||
// Returns the inverse sine of a value in the range 0 <= value <= 1 via
|
// Returns the inverse sine of a value in the range 0 <= value <= 1 via
|
||||||
// reverse-lookup any value out of range causes the function to return 0
|
// reverse-lookup any value out of range causes the function to return 0
|
||||||
|
|
||||||
// Filter out bad values
|
// Filter out bad values
|
||||||
value = fabs(value);
|
value = fabs(value);
|
||||||
|
|
||||||
if (value > 1)
|
if (value > 1)
|
||||||
return Angle(0);
|
return Angle(0);
|
||||||
|
|
||||||
uint16 i = 90;
|
uint16 i = 90;
|
||||||
while (value < sSinTable[i])
|
while (value < sSinTable[i])
|
||||||
i--;
|
i--;
|
||||||
@@ -104,7 +104,7 @@ Angle::InvSine(float value)
|
|||||||
// to the passed value
|
// to the passed value
|
||||||
if ((value - sSinTable[i]) > (sSinTable[i + 1] - value))
|
if ((value - sSinTable[i]) > (sSinTable[i + 1] - value))
|
||||||
return Angle(i + 1);
|
return Angle(i + 1);
|
||||||
|
|
||||||
return Angle(i); // value is closer to previous
|
return Angle(i); // value is closer to previous
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ Angle::Cosine(void)
|
|||||||
Angle
|
Angle
|
||||||
Angle::InvCosine(float value)
|
Angle::InvCosine(float value)
|
||||||
{
|
{
|
||||||
// Returns the inverse cosine of a value in the range 0 <= value <= 1 via
|
// Returns the inverse cosine of a value in the range 0 <= value <= 1 via
|
||||||
// reverse-lookup any value out of range causes the function to return 0
|
// reverse-lookup any value out of range causes the function to return 0
|
||||||
|
|
||||||
// Filter out bad values
|
// Filter out bad values
|
||||||
@@ -135,7 +135,7 @@ Angle::InvCosine(float value)
|
|||||||
|
|
||||||
if (value > 1)
|
if (value > 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uint16 i = 90;
|
uint16 i = 90;
|
||||||
while (value > sCosTable[i])
|
while (value > sCosTable[i])
|
||||||
i--;
|
i--;
|
||||||
@@ -160,7 +160,7 @@ Angle::Tangent(int *status)
|
|||||||
*status = 0;
|
*status = 0;
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sTanTable[(int)fAngleValue];
|
return sTanTable[(int)fAngleValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,12 +177,12 @@ Angle::InvTangent(float value)
|
|||||||
|
|
||||||
if (value > 1)
|
if (value > 1)
|
||||||
return Angle(0);
|
return Angle(0);
|
||||||
|
|
||||||
uint16 i = 90;
|
uint16 i = 90;
|
||||||
while (value > sTanTable[i])
|
while (value > sTanTable[i])
|
||||||
i--;
|
i--;
|
||||||
|
|
||||||
if( (value - sTanTable[i]) < (sTanTable[i+1] - value) )
|
if ((value - sTanTable[i]) < (sTanTable[i+1] - value))
|
||||||
return Angle(i+1);
|
return Angle(i+1);
|
||||||
|
|
||||||
return Angle(i); // value is closer to previous
|
return Angle(i); // value is closer to previous
|
||||||
@@ -209,7 +209,7 @@ Angle::Quadrant()
|
|||||||
|
|
||||||
if (fAngleValue < 270)
|
if (fAngleValue < 270)
|
||||||
return 3;
|
return 3;
|
||||||
|
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,13 +279,13 @@ Angle::_InitTrigTables()
|
|||||||
// Get these so that we can do some superfast assignments
|
// Get these so that we can do some superfast assignments
|
||||||
double sinValue = sin(currentRadian);
|
double sinValue = sin(currentRadian);
|
||||||
double cosValue = cos(currentRadian);
|
double cosValue = cos(currentRadian);
|
||||||
|
|
||||||
// Do 4 assignments, taking advantage of sin/cos symmetry
|
// Do 4 assignments, taking advantage of sin/cos symmetry
|
||||||
sSinTable[i] = sinValue;
|
sSinTable[i] = sinValue;
|
||||||
sSinTable[i + 90] = cosValue;
|
sSinTable[i + 90] = cosValue;
|
||||||
sSinTable[i + 180] = sinValue * -1;
|
sSinTable[i + 180] = sinValue * -1;
|
||||||
sSinTable[i + 270] = cosValue * -1;
|
sSinTable[i + 270] = cosValue * -1;
|
||||||
|
|
||||||
sCosTable[i] = cosValue;
|
sCosTable[i] = cosValue;
|
||||||
sCosTable[i + 90] = sinValue * -1;
|
sCosTable[i + 90] = sinValue * -1;
|
||||||
sCosTable[i + 180] = cosValue * -1;
|
sCosTable[i + 180] = cosValue * -1;
|
||||||
|
|||||||
@@ -1,31 +1,29 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "LEDAnimation.h"
|
#include "LEDAnimation.h"
|
||||||
|
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
|
|
||||||
#define SNOOZE_TIME 150000
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/***********************************************************
|
#define SNOOZE_TIME 150000
|
||||||
* Constructor
|
|
||||||
***********************************************************/
|
|
||||||
LEDAnimation::LEDAnimation()
|
LEDAnimation::LEDAnimation()
|
||||||
:fThread(-1)
|
:
|
||||||
,fRunning(false)
|
fThread(-1),
|
||||||
,fOrigModifiers(::modifiers())
|
fRunning(false),
|
||||||
|
fOrigModifiers(::modifiers())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Destructor
|
|
||||||
***********************************************************/
|
|
||||||
LEDAnimation::~LEDAnimation()
|
LEDAnimation::~LEDAnimation()
|
||||||
{
|
{
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Start
|
|
||||||
***********************************************************/
|
|
||||||
void
|
void
|
||||||
LEDAnimation::Start()
|
LEDAnimation::Start()
|
||||||
{
|
{
|
||||||
@@ -40,9 +38,7 @@ LEDAnimation::Start()
|
|||||||
::resume_thread(fThread);
|
::resume_thread(fThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Stop
|
|
||||||
***********************************************************/
|
|
||||||
void
|
void
|
||||||
LEDAnimation::Stop()
|
LEDAnimation::Stop()
|
||||||
{
|
{
|
||||||
@@ -57,44 +53,39 @@ LEDAnimation::Stop()
|
|||||||
::set_keyboard_locks(fOrigModifiers);
|
::set_keyboard_locks(fOrigModifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* AnimationThread
|
|
||||||
***********************************************************/
|
|
||||||
int32
|
int32
|
||||||
LEDAnimation::AnimationThread(void* data)
|
LEDAnimation::AnimationThread(void* data)
|
||||||
{
|
{
|
||||||
LEDAnimation *anim = (LEDAnimation*)data;
|
LEDAnimation *anim = (LEDAnimation*)data;
|
||||||
|
|
||||||
while (anim->fRunning)
|
while (anim->fRunning) {
|
||||||
{
|
LED(B_NUM_LOCK,true);
|
||||||
LED(B_NUM_LOCK,true);
|
|
||||||
LED(B_NUM_LOCK,false);
|
LED(B_NUM_LOCK,false);
|
||||||
|
|
||||||
LED(B_CAPS_LOCK,true);
|
LED(B_CAPS_LOCK,true);
|
||||||
LED(B_CAPS_LOCK,false);
|
LED(B_CAPS_LOCK,false);
|
||||||
|
|
||||||
LED(B_SCROLL_LOCK,true);
|
LED(B_SCROLL_LOCK,true);
|
||||||
LED(B_SCROLL_LOCK,false);
|
LED(B_SCROLL_LOCK,false);
|
||||||
|
|
||||||
LED(B_CAPS_LOCK,true);
|
LED(B_CAPS_LOCK,true);
|
||||||
LED(B_CAPS_LOCK,false);
|
LED(B_CAPS_LOCK,false);
|
||||||
}
|
}
|
||||||
anim->fThread = -1;
|
anim->fThread = -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* LED
|
|
||||||
***********************************************************/
|
|
||||||
void
|
void
|
||||||
LEDAnimation::LED(uint32 mod,bool on)
|
LEDAnimation::LED(uint32 mod,bool on)
|
||||||
{
|
{
|
||||||
uint32 current_modifiers = ::modifiers();
|
uint32 current_modifiers = ::modifiers();
|
||||||
if(on)
|
if (on)
|
||||||
current_modifiers |= mod;
|
current_modifiers |= mod;
|
||||||
else
|
else
|
||||||
current_modifiers &= ~mod;
|
current_modifiers &= ~mod;
|
||||||
::set_keyboard_locks(current_modifiers);
|
::set_keyboard_locks(current_modifiers);
|
||||||
if(on)
|
if (on)
|
||||||
::snooze(SNOOZE_TIME);
|
::snooze(SNOOZE_TIME);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ DefaultManager::LoadState()
|
|||||||
CALLED();
|
CALLED();
|
||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
BPath path;
|
BPath path;
|
||||||
if((err = find_directory(B_USER_SETTINGS_DIRECTORY, &path))!=B_OK)
|
if ((err = find_directory(B_USER_SETTINGS_DIRECTORY, &path)) != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
path.Append(kDefaultManagerSettingsDirectory);
|
path.Append(kDefaultManagerSettingsDirectory);
|
||||||
@@ -102,7 +102,7 @@ DefaultManager::LoadState()
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
if (file.Read(&default_type, sizeof(uint32)) < (int32)sizeof(uint32))
|
if (file.Read(&default_type, sizeof(uint32)) < (int32)sizeof(uint32))
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
if(settings.Unflatten(&file)==B_OK) {
|
if (settings.Unflatten(&file) == B_OK) {
|
||||||
settings.PrintToStream();
|
settings.PrintToStream();
|
||||||
fMsgList.AddItem(new BMessage(settings));
|
fMsgList.AddItem(new BMessage(settings));
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ DefaultManager::SaveState(NodeManager *node_manager)
|
|||||||
|
|
||||||
uint32 default_types[] = {kMsgTypeVideoIn, kMsgTypeVideoOut,
|
uint32 default_types[] = {kMsgTypeVideoIn, kMsgTypeVideoOut,
|
||||||
kMsgTypeAudioIn, kMsgTypeAudioOut};
|
kMsgTypeAudioIn, kMsgTypeAudioOut};
|
||||||
uint32 media_node_ids[] = {fPhysicalVideoIn, fPhysicalVideoOut,
|
uint32 media_node_ids[] = {fPhysicalVideoIn, fPhysicalVideoOut,
|
||||||
fPhysicalAudioIn, fPhysicalAudioOut};
|
fPhysicalAudioIn, fPhysicalAudioOut};
|
||||||
for (uint32 i=0; i<sizeof(default_types)/sizeof(default_types[0]); i++) {
|
for (uint32 i=0; i<sizeof(default_types)/sizeof(default_types[0]); i++) {
|
||||||
BMessage *settings = new BMessage();
|
BMessage *settings = new BMessage();
|
||||||
@@ -152,7 +152,7 @@ DefaultManager::SaveState(NodeManager *node_manager)
|
|||||||
BPath path(&ref);
|
BPath path(&ref);
|
||||||
settings->AddInt32(kDefaultManagerAddon, info.addon);
|
settings->AddInt32(kDefaultManagerAddon, info.addon);
|
||||||
settings->AddInt32(kDefaultManagerFlavorId, info.flavor_id);
|
settings->AddInt32(kDefaultManagerFlavorId, info.flavor_id);
|
||||||
settings->AddInt32(kDefaultManagerInput,
|
settings->AddInt32(kDefaultManagerInput,
|
||||||
default_types[i] == kMsgTypeAudioOut ? fPhysicalAudioOutInputID : 0);
|
default_types[i] == kMsgTypeAudioOut ? fPhysicalAudioOutInputID : 0);
|
||||||
settings->AddString(kDefaultManagerFlavorName, info.name);
|
settings->AddString(kDefaultManagerFlavorName, info.name);
|
||||||
settings->AddString(kDefaultManagerPath, path.Path());
|
settings->AddString(kDefaultManagerPath, path.Path());
|
||||||
@@ -170,14 +170,14 @@ DefaultManager::SaveState(NodeManager *node_manager)
|
|||||||
for (int32 i = 0; i < category_count; i++) {
|
for (int32 i = 0; i < category_count; i++) {
|
||||||
BMessage *settings = (BMessage *)list.ItemAt(i);
|
BMessage *settings = (BMessage *)list.ItemAt(i);
|
||||||
uint32 default_type;
|
uint32 default_type;
|
||||||
if (settings->FindInt32(kDefaultManagerType,
|
if (settings->FindInt32(kDefaultManagerType,
|
||||||
(int32*)&default_type) < B_OK)
|
(int32*)&default_type) < B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
if (file.Write(&kMsgHeader, sizeof(uint32)) < (int32)sizeof(uint32))
|
if (file.Write(&kMsgHeader, sizeof(uint32)) < (int32)sizeof(uint32))
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
if (file.Write(&default_type, sizeof(uint32)) < (int32)sizeof(uint32))
|
if (file.Write(&default_type, sizeof(uint32)) < (int32)sizeof(uint32))
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
if(settings->Flatten(&file) < B_OK)
|
if (settings->Flatten(&file) < B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
delete settings;
|
delete settings;
|
||||||
}
|
}
|
||||||
@@ -210,14 +210,14 @@ DefaultManager::Set(media_node_id node_id, const char *input_name,
|
|||||||
case AUDIO_OUTPUT:
|
case AUDIO_OUTPUT:
|
||||||
fPhysicalAudioOut = node_id;
|
fPhysicalAudioOut = node_id;
|
||||||
fPhysicalAudioOutInputID = input_id;
|
fPhysicalAudioOutInputID = input_id;
|
||||||
strcpy(fPhysicalAudioOutInputName,
|
strcpy(fPhysicalAudioOutInputName,
|
||||||
input_name ? input_name : "<null>");
|
input_name ? input_name : "<null>");
|
||||||
return B_OK;
|
return B_OK;
|
||||||
case TIME_SOURCE:
|
case TIME_SOURCE:
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
// called by the media_server's ServerApp::StartSystemTimeSource()
|
// called by the media_server's ServerApp::StartSystemTimeSource()
|
||||||
case SYSTEM_TIME_SOURCE:
|
case SYSTEM_TIME_SOURCE:
|
||||||
{
|
{
|
||||||
ASSERT(fSystemTimeSource == -1);
|
ASSERT(fSystemTimeSource == -1);
|
||||||
fSystemTimeSource = node_id;
|
fSystemTimeSource = node_id;
|
||||||
@@ -304,7 +304,7 @@ DefaultManager::Get(media_node_id *nodeid, char *input_name, int32 *inputid,
|
|||||||
status_t
|
status_t
|
||||||
DefaultManager::Rescan()
|
DefaultManager::Rescan()
|
||||||
{
|
{
|
||||||
thread_id fThreadId = spawn_thread(rescan_thread, "rescan defaults",
|
thread_id fThreadId = spawn_thread(rescan_thread, "rescan defaults",
|
||||||
B_NORMAL_PRIORITY - 2, this);
|
B_NORMAL_PRIORITY - 2, this);
|
||||||
resume_thread(fThreadId);
|
resume_thread(fThreadId);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -384,10 +384,10 @@ DefaultManager::FindPhysical(volatile media_node_id *id, uint32 default_type,
|
|||||||
int32 input_id;
|
int32 input_id;
|
||||||
bool isAudio = type & B_MEDIA_RAW_AUDIO;
|
bool isAudio = type & B_MEDIA_RAW_AUDIO;
|
||||||
|
|
||||||
for(int32 i=0; i<fMsgList.CountItems(); i++) {
|
for (int32 i = 0; i < fMsgList.CountItems(); i++) {
|
||||||
msg = (BMessage *)fMsgList.ItemAt(i);
|
msg = (BMessage *)fMsgList.ItemAt(i);
|
||||||
int32 msgType;
|
int32 msgType;
|
||||||
if(msg->FindInt32(kDefaultManagerType, &msgType) == B_OK
|
if (msg->FindInt32(kDefaultManagerType, &msgType) == B_OK
|
||||||
&& ((uint32)msgType == default_type)) {
|
&& ((uint32)msgType == default_type)) {
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
const char *path = NULL;
|
const char *path = NULL;
|
||||||
@@ -409,10 +409,10 @@ DefaultManager::FindPhysical(volatile media_node_id *id, uint32 default_type,
|
|||||||
count = MAX_NODE_INFOS;
|
count = MAX_NODE_INFOS;
|
||||||
rv = BMediaRoster::Roster()->GetLiveNodes(&info[0], &count,
|
rv = BMediaRoster::Roster()->GetLiveNodes(&info[0], &count,
|
||||||
isInput ? NULL : &format, isInput ? &format : NULL, NULL,
|
isInput ? NULL : &format, isInput ? &format : NULL, NULL,
|
||||||
isInput ? B_BUFFER_PRODUCER | B_PHYSICAL_INPUT
|
isInput ? B_BUFFER_PRODUCER | B_PHYSICAL_INPUT
|
||||||
: B_BUFFER_CONSUMER | B_PHYSICAL_OUTPUT);
|
: B_BUFFER_CONSUMER | B_PHYSICAL_OUTPUT);
|
||||||
if (rv != B_OK || count < 1) {
|
if (rv != B_OK || count < 1) {
|
||||||
ERROR("Couldn't find physical %s %s node\n",
|
ERROR("Couldn't find physical %s %s node\n",
|
||||||
isAudio ? "audio" : "video", isInput ? "input" : "output");
|
isAudio ? "audio" : "video", isInput ? "input" : "output");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -428,18 +428,18 @@ DefaultManager::FindPhysical(volatile media_node_id *id, uint32 default_type,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// skip the Firewire audio driver
|
// skip the Firewire audio driver
|
||||||
if (0 == strcmp(info[i].name, "DV Input"))
|
if (0 == strcmp(info[i].name, "DV Input"))
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
if (0 == strcmp(info[i].name, "None Out")) {
|
if (0 == strcmp(info[i].name, "None Out")) {
|
||||||
// we keep the Null audio driver if none else matchs
|
// we keep the Null audio driver if none else matchs
|
||||||
*id = info[i].node.node;
|
*id = info[i].node.node;
|
||||||
if(msg)
|
if (msg)
|
||||||
fPhysicalAudioOutInputID = input_id;
|
fPhysicalAudioOutInputID = input_id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// skip the Firewire audio driver
|
// skip the Firewire audio driver
|
||||||
if (0 == strcmp(info[i].name, "DV Output"))
|
if (0 == strcmp(info[i].name, "DV Output"))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -518,14 +518,14 @@ DefaultManager::FindTimeSource()
|
|||||||
// The BeOS R5 None Out node pretend to be a physical time source,
|
// The BeOS R5 None Out node pretend to be a physical time source,
|
||||||
// that is pretty dumb
|
// that is pretty dumb
|
||||||
// skip the Null audio driver
|
// skip the Null audio driver
|
||||||
if (0 == strcmp(info[i].name, "None Out"))
|
if (0 == strcmp(info[i].name, "None Out"))
|
||||||
continue;
|
continue;
|
||||||
// skip the Firewire audio driver
|
// skip the Firewire audio driver
|
||||||
if (0 != strstr(info[i].name, "DV Output"))
|
if (0 != strstr(info[i].name, "DV Output"))
|
||||||
continue;
|
continue;
|
||||||
printf("Default DAC timesource \"%s\" created!\n", info[i].name);
|
printf("Default DAC timesource \"%s\" created!\n", info[i].name);
|
||||||
fTimeSource = info[i].node.node;
|
fTimeSource = info[i].node.node;
|
||||||
BMediaRoster::Roster()->StartTimeSource(info[i].node,
|
BMediaRoster::Roster()->StartTimeSource(info[i].node,
|
||||||
system_time() + 1000);
|
system_time() + 1000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -612,7 +612,7 @@ DefaultManager::ConnectMixerToOutput()
|
|||||||
|
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
input = inputs[i];
|
input = inputs[i];
|
||||||
if(input.destination.id == fPhysicalAudioOutInputID)
|
if (input.destination.id == fPhysicalAudioOutInputID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ PPPServer::PPPServer()
|
|||||||
fListener(this)
|
fListener(this)
|
||||||
{
|
{
|
||||||
be_app->AddHandler(this);
|
be_app->AddHandler(this);
|
||||||
|
|
||||||
fListener.WatchManager();
|
fListener.WatchManager();
|
||||||
|
|
||||||
InitInterfaces();
|
InitInterfaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,9 +22,9 @@ PPPServer::PPPServer()
|
|||||||
PPPServer::~PPPServer()
|
PPPServer::~PPPServer()
|
||||||
{
|
{
|
||||||
UninitInterfaces();
|
UninitInterfaces();
|
||||||
|
|
||||||
fListener.StopWatchingManager();
|
fListener.StopWatchingManager();
|
||||||
|
|
||||||
be_app->RemoveHandler(this);
|
be_app->RemoveHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ PPPServer::MessageReceived(BMessage *message)
|
|||||||
case PPP_REPORT_MESSAGE:
|
case PPP_REPORT_MESSAGE:
|
||||||
HandleReportMessage(message);
|
HandleReportMessage(message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BHandler::MessageReceived(message);
|
BHandler::MessageReceived(message);
|
||||||
}
|
}
|
||||||
@@ -61,14 +61,14 @@ void
|
|||||||
PPPServer::HandleReportMessage(BMessage *message)
|
PPPServer::HandleReportMessage(BMessage *message)
|
||||||
{
|
{
|
||||||
ppp_interface_id id;
|
ppp_interface_id id;
|
||||||
if(message->FindInt32("interface", reinterpret_cast<int32*>(&id)) != B_OK)
|
if (message->FindInt32("interface", reinterpret_cast<int32*>(&id)) != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int32 type, code;
|
int32 type, code;
|
||||||
message->FindInt32("type", &type);
|
message->FindInt32("type", &type);
|
||||||
message->FindInt32("code", &code);
|
message->FindInt32("code", &code);
|
||||||
|
|
||||||
if(type == PPP_MANAGER_REPORT && code == PPP_REPORT_INTERFACE_CREATED)
|
if (type == PPP_MANAGER_REPORT && code == PPP_REPORT_INTERFACE_CREATED)
|
||||||
CreateConnectionRequestWindow(id);
|
CreateConnectionRequestWindow(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ PrintServerApp::CreatePrinter(const char* printerName, const char* driverName,
|
|||||||
if (FindPrinterDriver(printerName, tmp) == B_OK) {
|
if (FindPrinterDriver(printerName, tmp) == B_OK) {
|
||||||
if (fDefaultPrinter) {
|
if (fDefaultPrinter) {
|
||||||
// the printer exists, but is not the default printer
|
// the printer exists, but is not the default printer
|
||||||
if(strcmp(fDefaultPrinter->Name(), printerName) != 0)
|
if (strcmp(fDefaultPrinter->Name(), printerName) != 0)
|
||||||
rc = B_OK;
|
rc = B_OK;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user