more style cleanups, removed unused global

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21542 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2007-07-02 20:37:45 +00:00
parent 1bf81a0b8d
commit e1628af583
6 changed files with 46 additions and 60 deletions
+1 -1
View File
@@ -135,7 +135,7 @@ TermApp::Quit()
if (!gUsageRequested){ if (!gUsageRequested){
int status; int status;
kill(-sh_pid, SIGHUP); kill(-gShPid, SIGHUP);
wait(&status); wait(&status);
_UnregisterTerminal(); _UnregisterTerminal();
+2 -2
View File
@@ -1015,7 +1015,7 @@ TermView::UpdateSIGWINCH()
ws.ws_row = fTermRows; ws.ws_row = fTermRows;
ws.ws_col = fTermColumns; ws.ws_col = fTermColumns;
ioctl(fTerminalFd, TIOCSWINSZ, &ws); ioctl(fTerminalFd, TIOCSWINSZ, &ws);
kill(-sh_pid, SIGWINCH); kill(-gShPid, SIGWINCH);
fFrameResized = 0; fFrameResized = 0;
if (fScrRegionSet == 0) if (fScrRegionSet == 0)
@@ -1214,7 +1214,7 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
tcgetattr(fTerminalFd, &tio); tcgetattr(fTerminalFd, &tio);
if (*bytes == tio.c_cc[VINTR]) { if (*bytes == tio.c_cc[VINTR]) {
if (tio.c_lflag & ISIG) if (tio.c_lflag & ISIG)
kill(-sh_pid, SIGINT); kill(-gShPid, SIGINT);
} }
// Terminal changes RET, ENTER, F1...F12, and ARROW key code. // Terminal changes RET, ENTER, F1...F12, and ARROW key code.
+38 -50
View File
@@ -311,7 +311,7 @@ TermWindow::MessageReceived(BMessage *message)
// try launching two different ways to work around possible problems // try launching two different ways to work around possible problems
if (be_roster->Launch(&info.ref)!=B_OK) if (be_roster->Launch(&info.ref)!=B_OK)
be_roster->Launch(TERM_SIGNATURE); be_roster->Launch(TERM_SIGNATURE);
break; break;
} }
case MENU_PREF_OPEN: { case MENU_PREF_OPEN: {
@@ -546,9 +546,9 @@ TermWindow::MessageReceived(BMessage *message)
break; break;
} }
case MSG_FONT_CHANGED: { case MSG_FONT_CHANGED: {
gTermPref->setString (PREF_HALF_FONT_FAMILY, fNewFontMenu->FindMarked()->Label()); gTermPref->setString (PREF_HALF_FONT_FAMILY, fNewFontMenu->FindMarked()->Label());
this->PostMessage (MSG_HALF_FONT_CHANGED); PostMessage (MSG_HALF_FONT_CHANGED);
break; break;
} }
case MSG_COLOR_CHANGED: { case MSG_COLOR_CHANGED: {
fBaseView->SetViewColor (gTermPref->getRGB (PREF_TEXT_BACK_COLOR)); fBaseView->SetViewColor (gTermPref->getRGB (PREF_TEXT_BACK_COLOR));
@@ -604,19 +604,6 @@ TermWindow::QuitRequested()
} }
//! Get Machine Timezone.
int
TermWindow::GetTimeZone()
{
struct timeval tv;
struct timezone tm;
gettimeofday (&tv, &tm);
return -tm.tz_minuteswest / 60;
}
void void
TermWindow::TermWinActivate() TermWindow::TermWinActivate()
{ {
@@ -635,27 +622,30 @@ TermWindow::TermWinActivate()
status_t status_t
TermWindow::GetSupportedSuites(BMessage *msg) TermWindow::GetSupportedSuites(BMessage *msg)
{ {
static property_info prop_list[] = { static property_info propList[] = {
{ "encode", { "encode",
{B_GET_PROPERTY, 0}, {B_GET_PROPERTY, 0},
{B_DIRECT_SPECIFIER, 0}, {B_DIRECT_SPECIFIER, 0},
"get muterminal encode"}, "get muterminal encode"},
{ "encode", { "encode",
{B_SET_PROPERTY, 0}, {B_SET_PROPERTY, 0},
{B_DIRECT_SPECIFIER, 0}, {B_DIRECT_SPECIFIER, 0},
"set muterminal encode"}, "set muterminal encode"},
{ "tty", { "tty",
{B_GET_PROPERTY, 0}, {B_GET_PROPERTY, 0},
{B_DIRECT_SPECIFIER, 0}, {B_DIRECT_SPECIFIER, 0},
"get tty_name."}, "get tty_name."},
{ 0 } { 0 }
}; };
msg->AddString("suites", "suite/vnd.naan-termwindow");
BPropertyInfo prop_info(prop_list); msg->AddString("suites", "suite/vnd.naan-termwindow");
msg->AddFlat("messages", &prop_info); BPropertyInfo propInfo(propList);
return BWindow::GetSupportedSuites(msg); msg->AddFlat("messages", &propInfo);
return BWindow::GetSupportedSuites(msg);
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// ResolveSpecifier // ResolveSpecifier
// //
@@ -665,28 +655,26 @@ TermWindow::ResolveSpecifier(BMessage *msg, int32 index,
BMessage *specifier, int32 form, BMessage *specifier, int32 form,
const char *property) const char *property)
{ {
if ( (strcmp(property, "encode") == 0) if (((strcmp(property, "encode") == 0)
&& ((msg->what == B_SET_PROPERTY) || (msg->what == B_GET_PROPERTY) )) && ((msg->what == B_SET_PROPERTY) || (msg->what == B_GET_PROPERTY)))
return this; || ((strcmp(property, "tty") == 0) && (msg->what == B_GET_PROPERTY)))
else if ( (strcmp(property, "tty") == 0) return this;
&& (msg->what == B_GET_PROPERTY) )
return this;
return BWindow::ResolveSpecifier(msg, index, specifier, form, property); return BWindow::ResolveSpecifier(msg, index, specifier, form, property);
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// SetCoding // SetCoding
// Set coding utility functions. // Set coding utility functions.
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
void SetCoding (int coding) void
SetCoding(int coding)
{ {
const etable *p = encoding_table; const etable *p = encoding_table;
p += coding; p += coding;
gNowCoding = coding; gNowCoding = coding;
return;
} }
-1
View File
@@ -68,7 +68,6 @@ class TermWindow : public BWindow {
private: private:
void InitWindow(); void InitWindow();
void SetupMenu(); void SetupMenu();
int GetTimeZone();
status_t DoPageSetup(); status_t DoPageSetup();
void DoPrint(); void DoPrint();
+4 -4
View File
@@ -112,7 +112,7 @@ typedef struct
/* global variables */ /* global variables */
pid_t sh_pid; pid_t gShPid;
static status_t static status_t
@@ -184,12 +184,12 @@ spawn_shell(int row, int col, const char *command, const char *coding)
thread_id terminalThread = find_thread(NULL); thread_id terminalThread = find_thread(NULL);
/* Fork a child process. */ /* Fork a child process. */
if ((sh_pid = fork()) < 0) { if ((gShPid = fork()) < 0) {
close(master); close(master);
return -1; return -1;
} }
if (sh_pid == 0) { if (gShPid == 0) {
// Now in child process. // Now in child process.
/* /*
@@ -442,7 +442,7 @@ spawn_shell(int row, int col, const char *command, const char *coding)
handshake.row = row; handshake.row = row;
handshake.col = col; handshake.col = col;
handshake.status = PTY_WS; handshake.status = PTY_WS;
send_handshake_message(sh_pid, handshake); send_handshake_message(gShPid, handshake);
break; break;
} }
} }
+1 -2
View File
@@ -87,8 +87,7 @@
int spawn_shell (int, int, const char *, const char *); int spawn_shell (int, int, const char *, const char *);
void Setenv (const char *, const char *); void Setenv (const char *, const char *);
extern pid_t sh_pid; /* shell process ID */ extern pid_t gShPid; /* shell process ID */
extern int gPfd_num; /* number of gPfd */
#endif /* SPAWN_H */ #endif /* SPAWN_H */