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:
Jérôme Duval
2010-04-13 22:33:01 +00:00
parent d9590f1cc2
commit 2d73faba95
7 changed files with 137 additions and 141 deletions
+2 -1
View File
@@ -231,7 +231,8 @@ ScreenMode::GetOriginalMode(screen_mode& mode, int32 workspace) const
{
if (workspace == ~0)
workspace = current_workspace();
else if(workspace > 31)
// TODO this should use kMaxWorkspaces
else if (workspace > 31)
return B_BAD_INDEX;
mode = fOriginal[workspace];
+47 -43
View File
@@ -18,10 +18,10 @@
// prepare parameters so they recognized as tunneled settings
static void PrepareTunnel(
display_mode *mode, display_mode *low, display_mode *high )
static void
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
mode->space = low->space = high->space = 0;
@@ -36,23 +36,23 @@ static void PrepareTunnel(
// retrieve value of setting "code"
static status_t GetSetting(
BScreen *screen, uint16 code, uint32 *setting )
static status_t
GetSetting(BScreen *screen, uint16 code, uint32 *setting)
{
display_mode mode, low, high;
status_t result;
result = TestMultiMonSupport( screen );
if( result != B_OK )
result = TestMultiMonSupport(screen);
if (result != B_OK)
return result;
PrepareTunnel( &mode, &low, &high );
PrepareTunnel(&mode, &low, &high);
mode.h_display_start = code;
mode.v_display_start = 0;
result = screen->ProposeMode( &mode, &low, &high );
if( result != B_OK )
result = screen->ProposeMode(&mode, &low, &high);
if (result != B_OK)
return result;
*setting = mode.timing.flags;
@@ -62,45 +62,46 @@ static status_t GetSetting(
// set setting "code" to "value"
static status_t SetSetting(
BScreen *screen, uint16 code, uint32 value )
static status_t
SetSetting(BScreen *screen, uint16 code, uint32 value)
{
display_mode mode, low, high;
status_t result;
result = TestMultiMonSupport( screen );
if( result != B_OK )
result = TestMultiMonSupport(screen);
if (result != B_OK)
return result;
PrepareTunnel( &mode, &low, &high );
PrepareTunnel(&mode, &low, &high);
mode.h_display_start = code;
mode.v_display_start = 1;
mode.timing.flags = value;
return screen->ProposeMode( &mode, &low, &high );
return screen->ProposeMode(&mode, &low, &high);
}
// retrieve n-th supported value of setting "code"
static status_t GetNthSupportedSetting(
BScreen *screen, uint16 code, int32 idx, uint32 *setting )
static status_t
GetNthSupportedSetting(BScreen *screen, uint16 code, int32 idx,
uint32 *setting)
{
display_mode mode, low, high;
status_t result;
result = TestMultiMonSupport( screen );
if( result != B_OK )
result = TestMultiMonSupport(screen);
if (result != B_OK)
return result;
PrepareTunnel( &mode, &low, &high );
PrepareTunnel(&mode, &low, &high);
mode.h_display_start = code;
mode.v_display_start = 2;
mode.timing.flags = idx;
result = screen->ProposeMode( &mode, &low, &high );
if( result != B_OK )
result = screen->ProposeMode(&mode, &low, &high);
if (result != B_OK)
return result;
*setting = mode.timing.flags;
@@ -110,14 +111,14 @@ static status_t GetNthSupportedSetting(
// get current Swap Displays settings
status_t GetSwapDisplays(
BScreen *screen, bool *swap )
status_t
GetSwapDisplays(BScreen *screen, bool *swap)
{
status_t result;
uint32 tmp;
result = GetSetting( screen, ms_swap, &tmp );
if( result != B_OK )
result = GetSetting(screen, ms_swap, &tmp);
if (result != B_OK)
return result;
*swap = tmp != 0;
@@ -127,22 +128,22 @@ status_t GetSwapDisplays(
// set "Swap Displays"
status_t SetSwapDisplays(
BScreen *screen, bool swap )
status_t
SetSwapDisplays(BScreen *screen, bool swap)
{
return SetSetting( screen, ms_swap, swap );
return SetSetting(screen, ms_swap, swap);
}
// get current "Use Laptop Panel" settings
status_t GetUseLaptopPanel(
BScreen *screen, bool *use )
status_t
GetUseLaptopPanel(BScreen *screen, bool *use)
{
status_t result;
uint32 tmp;
result = GetSetting( screen, ms_use_laptop_panel, &tmp );
if( result != B_OK )
result = GetSetting(screen, ms_use_laptop_panel, &tmp);
if (result != B_OK)
return result;
*use = tmp != 0;
@@ -151,32 +152,35 @@ status_t GetUseLaptopPanel(
// set "Use Laptop Panel"
status_t SetUseLaptopPanel(
BScreen *screen, bool use )
status_t
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
status_t GetNthSupportedTVStandard( BScreen *screen, int idx, uint32 *standard )
status_t
GetNthSupportedTVStandard(BScreen *screen, int idx, uint32 *standard)
{
return GetNthSupportedSetting(
screen, ms_tv_standard, (int32)idx, standard );
screen, ms_tv_standard, (int32)idx, standard);
}
// 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
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);
}
+1 -1
View File
@@ -182,7 +182,7 @@ Angle::InvTangent(float value)
while (value > sTanTable[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); // value is closer to previous
+17 -26
View File
@@ -1,31 +1,29 @@
#include "LEDAnimation.h"
#include <InterfaceDefs.h>
#define SNOOZE_TIME 150000
#include <stdio.h>
/***********************************************************
* Constructor
***********************************************************/
#define SNOOZE_TIME 150000
LEDAnimation::LEDAnimation()
:fThread(-1)
,fRunning(false)
,fOrigModifiers(::modifiers())
:
fThread(-1),
fRunning(false),
fOrigModifiers(::modifiers())
{
}
/***********************************************************
* Destructor
***********************************************************/
LEDAnimation::~LEDAnimation()
{
Stop();
}
/***********************************************************
* Start
***********************************************************/
void
LEDAnimation::Start()
{
@@ -40,9 +38,7 @@ LEDAnimation::Start()
::resume_thread(fThread);
}
/***********************************************************
* Stop
***********************************************************/
void
LEDAnimation::Stop()
{
@@ -57,16 +53,13 @@ LEDAnimation::Stop()
::set_keyboard_locks(fOrigModifiers);
}
/***********************************************************
* AnimationThread
***********************************************************/
int32
LEDAnimation::AnimationThread(void* data)
{
LEDAnimation *anim = (LEDAnimation*)data;
while (anim->fRunning)
{
while (anim->fRunning) {
LED(B_NUM_LOCK,true);
LED(B_NUM_LOCK,false);
@@ -83,18 +76,16 @@ LEDAnimation::AnimationThread(void* data)
return 0;
}
/***********************************************************
* LED
***********************************************************/
void
LEDAnimation::LED(uint32 mod,bool on)
{
uint32 current_modifiers = ::modifiers();
if(on)
if (on)
current_modifiers |= mod;
else
current_modifiers &= ~mod;
::set_keyboard_locks(current_modifiers);
if(on)
if (on)
::snooze(SNOOZE_TIME);
}
+8 -8
View File
@@ -78,7 +78,7 @@ DefaultManager::LoadState()
CALLED();
status_t err = B_OK;
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;
path.Append(kDefaultManagerSettingsDirectory);
@@ -102,7 +102,7 @@ DefaultManager::LoadState()
return B_ERROR;
if (file.Read(&default_type, sizeof(uint32)) < (int32)sizeof(uint32))
return B_ERROR;
if(settings.Unflatten(&file)==B_OK) {
if (settings.Unflatten(&file) == B_OK) {
settings.PrintToStream();
fMsgList.AddItem(new BMessage(settings));
}
@@ -177,7 +177,7 @@ DefaultManager::SaveState(NodeManager *node_manager)
return B_ERROR;
if (file.Write(&default_type, sizeof(uint32)) < (int32)sizeof(uint32))
return B_ERROR;
if(settings->Flatten(&file) < B_OK)
if (settings->Flatten(&file) < B_OK)
return B_ERROR;
delete settings;
}
@@ -304,7 +304,7 @@ DefaultManager::Get(media_node_id *nodeid, char *input_name, int32 *inputid,
status_t
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);
resume_thread(fThreadId);
return B_OK;
@@ -384,10 +384,10 @@ DefaultManager::FindPhysical(volatile media_node_id *id, uint32 default_type,
int32 input_id;
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);
int32 msgType;
if(msg->FindInt32(kDefaultManagerType, &msgType) == B_OK
if (msg->FindInt32(kDefaultManagerType, &msgType) == B_OK
&& ((uint32)msgType == default_type)) {
const char *name = NULL;
const char *path = NULL;
@@ -434,7 +434,7 @@ DefaultManager::FindPhysical(volatile media_node_id *id, uint32 default_type,
if (0 == strcmp(info[i].name, "None Out")) {
// we keep the Null audio driver if none else matchs
*id = info[i].node.node;
if(msg)
if (msg)
fPhysicalAudioOutInputID = input_id;
continue;
}
@@ -612,7 +612,7 @@ DefaultManager::ConnectMixerToOutput()
for (int32 i = 0; i < count; i++) {
input = inputs[i];
if(input.destination.id == fPhysicalAudioOutInputID)
if (input.destination.id == fPhysicalAudioOutInputID)
break;
}
+2 -2
View File
@@ -61,14 +61,14 @@ void
PPPServer::HandleReportMessage(BMessage *message)
{
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;
int32 type, code;
message->FindInt32("type", &type);
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);
}
+1 -1
View File
@@ -421,7 +421,7 @@ PrintServerApp::CreatePrinter(const char* printerName, const char* driverName,
if (FindPrinterDriver(printerName, tmp) == B_OK) {
if (fDefaultPrinter) {
// the printer exists, but is not the default printer
if(strcmp(fDefaultPrinter->Name(), printerName) != 0)
if (strcmp(fDefaultPrinter->Name(), printerName) != 0)
rc = B_OK;
return rc;
}