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,23 +36,23 @@ 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;
|
||||||
@@ -62,45 +62,46 @@ static status_t GetSetting(
|
|||||||
|
|
||||||
|
|
||||||
// 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;
|
||||||
@@ -110,14 +111,14 @@ static status_t GetNthSupportedSetting(
|
|||||||
|
|
||||||
|
|
||||||
// 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;
|
||||||
@@ -127,22 +128,22 @@ status_t GetSwapDisplays(
|
|||||||
|
|
||||||
|
|
||||||
// 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;
|
||||||
@@ -151,32 +152,35 @@ status_t GetUseLaptopPanel(
|
|||||||
|
|
||||||
|
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ Angle::InvTangent(float value)
|
|||||||
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
|
||||||
|
|||||||
@@ -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,16 +53,13 @@ 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);
|
||||||
|
|
||||||
@@ -83,18 +76,16 @@ LEDAnimation::AnimationThread(void* data)
|
|||||||
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));
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ DefaultManager::SaveState(NodeManager *node_manager)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
@@ -434,7 +434,7 @@ DefaultManager::FindPhysical(volatile media_node_id *id, uint32 default_type,
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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