Merged changed pkg.m4 from edelib

ede-panel has alternative way of calling ede-about dialog

Dumped SettingsApplicator.* code from evoke. They are replaced with ede-settings-apply script
which should call all programs that needs to apply stored settings. This will reduce code entropy

evoke will call ede-settings-apply at the startup

ede-bell-conf modified to use "--apply" arg and to apply known settings

ede-desktop will start icon exec path via ede-launch

Fixed freebsd specific code in ede-panel's battery code
This commit is contained in:
Sanel Zukan 2009-03-03 11:47:30 +00:00
parent 4705a79876
commit 2ea73b6996
17 changed files with 132 additions and 163 deletions

View File

@ -86,5 +86,11 @@ COMPOSITELIB ?= @COMPOSITE_LIBS@ ;
HALINCLUDE ?= @HAL_CFLAGS@ ;
HALLIB ?= @HAL_LIBS@ ;
# X libraries (could be empty if are on standard paths)
X_CFLAGS ?= @X_CFLAGS@ ;
X_LIBS ?= @X_LIBS@ ;
X_PRE_LIBS ?= @X_PRE_LIBS@ ;
X_EXTRA_LIBS ?= @X_EXTRA_LIBS@ ;
# do not touch this
JAMCONFIG_READ = "yes" ;

View File

@ -48,7 +48,8 @@ AC_PATH_PROG(XGETTEXT, xgettext)
AC_PATH_PROG(GDB, gdb)
AC_PATH_PROG(PYTHON, python)
AC_PATH_X
dnl X_CFLAGS, X_PRE_LIBS, X_LIBS, X_EXTRA_LIBS are replaced iff
dnl X are on nonstandard paths
AC_PATH_XTRA
AC_HEADER_STDC
@ -79,7 +80,7 @@ if test "$enable_shape" = "yes"; then
fi
if test "$enable_composite" = "yes"; then
PKG_CHECK_MODULES(COMPOSITE, [xcomposite, xdamage, xext], [have_xcomposite=yes],)
PKG_CHECK_MODULES(COMPOSITE, [xcomposite, xdamage, xext], [have_xcomposite=yes], [have_composite=no])
if test "$have_xcomposite" = "yes"; then
AC_DEFINE(HAVE_COMPOSITE, 1, [Define to 1 if you have Xcomposite extension])
@ -87,7 +88,7 @@ if test "$enable_composite" = "yes"; then
fi
if test "$enable_hal" = "yes"; then
PKG_CHECK_MODULES(HAL, [hal, hal-storage], [have_hal=yes],)
PKG_CHECK_MODULES(HAL, [hal, hal-storage], [have_hal=yes], [have_hal=no])
if test "$have_hal" = "yes"; then
AC_DEFINE(HAVE_HAL, 1, [Define to 1 if you have HAL libraries])

View File

@ -32,6 +32,7 @@ Programs
Development
- link:
- link:HACKING.html[Contributing (in your spare time ;-)]
- link:jambuild.html[Jam build]
- link:dbus-usage.html[D-BUS usage]

View File

@ -34,13 +34,17 @@ EDELIB_NS_USING(XSETTINGS_ACTION_CHANGED)
EDELIB_NS_USING(XSETTINGS_ACTION_DELETED)
EDELIB_NS_USING(XSETTINGS_TYPE_INT)
static Fl_Value_Slider* vol_slide;
static Fl_Value_Slider* pitch_slide;
static Fl_Value_Slider* dur_slide;
static Fl_Value_Slider* vol_slide = NULL;
static Fl_Value_Slider* pitch_slide = NULL;
static Fl_Value_Slider* dur_slide = NULL;
static edelib::Window* win;
static XSettingsClient* xsc;
static unsigned int vol_val;
static unsigned int pitch_val;
static unsigned int dur_val;
static bool block_xsettings_cb = false;
#define CHECK_SETTING(n, setting, action) (strcmp(setting->name, n) == 0) && \
@ -53,7 +57,8 @@ static bool block_xsettings_cb = false;
static int xevent_handler(int e) {
if(xsc)
xsc->process_xevent(fl_xevent);
return 1;
/* make sure to return 0 so other events could be processed */
return 0;
}
static void xsettings_cb(const char* name, XSettingsAction a, XSettingsSetting* s, void* data) {
@ -63,30 +68,49 @@ static void xsettings_cb(const char* name, XSettingsAction a, XSettingsSetting*
if(block_xsettings_cb)
return;
if(CHECK_SETTING(KEY_VOLUME, s, a))
vol_slide->value(s->data.v_int);
if(CHECK_SETTING(KEY_PITCH, s, a))
pitch_slide->value(s->data.v_int);
if(CHECK_SETTING(KEY_DURATION, s, a))
dur_slide->value(s->data.v_int);
if(CHECK_SETTING(KEY_VOLUME, s, a)) {
vol_val = s->data.v_int;
if(vol_slide)
vol_slide->value(vol_val);
}
if(CHECK_SETTING(KEY_PITCH, s, a)) {
pitch_val = s->data.v_int;
if(pitch_slide)
pitch_slide->value(pitch_val);
}
if(CHECK_SETTING(KEY_DURATION, s, a)) {
dur_val = s->data.v_int;
if(dur_slide)
dur_slide->value(dur_val);
}
}
static void apply_values(void) {
unsigned long v = KBBellPercent | KBBellPitch | KBBellDuration;
XKeyboardControl kc;
kc.bell_percent = vol_val;
kc.bell_pitch = pitch_val;
kc.bell_duration = dur_val;
XChangeKeyboardControl(fl_display, v, &kc);
}
static void set_values(bool save) {
unsigned long v = KBBellPercent | KBBellPitch | KBBellDuration;
XKeyboardControl kc;
kc.bell_percent = (unsigned int)vol_slide->value();
kc.bell_pitch = (unsigned int)pitch_slide->value();
kc.bell_duration = (unsigned int)dur_slide->value();
vol_val = (unsigned int)vol_slide->value();
pitch_val = (unsigned int)pitch_slide->value();
dur_val = (unsigned int)dur_slide->value();
XChangeKeyboardControl(fl_display, v, &kc);
apply_values();
if(save && xsc) {
/* disable callback, since modifying the value will trigger it */
block_xsettings_cb = true;
xsc->set(KEY_VOLUME, (unsigned int)vol_slide->value());
xsc->set(KEY_PITCH, (unsigned int)pitch_slide->value());
xsc->set(KEY_DURATION, (unsigned int)dur_slide->value());
xsc->set(KEY_VOLUME, vol_val);
xsc->set(KEY_PITCH, pitch_val);
xsc->set(KEY_DURATION, dur_val);
xsc->manager_notify();
block_xsettings_cb = false;
@ -107,7 +131,7 @@ static void test_cb(Fl_Widget*, void*) {
XBell(fl_display, 0);
}
int main(int argc, char **argv) {
static void window_create(int argc, char** argv) {
win = new edelib::Window(330, 210, _("System bell configuration"));
win->begin();
vol_slide = new Fl_Value_Slider(10, 30, 310, 25, _("Volume"));
@ -140,13 +164,37 @@ int main(int argc, char **argv) {
test->callback(test_cb);
win->end();
win->show(argc, argv);
}
int main(int argc, char **argv) {
bool win_show = true;
if(argc > 1 && strcmp(argv[1], "--apply") == 0)
win_show = false;
if(win_show) {
window_create(argc, argv);
Fl::add_handler(xevent_handler);
} else {
/* if window is not going to be shown, we still have to open display */
fl_open_display();
}
/* if window is not shown, xsettings_cb will be triggered anyway */
XSettingsClient x;
if(!x.init(fl_display, fl_screen, xsettings_cb, NULL))
xsc = NULL;
else
xsc = &x;
Fl::add_handler(xevent_handler);
if(!win_show) {
if(xsc) {
apply_values();
XSync(fl_display, False);
}
return 0;
}
return Fl::run();
}

View File

@ -27,22 +27,10 @@
#include <edelib/Window.h>
#include <edelib/MessageBox.h>
#include <edelib/Run.h>
#include <edelib/File.h>
typedef edelib::list<edelib::String> StrList;
typedef edelib::list<edelib::String>::iterator StrListIter;
static bool file_can_execute(const edelib::String& f) {
if(edelib::file_executable(f.c_str()))
return true;
/* find full path then */
edelib::String fp = edelib::file_path(f.c_str());
if(fp.empty())
return false;
return edelib::file_executable(fp.c_str());
}
class ControlButton : public Fl_Button {
private:
Fl_Box* tipbox;
@ -81,10 +69,8 @@ int ControlButton::handle(int event) {
if(Fl::event_clicks()) {
if(exec.empty())
edelib::alert(_("Unable to execute command for '%s'. Command value is not set"), label());
else if(!file_can_execute(exec.c_str()))
edelib::alert(_("Unable to run program '%s'. Program not found"), exec.c_str());
else
edelib::run_async(exec.c_str());
edelib::run_async("ede-launch %s", exec.c_str());
}
return 1;

View File

@ -10,6 +10,10 @@
* See COPYING for details.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icons/core.xpm"
#include "CrashDialog.h"
@ -166,7 +170,7 @@ void CrashDialog::show_details(void) {
trace_buff->append("\n\n");
trace_buff->append("---------- short summary ----------\n");
trace_buff->append("\nEDE version: 2.0");
trace_buff->append("\nEDE version: " PACKAGE_VERSION);
trace_buff->append("\nSystem info: ");
trace_buff->append(get_uname().c_str());
@ -271,9 +275,9 @@ void CrashDialog::run(void) {
if(appname || apppath) {
const char* p = (appname ? appname : apppath);
l.printf(_("Program '%s' just crashed !"), p);
l.printf(_("Program '%s' just crashed!"), p);
} else
l += _("Program just crashed !");
l += _("Program just crashed!");
l += _("\n\nYou can inspect details about this crash by clicking on 'Show details' below");
txt_box->copy_label(l.c_str());

View File

@ -20,6 +20,7 @@
#include <edelib/IconTheme.h>
#include <edelib/MessageBox.h>
#include <edelib/Nls.h>
#include <edelib/Run.h>
#ifdef USE_SHAPE
#include <X11/extensions/shape.h>
@ -430,7 +431,7 @@ int DesktopIcon::handle(int event) {
return 1;
case FL_RELEASE:
if(Fl::event_clicks() > 0)
E_DEBUG(E_STRLOC ": EXECUTE: %s\n", settings->cmd.c_str());
edelib::run_async("ede-launch %s", settings->cmd.c_str());
return 1;
case FL_DND_ENTER:

View File

@ -14,6 +14,16 @@
#include <config.h>
#endif
#include <efltk/Fl_Widget.h>
#include <efltk/Fl_Util.h>
#include "aboutdialog.h"
void AboutDialog(Fl_Widget*, void*)
{
fl_start_child_process("ede-launch ede-about", false);
}
#if 0
#include <efltk/Fl.h>
#include <efltk/Fl_Window.h>
#include <efltk/Fl_Box.h>
@ -109,3 +119,4 @@ the GNU General Public Licence version 2 or newer.\nSee Details for more."));
win->set_modal();
win->show();
}
#endif

View File

@ -198,6 +198,8 @@ void BatteryMonitor::battery_check(void)
#ifdef __FreeBSD__
#include <machine/apm_bios.h>
#include <fcntl.h>
#include <unistd.h>
#define APMDEV21 "/dev/apm0"
#define APMDEV22 "/dev/apm"

View File

@ -31,7 +31,7 @@ static const char default_menu[] =
<Item Type=\"Exec\" Icon=\"about.png\" Exec=\"ede-about\">\n\
<Name>About</Name>\n\
</Item>\n\
<Item Type=\"Exec\" Icon=\"erun.png\" Exec=\"ede-launch\">\n\
<Item Type=\"Exec\" Icon=\"erun.png\" Exec=\"$ABOUT\">\n\
<Name>Run</Name>\n\
</Item>\n\
<Item Type=\"Divider\"/>\n\

View File

@ -46,8 +46,8 @@ EDELIB_NS_USING(str_trim)
#define CONFIG_GET_STRVAL(object, section, key, buff) object.get(section, key, buff, sizeof(buff), RES_SYS_ONLY)
#endif
static Atom XA_EDE_EVOKE_SHUTDOWN_ALL;
static Atom XA_EDE_EVOKE_QUIT;
static Atom XA_EDE_EVOKE_SHUTDOWN_ALL;
static Atom XA_EDE_EVOKE_QUIT;
static int get_int_property_value(Atom at) {
Atom real;

View File

@ -26,6 +26,7 @@ struct StartupItem {
typedef edelib::list<StartupItem*> StartupItemList;
typedef edelib::list<StartupItem*>::iterator StartupItemListIter;
class Xsm;
class EvokeService {

View File

@ -16,8 +16,7 @@ SOURCE = evoke.cpp
Xsm.cpp
Logout.cpp
Autostart.cpp
Xshutdown.cpp
SettingsApplicator.cpp ;
Xshutdown.cpp ;
CONFIG = ede-settings.conf
ede-startup.conf ;
@ -31,8 +30,12 @@ ObjectC++Flags EvokeService.cpp : $(EDELIB_DBUS_INCLUDE) ;
LinkAgainstAsFirst evoke : $(EDELIB_DBUS_LIB) ;
EdeProgram evoke : $(SOURCE) ;
ObjectC++Flags ede-startup : $(X_CFLAGS) ;
ProgramBare ede-shutdown : ede-shutdown.cpp ;
LinkAgainst ede-shutdown : -lX11 ;
LinkAgainst ede-shutdown : $(X_LIBS) -lX11 ;
InstallEdeProgram ede-settings-apply ;
EdeManualWithToc [ FFileName doc evoke.txt ] ;
TranslationStrings locale : $(SOURCE) ;

View File

@ -1,83 +0,0 @@
/*
* $Id$
*
* Evoke, head honcho of everything
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2007-2009 EDE Authors.
*
* This program is licensed under terms of the
* GNU General Public License version 2 or newer.
* See COPYING for details.
*/
#include <string.h>
#include <edelib/XSettingsClient.h>
#include <edelib/Debug.h>
#include "SettingsApplicator.h"
EDELIB_NS_USING(XSettingsClient)
EDELIB_NS_USING(XSettingsAction)
EDELIB_NS_USING(XSettingsSetting)
EDELIB_NS_USING(XSETTINGS_ACTION_NEW)
EDELIB_NS_USING(XSETTINGS_ACTION_CHANGED)
EDELIB_NS_USING(XSETTINGS_ACTION_DELETED)
EDELIB_NS_USING(XSETTINGS_TYPE_INT)
static XSettingsClient* client = NULL;
static Display* client_display = NULL;
static int client_screen;
static void xsettings_cb(const char* name, XSettingsAction a, XSettingsSetting* s, void* data) {
if(!client)
return;
if(strcmp(name, "Bell/Volume") == 0 && s->type == XSETTINGS_TYPE_INT) {
XKeyboardControl kc;
kc.bell_percent = s->data.v_int;
XChangeKeyboardControl(client_display, KBBellPercent, &kc);
return;
}
if(strcmp(name, "Bell/Pitch") == 0 && s->type == XSETTINGS_TYPE_INT) {
XKeyboardControl kc;
kc.bell_pitch = s->data.v_int;
XChangeKeyboardControl(client_display, KBBellPitch, &kc);
return;
}
if(strcmp(name, "Bell/Duration") == 0 && s->type == XSETTINGS_TYPE_INT) {
XKeyboardControl kc;
kc.bell_duration = s->data.v_int;
XChangeKeyboardControl(client_display, KBBellDuration, &kc);
return;
}
}
void xsettings_applicator_init(Display* dpy, int scr) {
/*
* make sure we set display first, because after 'init()' callback
* will be imediately called
*/
client_display = dpy;
client_screen = scr;
client = new XSettingsClient;
if(!client->init(dpy, scr, xsettings_cb, NULL)) {
delete client;
client = NULL;
return;
}
}
void xsettings_applicator_shutdown(void) {
delete client;
client = NULL;
}
void xsettings_applicator_process_event(const XEvent* xev) {
if(client)
client->process_xevent(xev);
}

View File

@ -1,26 +0,0 @@
/*
* $Id$
*
* Evoke, head honcho of everything
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2007-2009 EDE Authors.
*
* This program is licensed under terms of the
* GNU General Public License version 2 or newer.
* See COPYING for details.
*/
#ifndef __SETTINGSAPPLICATOR_H__
#define __SETTINGSAPPLICATOR_H__
#include <X11/Xlib.h>
/*
* Settings applicator are bunch of functions to run XSettingsClient
* and apply known settings.
*/
void xsettings_applicator_init(Display* dpy, int scr);
void xsettings_applicator_shutdown(void);
void xsettings_applicator_process_event(const XEvent* xev);
#endif

View File

@ -19,10 +19,13 @@
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/x.H>
#include <edelib/Run.h>
#include "EvokeService.h"
#include "Autostart.h"
EDELIB_NS_USING(run_async)
#define FOREVER 1e20
#define LOCK_FILE "/tmp/.evoke.lock"
@ -104,8 +107,8 @@ int main(int argc, char** argv) {
return 0;
if(!service->setup_lock(LOCK_FILE)) {
printf("Either another evoke instance is running or I can't create lock file\n");
printf("If program abnormaly crashed before, just remove '%s' and start it again\n", LOCK_FILE);
printf("*** Either another evoke instance is running or I can't create lock file.\n");
printf("*** If program abnormaly crashed before, just remove '%s' and start it again.\n", LOCK_FILE);
return 1;
}
@ -134,6 +137,10 @@ int main(int argc, char** argv) {
PropertyChangeMask | SubstructureNotifyMask | ClientMessage);
Fl::add_handler(xmessage_handler);
/* run applicator for settings; it must be done after manager is fully on */
if(do_startup)
run_async("ede-settings-apply");
service->start();
while(service->running()) {

View File

@ -1,11 +1,14 @@
dnl
dnl A small modification to remove ending spaces (sz)
dnl $Id$
dnl
dnl Modified a little bit so returned values does not have ending spaces. (Sanel)
dnl Note: if you do not set 'action-not', if package not found, it will stop configure
dnl script with "Library XY requirements not met..." message
dnl
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
AC_DEFUN(PKG_CHECK_MODULES, [
AC_DEFUN([PKG_CHECK_MODULES], [
succeeded=no
if test -z "$PKG_CONFIG"; then
@ -35,9 +38,12 @@ AC_DEFUN(PKG_CHECK_MODULES, [
## -Wl,--export-dynamic
$1_LIBS="`$PKG_CONFIG --libs-only-L \"$2\"` `$PKG_CONFIG --libs-only-l \"$2\"`"
AC_MSG_RESULT($$1_LIBS)
$1_VERSION=`$PKG_CONFIG --modversion "$2"`
else
$1_CFLAGS=""
$1_LIBS=""
$1_VERSION=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
@ -50,6 +56,7 @@ AC_DEFUN(PKG_CHECK_MODULES, [
AC_SUBST($1_CFLAGS)
AC_SUBST($1_LIBS)
AC_SUBST($1_VERSION)
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"