Skip to content

Commit

Permalink
ProcessController: Remove hacks from BeOS days.
Browse files Browse the repository at this point in the history
  • Loading branch information
waddlesplash committed Jul 23, 2015
1 parent 2090ed1 commit aa6f1cb
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 151 deletions.
29 changes: 13 additions & 16 deletions src/apps/processcontroller/AutoIcon.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
ProcessController © 2000, Georges-Edouard Berenger, All Rights Reserved.
Copyright (C) 2004 beunited.org
Copyright (C) 2004 beunited.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/


Expand All @@ -38,11 +38,8 @@ BBitmap*
AutoIcon::Bitmap()
{
if (fBitmap == NULL) {
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_RGBA32);
#else
fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8);
#endif

if (fSignature) {
entry_ref ref;
be_roster->FindApp (fSignature, &ref);
Expand Down
43 changes: 13 additions & 30 deletions src/apps/processcontroller/IconMenuItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
ProcessController
(c) 2000, Georges-Edouard Berenger, All Rights Reserved.
Copyright (C) 2004 beunited.org
Copyright (C) 2004 beunited.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

Expand All @@ -27,7 +27,6 @@
#include <NodeInfo.h>
#include <Bitmap.h>
#include <Roster.h>
#include <parsedate.h>


IconMenuItem::IconMenuItem(BBitmap* icon, const char* title,
Expand Down Expand Up @@ -155,22 +154,6 @@ int IconMenuItem::MinHeight()
{
static int minheight = -1;
if (minheight < 0)
minheight = before_dano() ? 16 : 17;
minheight = 17;
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;
}
26 changes: 12 additions & 14 deletions src/apps/processcontroller/IconMenuItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
ProcessController
(c) 2000, Georges-Edouard Berenger, All Rights Reserved.
Copyright (C) 2004 beunited.org
Copyright (C) 2004 beunited.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _ICON_MENU_ITEM_H_
Expand Down Expand Up @@ -57,6 +57,4 @@ class IconMenuItem : public BMenuItem {
bool fPurge;
};

bool before_dano();

#endif // _ICON_MENU_ITEM_H_
62 changes: 0 additions & 62 deletions src/apps/processcontroller/ProcessController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,69 +921,7 @@ status_t
thread_debug_thread(void *arg)
{
Tdebug_thead_param* param = (Tdebug_thead_param*) arg;
#ifdef __HAIKU__
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;
return B_OK;
}
42 changes: 13 additions & 29 deletions src/apps/processcontroller/Utilities.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
ProcessController © 2000, Georges-Edouard Berenger, All Rights Reserved.
Copyright (C) 2004 beunited.org
Copyright (C) 2004 beunited.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/


Expand All @@ -23,9 +23,7 @@
#include "ProcessController.h"
#include "icons.h"

#ifdef __HAIKU__
#include <AppMisc.h>
#endif
#include <AppMisc.h>
#include <Alert.h>
#include <Bitmap.h>
#include <Deskbar.h>
Expand Down Expand Up @@ -67,18 +65,8 @@ get_team_name_and_icon(info_pack& infoPack, bool icon)
get_ref_for_path(kernelPath.Path(), &info.ref);
nameFromArgs = true;
} else {
#ifdef __HAIKU__
status = BPrivate::get_app_ref(infoPack.team_info.team, &info.ref);
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);
}
}
Expand All @@ -87,11 +75,7 @@ get_team_name_and_icon(info_pack& infoPack, bool icon)
B_PATH_NAME_LENGTH - 1);

if (icon) {
#ifdef __HAIKU__
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
|| BNodeInfo::GetTrackerIcon(&info.ref, infoPack.team_icon,
B_MINI_ICON) != B_OK) {
Expand Down

0 comments on commit aa6f1cb

Please sign in to comment.