Added ede-bell-conf, a tool to configure system bell (that annoying beep thing)

Rest are changes so can nicely be compiled on freebsd
Also, some changes are in coding style
This commit is contained in:
Sanel Zukan 2009-02-26 11:15:27 +00:00
parent e051472475
commit c7c8fc92ea
13 changed files with 280 additions and 129 deletions

View File

@ -17,14 +17,13 @@ Clean distclean : $(JCACHEFILE) $(HCACHEFILE) ;
# SubInclude goes after local rules # SubInclude goes after local rules
SubInclude TOP ede-about ; SubInclude TOP ede-about ;
SubInclude TOP ede-bell-conf ;
SubInclude TOP ede-calc ; SubInclude TOP ede-calc ;
SubInclude TOP ede-conf ; SubInclude TOP ede-conf ;
SubInclude TOP ede-crasher ; SubInclude TOP ede-crasher ;
SubInclude TOP ede-desktop ; SubInclude TOP ede-desktop ;
SubInclude TOP ede-desktop-conf ; SubInclude TOP ede-desktop-conf ;
SubInclude TOP ede-screensaver-conf ; SubInclude TOP ede-screensaver-conf ;
#SubInclude TOP edewm ;
SubInclude TOP efiler ;
SubInclude TOP ede-help ; SubInclude TOP ede-help ;
SubInclude TOP eimage ; SubInclude TOP eimage ;
SubInclude TOP elma ; SubInclude TOP elma ;
@ -37,3 +36,8 @@ SubInclude TOP edewm ;
SubInclude TOP evoke ; SubInclude TOP evoke ;
SubInclude TOP doc ; SubInclude TOP doc ;
SubInclude TOP data ; SubInclude TOP data ;
# efile is not compileable on FreeBSD
if $(OS) != FREEBSD {
SubInclude TOP efiler ;
}

View File

@ -17,7 +17,7 @@ MANUAL_FILES = [ Wildcard manual : *.html : manual ] ;
MANUAL_IMGS = [ FDirName $(SUBDIR) manual images ] ; MANUAL_IMGS = [ FDirName $(SUBDIR) manual images ] ;
# where will be installed # where will be installed
MANUAL_INSTALL_DIR = [ FDirName $(EDEDOCDIR) manual ] ; MANUAL_INSTALL_DIR = [ FDirName $(EDE_DOC_DIR) manual ] ;
# install generated documents # install generated documents
InstallData $(MANUAL_INSTALL_DIR) : $(MANUAL_FILES) ; InstallData $(MANUAL_INSTALL_DIR) : $(MANUAL_FILES) ;

16
ede-bell-conf/Jamfile Normal file
View File

@ -0,0 +1,16 @@
#
# $Id$
#
# Part of Equinox Desktop Environment (EDE).
# Copyright (c) 2009 EDE Authors.
#
# This program is licensed under terms of the
# GNU General Public License version 2 or newer.
# See COPYING for details.
SubDir TOP ede-bell-conf ;
SOURCE = ede-bell-conf.cpp ;
EdeProgram ede-bell-conf : $(SOURCE) ;
TranslationStrings locale : $(SOURCE) ;

View File

@ -0,0 +1,84 @@
/*
* $Id$
*
* ede-bell-conf, a tool to configure system bell
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2009 EDE Authors.
*
* This program is licensed under terms of the
* GNU General Public License version 2 or newer.
* See COPYING for details.
*/
#include <FL/x.H>
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Value_Slider.H>
#include <edelib/Window.h>
#include <edelib/Nls.h>
static Fl_Value_Slider* vol_slide;
static Fl_Value_Slider* pitch_slide;
static Fl_Value_Slider* dur_slide;
static edelib::Window* win;
static void set_values(void) {
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();
XChangeKeyboardControl(fl_display, v, &kc);
}
static void cancel_cb(Fl_Widget*, void*) {
win->hide();
}
static void ok_cb(Fl_Widget*, void*) {
set_values();
win->hide();
}
static void test_cb(Fl_Widget*, void*) {
set_values();
XBell(fl_display, 0);
}
int main(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"));
vol_slide->type(5);
vol_slide->step(1);
vol_slide->maximum(100);
vol_slide->align(FL_ALIGN_TOP);
pitch_slide = new Fl_Value_Slider(10, 80, 310, 25, _("Pitch"));
pitch_slide->type(5);
pitch_slide->step(1);
pitch_slide->minimum(100);
pitch_slide->maximum(1000);
pitch_slide->align(FL_ALIGN_TOP);
dur_slide = new Fl_Value_Slider(10, 130, 310, 25, _("Duration"));
dur_slide->type(5);
dur_slide->step(1);
dur_slide->minimum(0);
dur_slide->maximum(1000);
dur_slide->align(FL_ALIGN_TOP);
Fl_Button* ok = new Fl_Button(135, 175, 90, 25, _("&OK"));
ok->callback(ok_cb);
Fl_Button* cancel = new Fl_Button(230, 175, 90, 25, _("&Cancel"));
cancel->callback(cancel_cb);
Fl_Button* test = new Fl_Button(10, 175, 90, 25, _("&Test"));
test->callback(test_cb);
win->end();
win->show(argc, argv);
return Fl::run();
}

View File

@ -0,0 +1,36 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0108
header_name {.h}
code_name {.cxx}
Function {} {open
} {
Fl_Window {} {
label {System bell configuration} open
xywh {428 267 330 210} type Double visible
} {
Fl_Button {} {
label {&OK}
xywh {135 175 90 25}
}
Fl_Button {} {
label {&Cancel} selected
xywh {230 175 90 25}
}
Fl_Button {} {
label {&Test}
xywh {10 175 90 25}
}
Fl_Value_Slider {} {
label Volume
xywh {10 30 310 25} type {Horz Knob} align 1 step 0.01 textsize 12
}
Fl_Value_Slider {} {
label Pitch
xywh {10 80 310 25} type {Horz Knob} align 1 step 0.01 textsize 12
}
Fl_Value_Slider {} {
label Duration
xywh {10 130 310 25} type {Horz Knob} align 1 step 0.01 textsize 12
}
}
}

View File

@ -4,7 +4,7 @@
[EdeConf] [EdeConf]
# main items # main items
items = edewmconf,ede-desktop-conf,ede-screensaver-conf,ede-timedate items = edewmconf,ede-desktop-conf,ede-screensaver-conf,ede-timedate, ede-bell-conf
[edewmconf] [edewmconf]
name = Window manager name = Window manager
@ -29,3 +29,9 @@
tip = This item will configure system date and time tip = This item will configure system date and time
exec = ede-timedate exec = ede-timedate
icon = preferences-date-time icon = preferences-date-time
[ede-bell-conf]
name = Configure system bell
tip = This item will configure system bell
exec = ede-bell-conf
icon = audio-volume-zero

View File

@ -30,79 +30,79 @@ class MovableIcon;
class Fl_Menu_Button; class Fl_Menu_Button;
class DesktopIcon : public Fl_Widget { class DesktopIcon : public Fl_Widget {
private: private:
IconSettings* settings; IconSettings* settings;
const GlobalIconSettings* globals; const GlobalIconSettings* globals;
int lwidth; int lwidth;
int lheight; int lheight;
bool focus; bool focus;
MovableIcon* micon; MovableIcon* micon;
Fl_Image* darker_img; Fl_Image* darker_img;
Fl_Menu_Button* imenu; Fl_Menu_Button* imenu;
void load_icon(int face); void load_icon(int face);
void update_label_size(void); void update_label_size(void);
void fix_position(int X, int Y); void fix_position(int X, int Y);
public: public:
DesktopIcon(GlobalIconSettings* gisett, IconSettings* isett, int bg); DesktopIcon(GlobalIconSettings* gisett, IconSettings* isett, int bg);
~DesktopIcon(); ~DesktopIcon();
virtual void draw(void); virtual void draw(void);
virtual int handle(int event); virtual int handle(int event);
void drag(int x, int y, bool apply); void drag(int x, int y, bool apply);
int drag_icon_x(void); int drag_icon_x(void);
int drag_icon_y(void); int drag_icon_y(void);
/* /*
* This is 'enhanced' (in some sense) redraw(). Redrawing * This is 'enhanced' (in some sense) redraw(). Redrawing
* icon will not fully redraw label nor focus box, which laid outside * icon will not fully redraw label nor focus box, which laid outside
* icon box. It will use damage() on given region, but called from * icon box. It will use damage() on given region, but called from
* parent, so parent can redraw that region on itself (since label does * parent, so parent can redraw that region on itself (since label does
* not laid on any box) * not laid on any box)
* *
* Alternative way would be to redraw whole parent, but it is pretty unneeded * Alternative way would be to redraw whole parent, but it is pretty unneeded
* and slow. * and slow.
*/ */
void fast_redraw(void); void fast_redraw(void);
/* /*
* Here is implemented localy focus schema avoiding * Here is implemented localy focus schema avoiding
* messy fltk one. Focus/unfocus is handled from Desktop. * messy fltk one. Focus/unfocus is handled from Desktop.
*/ */
void do_focus(void) { focus = true; } void do_focus(void) { focus = true; }
void do_unfocus(void) { focus = false; } void do_unfocus(void) { focus = false; }
bool is_focused(void) { return focus; } bool is_focused(void) { return focus; }
Fl_Image* icon_image(void) { return image(); } Fl_Image* icon_image(void) { return image(); }
void rename(const char* str); void rename(const char* str);
/* /*
* make sure this returns String since operator== is * make sure this returns String since operator== is
* further used, especially in Desktop * further used, especially in Desktop
*/ */
const edelib::String& path(void); const edelib::String& path(void);
int icon_type(void); int icon_type(void);
void use_icon1(void); void use_icon1(void);
void use_icon2(void); void use_icon2(void);
}; };
class MovableIcon : public Fl_Window { class MovableIcon : public Fl_Window {
private: private:
DesktopIcon* icon; DesktopIcon* icon;
Fl_Box* icon_box; Fl_Box* icon_box;
Pixmap mask; Pixmap mask;
public: public:
MovableIcon(DesktopIcon* i); MovableIcon(DesktopIcon* i);
~MovableIcon(); ~MovableIcon();
virtual void show(void); virtual void show(void);
}; };
#endif #endif

View File

@ -54,8 +54,6 @@ static void ok_cb(Fl_Widget*, void* w) {
} }
static void icon_change_cb(Fl_Button* b, void* d) { static void icon_change_cb(Fl_Button* b, void* d) {
DesktopIconData* data = (DesktopIconData*)d;
edelib::String ret = edelib::icon_chooser(edelib::ICON_SIZE_HUGE); edelib::String ret = edelib::icon_chooser(edelib::ICON_SIZE_HUGE);
if(ret.empty()) if(ret.empty())
return; return;

View File

@ -18,22 +18,22 @@
/* /*
* Class responsible for displaying images at background * Class responsible for displaying images at background
* their scaling (TODO), caching(TODO) and making coffee at the spear time. * their scaling (TODO), caching(TODO) and making coffee at the spare time.
*/ */
class Wallpaper : public Fl_Box { class Wallpaper : public Fl_Box {
private: private:
Pixmap rootpmap_pixmap; Pixmap rootpmap_pixmap;
bool tiled; bool tiled;
void set_rootpmap(void); void set_rootpmap(void);
public: public:
Wallpaper(int X, int Y, int W, int H); Wallpaper(int X, int Y, int W, int H);
~Wallpaper(); ~Wallpaper();
bool set(const char* path); bool set(const char* path);
bool set_tiled(const char* path); bool set_tiled(const char* path);
virtual void draw(void); virtual void draw(void);
virtual int handle(int event); virtual int handle(int event);
}; };
#endif #endif

View File

@ -97,79 +97,79 @@ typedef edelib::list<edelib::String>::iterator StringListIter;
#endif #endif
class Desktop : public DESKTOP_WINDOW { class Desktop : public DESKTOP_WINDOW {
private: private:
static Desktop* pinstance; static Desktop* pinstance;
int selection_x, selection_y; int selection_x, selection_y;
bool moving; bool moving;
bool do_dirwatch; bool do_dirwatch;
SelectionOverlay* selbox; SelectionOverlay* selbox;
GlobalIconSettings* gisett; GlobalIconSettings* gisett;
DesktopSettings* dsett; DesktopSettings* dsett;
Fl_Menu_Button* dmenu; Fl_Menu_Button* dmenu;
Wallpaper* wallpaper; Wallpaper* wallpaper;
edelib::EdbusConnection* dbus; edelib::EdbusConnection* dbus;
DesktopIconList icons; DesktopIconList icons;
DesktopIconList selectionbuff; DesktopIconList selectionbuff;
edelib::String trash_path; edelib::String trash_path;
void init_internals(void); void init_internals(void);
void load_icons(const char* path); void load_icons(const char* path);
void save_icons_positions(void); void save_icons_positions(void);
bool read_desktop_file(const char* path, IconSettings& is); bool read_desktop_file(const char* path, IconSettings& is);
void add_icon(DesktopIcon* ic); void add_icon(DesktopIcon* ic);
bool add_icon_by_path(const char* path, edelib::Resource* conf); bool add_icon_by_path(const char* path, edelib::Resource* conf);
DesktopIcon* find_icon_by_path(const char* path); DesktopIcon* find_icon_by_path(const char* path);
bool remove_icon_by_path(const char* path); bool remove_icon_by_path(const char* path);
bool update_icon_by_path(const char* path); bool update_icon_by_path(const char* path);
void unfocus_all(void); void unfocus_all(void);
void select(DesktopIcon* ic, bool do_redraw = true); void select(DesktopIcon* ic, bool do_redraw = true);
void select_only(DesktopIcon* ic); void select_only(DesktopIcon* ic);
bool in_selection(const DesktopIcon* ic); bool in_selection(const DesktopIcon* ic);
void move_selection(int x, int y, bool apply); void move_selection(int x, int y, bool apply);
void select_in_area(void); void select_in_area(void);
void dnd_drop_source(const char* src, int src_len, int x, int y); void dnd_drop_source(const char* src, int src_len, int x, int y);
DesktopIcon* below_mouse(int px, int py); DesktopIcon* below_mouse(int px, int py);
public: public:
Desktop(); Desktop();
~Desktop(); ~Desktop();
virtual void show(void); virtual void show(void);
virtual void hide(void); virtual void hide(void);
virtual void draw(void); virtual void draw(void);
virtual int handle(int event); virtual int handle(int event);
static void init(void); static void init(void);
static void shutdown(void); static void shutdown(void);
static Desktop* instance(void); static Desktop* instance(void);
void read_config(void); void read_config(void);
void update_workarea(void); void update_workarea(void);
void area(int& X, int& Y, int& W, int& H) { X = x(); Y = y(); W = w(); H = h(); } void area(int& X, int& Y, int& W, int& H) { X = x(); Y = y(); W = w(); H = h(); }
void set_bg_color(int c, bool do_redraw = true); void set_bg_color(int c, bool do_redraw = true);
void notify_desktop_changed(void); void notify_desktop_changed(void);
void dir_watch(const char* dir, const char* changed, int flags); void dir_watch(const char* dir, const char* changed, int flags);
void dir_watch_on(void) { do_dirwatch = true; } void dir_watch_on(void) { do_dirwatch = true; }
void dir_watch_off(void) { do_dirwatch = false; } void dir_watch_off(void) { do_dirwatch = false; }
void execute(const char* cmd); void execute(const char* cmd);
}; };
#endif #endif

View File

@ -151,7 +151,7 @@ void BatteryMonitor::update_status()
#include <machine/apmioctl.h> #include <machine/apmioctl.h>
int first = 1; int first = 1;
void battery_check(void) void BatteryMonitor::battery_check(void)
{ {
int fd; int fd;
struct apmreq ar ; struct apmreq ar ;
@ -213,7 +213,7 @@ void battery_check(void)
#define APM_STAT_BATT_CHARGING 3 #define APM_STAT_BATT_CHARGING 3
int first = 1; int first = 1;
void battery_check(void) void BatteryMonitor::battery_check(void)
{ {
int fd, r; int fd, r;
bool p; bool p;
@ -284,7 +284,7 @@ void battery_check(void)
#define _PATH_APM_NORMAL "/dev/apm" #define _PATH_APM_NORMAL "/dev/apm"
int first = 1; int first = 1;
void battery_check(void) void BatteryMonitor::battery_check(void)
{ {
int fd, r; int fd, r;
bool p; bool p;

View File

@ -57,6 +57,8 @@ static int atoms_loaded = 0;
static pid_t xscr_preview_pid = 0; static pid_t xscr_preview_pid = 0;
static const char* xscr_folder_found = 0; static const char* xscr_folder_found = 0;
extern char** environ;
static const char* xscr_hacks_dirs[] = { static const char* xscr_hacks_dirs[] = {
PREFIX"/lib/xscreensaver/", PREFIX"/lib/xscreensaver/",
"/usr/libexec/xscreensaver/", "/usr/libexec/xscreensaver/",

View File

@ -10,12 +10,17 @@
* See COPYING for the details. * See COPYING for the details.
*/ */
#include "Fortune.h"
#include <netinet/in.h> #include <netinet/in.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include "Fortune.h"
/* FreeBSD does not have off_t, not sure about others */
#ifndef __GLIBC__
typedef unsigned int off_t;
#endif
struct FortuneFile { struct FortuneFile {
FILE* str_file; FILE* str_file;
FILE* dat_file; FILE* dat_file;