diff --git a/Jamconfig.in b/Jamconfig.in index 01b4cf9..a70d42a 100644 --- a/Jamconfig.in +++ b/Jamconfig.in @@ -133,6 +133,9 @@ XKB_LIBS ?= @XKB_LIBS@ ; CURL_CFLAGS ?= @CURL_CFLAGS@ ; CURL_LIBS ?= @CURL_LIBS@ ; +# kstat +KSTAT_LIBS ?= @KSTAT_LIBS@ ; + # platform specific pthread flags # FIXME: a quick hack to work everything on SunStudio if $(SUN_COMPILER) { diff --git a/configure.in b/configure.in index c54a83e..a303a13 100644 --- a/configure.in +++ b/configure.in @@ -257,6 +257,30 @@ else AC_MSG_RESULT(no) fi +dnl kstat/solaris +AC_CHECK_HEADER(kstat.h, [have_kstat_h=yes],) +if test "x$have_kstat_h" = "xyes"; then + AC_MSG_CHECKING([for kstat presence]) + + AC_LANG_SAVE + AC_LANG_C + AC_TRY_COMPILE([ + #include + ],[ + kstat_named_t k; + k.value.ui32; + ],[have_kstat=yes],[]) + AC_LANG_RESTORE + + if test "x$have_kstat" = "xyes"; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_KSTAT, 1, [Define to 1 if you have kstat]) + KSTAT_LIBS=" -lkstat" + else + AC_MSG_RESULT(no) + fi +fi + dnl pekwm specific macros EDE_CHECK_PEKWM_DEPENDENCIES @@ -277,6 +301,7 @@ AC_SUBST(CURL_LIBS) AC_SUBST(LARGEFILE) AC_SUBST(XKB_LIBS) AC_SUBST(my_sysconfdir) +AC_SUBST(KSTAT_LIBS) AC_SUBST(PEKWM_CXXFLAGS) AC_SUBST(PEKWM_LIBS) diff --git a/ede-panel/AppletManager.cpp b/ede-panel/AppletManager.cpp index 9cdaa53..7ff73d1 100644 --- a/ede-panel/AppletManager.cpp +++ b/ede-panel/AppletManager.cpp @@ -55,10 +55,6 @@ static void clear_applet(AppletData *a) { delete a; } -AppletManager::~AppletManager() { - clear(); -} - bool AppletManager::load(const char *path) { dlerror(); const char *dl_err = NULL; @@ -130,11 +126,12 @@ bool AppletManager::load(const char *path) { return true; } -void AppletManager::clear(void) { +void AppletManager::clear(Panel *p) { E_RETURN_IF_FAIL(applet_list.size() > 0); AListIter it = applet_list.begin(), ite = applet_list.end(); while(it != ite) { + p->remove((*it)->awidget); clear_applet(*it); it = applet_list.erase(it); } diff --git a/ede-panel/AppletManager.h b/ede-panel/AppletManager.h index b514c4b..2debe33 100644 --- a/ede-panel/AppletManager.h +++ b/ede-panel/AppletManager.h @@ -36,9 +36,8 @@ class AppletManager { private: AList applet_list; public: - ~AppletManager(); bool load(const char *path); - void clear(void); + void clear(Panel *p); void fill_group(Panel *p); void unfill_group(Panel *p); diff --git a/ede-panel/Jamfile b/ede-panel/Jamfile index dbc6e6a..6e93da9 100644 --- a/ede-panel/Jamfile +++ b/ede-panel/Jamfile @@ -30,13 +30,13 @@ rule PanelApplet } # append default extension - target = $(<:S=$(SUFLIB_SHARED)) ; + target = $(1:S=$(SUFLIB_SHARED)) ; - Main $(target) : $(>) ; - ObjectC++Flags $(>) : $(GLOBALFLAGS) -fPIC $(FLTKINCLUDE) -I [ FDirName $(TOP) ede-panel ] $(EDELIBINCLUDE) ; + Main $(target) : $(2) ; + ObjectC++Flags $(2) : $(GLOBALFLAGS) -fPIC $(FLTKINCLUDE) -I [ FDirName $(TOP) ede-panel ] $(EDELIBINCLUDE) ; LinkAgainst $(target) : $(3) $(EDELIBLIB) $(EDELIB_GUI_LIB) $(FLTKLIB) $(STDLIB) ; - LINKFLAGS on $(target) = $(linker_stuff) [ on $(target) return $(LINKFLAGS) ] ; + LINKFLAGS on $(target) = $(linker_stuff) [ on $(target) return $(LINKFLAGS) ] $(3) ; InstallProgram $(EDE_PANEL_APPLETS_DIR) : $(target) ; diff --git a/ede-panel/Panel.cpp b/ede-panel/Panel.cpp index c974ee0..ad76baf 100644 --- a/ede-panel/Panel.cpp +++ b/ede-panel/Panel.cpp @@ -387,10 +387,13 @@ void Panel::hide(void) { E_DEBUG("Panel::hide()\n"); - /* strange; this is not called when panel goes out :S */ - mgr.clear(); - save_config(); + /* clear loaded widgets */ + mgr.clear(this); + /* clear whatever was left out, but was not part of applet manager */ + clear(); + + save_config(); Fl_Window::hide(); } diff --git a/ede-panel/applets/cpu-monitor/CpuMonitor.cpp b/ede-panel/applets/cpu-monitor/CpuMonitor.cpp index 00caa28..ddf01dd 100644 --- a/ede-panel/applets/cpu-monitor/CpuMonitor.cpp +++ b/ede-panel/applets/cpu-monitor/CpuMonitor.cpp @@ -9,6 +9,10 @@ * For ede-panel by Sanel Zukan 2009 */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -26,8 +30,10 @@ # include #endif -#ifdef HAVE_KSTAT_H +#ifdef HAVE_KSTAT # include +# include +# include /* strncmp */ #endif #ifdef __FreeBSD__ @@ -335,11 +341,10 @@ void CPUMonitor::get_cpu_info() { #endif /* linux */ -#ifdef HAVE_KSTAT_H +#ifdef HAVE_KSTAT # ifdef HAVE_OLD_KSTAT # define ui32 ul #endif - static kstat_ctl_t *kc = NULL; static kid_t kcid; kid_t new_kcid; diff --git a/ede-panel/applets/cpu-monitor/Jamfile b/ede-panel/applets/cpu-monitor/Jamfile index 316b98f..2a95868 100644 --- a/ede-panel/applets/cpu-monitor/Jamfile +++ b/ede-panel/applets/cpu-monitor/Jamfile @@ -10,4 +10,4 @@ SubDir TOP ede-panel applets cpu-monitor ; -PanelApplet cpu_monitor : CpuMonitor.cpp ; +PanelApplet cpu_monitor : CpuMonitor.cpp : $(KSTAT_LIBS) ; diff --git a/ede-panel/applets/start-menu/StartMenu.cpp b/ede-panel/applets/start-menu/StartMenu.cpp index b324f4d..10405a9 100644 --- a/ede-panel/applets/start-menu/StartMenu.cpp +++ b/ede-panel/applets/start-menu/StartMenu.cpp @@ -184,9 +184,8 @@ void StartMenu::popup(void) { pressed_menu_button = this; redraw(); - Fl_Widget *mb = this; - #if (FL_MAJOR_VERSION >= 1) && (FL_MINOR_VERSION >= 3) + Fl_Widget *mb = this; Fl::watch_widget_pointer(mb); #endif @@ -287,7 +286,7 @@ bool StartMenu::can_reload(void) { time_t c, diff; c = time(NULL); - diff = difftime(c, last_reload); + diff = (time_t)difftime(c, last_reload); last_reload = c; if(diff >= MENU_UPDATE_DIFF) return true;