ProcessController: Remove hacks from BeOS days.

This commit is contained in:
Augustin Cavalier
2015-07-23 11:50:26 -04:00
parent 2090ed133e
commit aa6f1cbe86
5 changed files with 51 additions and 151 deletions
+1 -4
View File
@@ -38,11 +38,8 @@ BBitmap*
AutoIcon::Bitmap() AutoIcon::Bitmap()
{ {
if (fBitmap == NULL) { if (fBitmap == NULL) {
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_RGBA32); fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_RGBA32);
#else
fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8);
#endif
if (fSignature) { if (fSignature) {
entry_ref ref; entry_ref ref;
be_roster->FindApp (fSignature, &ref); be_roster->FindApp (fSignature, &ref);
+1 -18
View File
@@ -27,7 +27,6 @@
#include <NodeInfo.h> #include <NodeInfo.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Roster.h> #include <Roster.h>
#include <parsedate.h>
IconMenuItem::IconMenuItem(BBitmap* icon, const char* title, IconMenuItem::IconMenuItem(BBitmap* icon, const char* title,
@@ -155,22 +154,6 @@ int IconMenuItem::MinHeight()
{ {
static int minheight = -1; static int minheight = -1;
if (minheight < 0) if (minheight < 0)
minheight = before_dano() ? 16 : 17; minheight = 17;
return minheight; return minheight;
} }
bool
before_dano()
{
static int old_version = -1;
if (old_version < 0) {
system_info sys_info;
get_system_info(&sys_info);
time_t kernelTime = parsedate(sys_info.kernel_build_date, time(NULL));
struct tm* date = gmtime(&kernelTime);
old_version = (date->tm_year < 101 || (date->tm_year == 101 && date->tm_mon < 10));
}
return old_version;
}
@@ -57,6 +57,4 @@ class IconMenuItem : public BMenuItem {
bool fPurge; bool fPurge;
}; };
bool before_dano();
#endif // _ICON_MENU_ITEM_H_ #endif // _ICON_MENU_ITEM_H_
@@ -921,69 +921,7 @@ status_t
thread_debug_thread(void *arg) thread_debug_thread(void *arg)
{ {
Tdebug_thead_param* param = (Tdebug_thead_param*) arg; Tdebug_thead_param* param = (Tdebug_thead_param*) arg;
#ifdef __HAIKU__
debug_thread(param->thread); debug_thread(param->thread);
#else // !__HAIKU__
thread_info thinfo;
get_thread_info(param->thread, &thinfo);
char text[4096];
sprintf(text, "db %d", int(param->thread));
system(text);
if (param->sem >= 0 && thinfo.state == B_THREAD_WAITING && param->sem
== thinfo.sem) {
snooze(1000000);
get_thread_info(param->thread, &thinfo);
if (thinfo.state == B_THREAD_WAITING
&& param->sem == thinfo.sem
&& param->totalTime == thinfo.user_time + thinfo.kernel_time) {
// the thread has been waiting for this semaphore since the before
// the alert, not doing anything... Let's push it out of there!
sem_info sinfo;
thread_info thinfo;
info_pack infos;
if (get_sem_info(param->sem, &sinfo) == B_OK
&& get_thread_info(param->thread, &thinfo) == B_OK
&& get_team_info(thinfo.team, &infos.team_info) == B_OK) {
sprintf (text, "This thread is waiting for the "
"semaphore called \"%s\". As long as it waits for this "
"semaphore, you won't be able to debug that thread.\n",
sinfo.name);
if (sinfo.team == thinfo.team)
strcat(text, "This semaphore belongs to the "
"thread's team.\n\nShould I release this semaphore?\n");
else {
get_team_name_and_icon(infos);
char moreText[1024];
sprintf(moreText, "\nWARNING! This semaphore "
"belongs to the team \"%s\"!\n\nShould I release this "
"semaphore anyway?\n",
infos.team_name);
strcat(text, moreText);
}
BAlert* alert = new BAlert("", text, "Cancel", "Release",
NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go()) {
get_thread_info (param->thread, &thinfo);
if (thinfo.state == B_THREAD_WAITING && param->sem
== thinfo.sem
&& param->totalTime == thinfo.user_time
+ thinfo.kernel_time)
release_sem(param->sem);
else {
alert = new BAlert("", "The semaphore wasn't released, "
"because it wasn't necessary anymore!",
"OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
}
}
}
}
}
#endif // !__HAIKU__
delete param; delete param;
return B_OK; return B_OK;
} }
-16
View File
@@ -23,9 +23,7 @@
#include "ProcessController.h" #include "ProcessController.h"
#include "icons.h" #include "icons.h"
#ifdef __HAIKU__
#include <AppMisc.h> #include <AppMisc.h>
#endif
#include <Alert.h> #include <Alert.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Deskbar.h> #include <Deskbar.h>
@@ -67,18 +65,8 @@ get_team_name_and_icon(info_pack& infoPack, bool icon)
get_ref_for_path(kernelPath.Path(), &info.ref); get_ref_for_path(kernelPath.Path(), &info.ref);
nameFromArgs = true; nameFromArgs = true;
} else { } else {
#ifdef __HAIKU__
status = BPrivate::get_app_ref(infoPack.team_info.team, &info.ref); status = BPrivate::get_app_ref(infoPack.team_info.team, &info.ref);
nameFromArgs = true; nameFromArgs = true;
#else
BEntry entry(infoPack.team_info.args, true);
status = entry.GetRef(&info.ref);
if (status != B_OK
|| strncmp(infoPack.team_info.args, systemPath.Path(),
strlen(systemPath.Path())) != 0)
nameFromArgs = true;
#endif
tryTrackerIcon = (status == B_OK); tryTrackerIcon = (status == B_OK);
} }
} }
@@ -87,11 +75,7 @@ get_team_name_and_icon(info_pack& infoPack, bool icon)
B_PATH_NAME_LENGTH - 1); B_PATH_NAME_LENGTH - 1);
if (icon) { if (icon) {
#ifdef __HAIKU__
infoPack.team_icon = new BBitmap(BRect(0, 0, 15, 15), B_RGBA32); infoPack.team_icon = new BBitmap(BRect(0, 0, 15, 15), B_RGBA32);
#else
infoPack.team_icon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8);
#endif
if (!tryTrackerIcon if (!tryTrackerIcon
|| BNodeInfo::GetTrackerIcon(&info.ref, infoPack.team_icon, || BNodeInfo::GetTrackerIcon(&info.ref, infoPack.team_icon,
B_MINI_ICON) != B_OK) { B_MINI_ICON) != B_OK) {