diff --git a/Jamfile b/Jamfile index b46a5b4..08b0177 100644 --- a/Jamfile +++ b/Jamfile @@ -22,6 +22,7 @@ SubInclude TOP ede-conf ; SubInclude TOP ede-crasher ; SubInclude TOP ede-desktop ; SubInclude TOP ede-desktop-conf ; +SubInclude TOP ede-screensaver-conf ; #SubInclude TOP edewm ; SubInclude TOP efiler ; SubInclude TOP ede-help ; diff --git a/build/Library.jam b/build/Library.jam index 7b9fb0c..0fd679b 100644 --- a/build/Library.jam +++ b/build/Library.jam @@ -8,7 +8,9 @@ # GNU General Public License version 2 or newer. # See COPYING for details. -SUFSHAREDLIB = ".so" ; +SUFOBJ_SHARED = ".lo" ; +SUFLIB_SHARED = ".so" ; +SUFLA_SHARED = ".la" ; # StaticLibrary [lib-name] : [source-files] ; rule StaticLibrary @@ -18,93 +20,129 @@ rule StaticLibrary rule SharedLibraryFromObjects { - if ! $(UNIX) { - Echo "Dynamic libraries can't be built on this OS now" ; - return ; + local _i _l _l_so _l_la _s ; + + # Add grist to file names + _s = [ FGristFiles $(3) ] ; + _l = $(1:S=$(SUFLIB_SHARED).$(2)) ; + + # for sonames; it accept only libname.so + _l_so = $(1:S=$(SUFLIB_SHARED)) ; + _l_so = $(_l_so:BSR=) ; + + # libname.la file + _l_la = $(_l_so:S=$(SUFLA_SHARED)) ; + + # library depends on its member objects + if $(KEEPOBJS) { + LocalDepends obj : $(_s) ; + } else { + LocalDepends lib : $(_l) ; } - local s t t_only ; + # Set LOCATE for the library and its contents. The bound + # value shows up as $(NEEDLIBS) on the Link actions. + # For compatibility, we only do this if the library doesn't + # already have a path. - t = $(1) ; - s = [ FGristFiles $(2) ] ; - - # Rip directory and grist parts from target because this will - # be passed to compiler as soname - t_only = $(t:D=:G=) ; - - # if given suffix, skip it; otherwise add SUFSHAREDLIB - if ! $(t:S) { - t = $(t:S=$(SUFSHAREDLIB)) ; + if ! $(_l:D) { + MakeLocate $(_l) : $(LOCATE_TARGET) ; } - LocalDepends lib : $(t) ; + # we never scan shared libraries for member objects + LocalDepends $(_l) : $(_s) ; - # This is used if library already does not have a path - if ! $(t:D) { - MakeLocate $(t) $(t)($(s:BS)) : $(LOCATE_TARGET) ; + # clean library + LocalClean clean : $(_l) ; + + if $(OS) = "SOLARIS" { + # solaris have other options for soname creation + LINKFLAGS on $(_l) = -h $(_l_so) -G [ on $(_l) return $(LINKFLAGS) ] ; + } else { + # let linker knows we are making shared library by adding -shared and -Wl,-soname libname.so flags + LINKFLAGS on $(_l) = -Wl,-soname,$(_l_so) -shared [ on $(_l) return $(LINKFLAGS) ] ; } - LINKLIBS on $(t) = -shared -Wl,-soname,\"$(t_only)\" [ on $(t) return $(LINKLIBS) ] ; + # make it + Link $(_l) : $(_s) ; - # Let target is dependant on source - LocalDepends $(t) : $(s) ; + # make a link + SymLink $(_l_so) : $(_l) ; - Link $(t) : $(s) ; - LocalClean clean : $(t) ; + # let link be created in directory where libname.so.X.X.X exists + MakeLocate $(_l_so) : $(_l:D) ; + LocalDepends lib : $(_l_so) ; + + # generate libname.la file + DLNAME1 on $(_l_la) = $(_l_so) ; + DLNAME2 on $(_l_la) = $(_l:BSR=) ; + GenLa $(_l_la) ; + LocalClean clean : $(_l_la) ; + LocalClean clean : $(_l_so) ; + + # let libname.la be created in directory where libname.so.X.X.X exists + MakeLocate $(_l_la) : $(_l:D) ; + LocalDepends lib : $(_l_la) ; } -# SharedLibrary [libname] : [sources] ; -# Creates shared library [libname] from [sources]. -# -# Note: ftjam in later versions provide rule with the same name, althought it calls -# libtool in the background. The way jam works, selecting latest redefined rules, ftjam's -# will be overriden with this. +rule SharedObjects +{ + # temporary replace SUFOBJ since Objects rule use it + local SUFOBJ = $(SUFOBJ_SHARED) ; + + ObjectCcFlags $(<) : -fPIC ; + ObjectC++Flags $(<) : -fPIC ; + + # call the normal Objects rule + Objects $(<) ; +} + +# SharedLibrary [library] : [version] : [source] ; +# Creates shared library ala libtool rule SharedLibrary { - local shlib = $(1) ; - local src = $(2) ; - local objects = [ FGristFiles $(src:S=$(SUFOBJ)) ] ; - - CCFLAGS on $(objects) += -fPIC ; - C++FLAGS on $(objects) += -fPIC ; - - SharedLibraryFromObjects $(shlib) : $(objects) ; - Objects $(src) ; -} - -# SharedLibraryVersioned [libname] : [sources] : [opt-version] : ["nolink"] ; -# Creates versioned shared library (foo.so.[version]) which is often library naming -# on unix platforms. If [opt-version] is not given, it is like calling SharedLibrary only. -# By default it will create, besides [libname], ".so" symlink to it too. If "nolink" is given -# as 4 parameter, it will skip symlink creation. -rule SharedLibraryVersioned -{ - if $(3) { - local target target_dir symlink versioned ; - - # Set .so.version extension - versioned = "$(SUFSHAREDLIB).$(3)" ; - - # Jam is not smart about ripping suffixes so cases 'foo.so.2.0' - # will produce 'foo.so.2'. We must hope that provided [libname] does _not_ - # have full name or everything will be screwed up (no facility in jam to check this). - # With good hopes, we set first full target name and it's link abbreviation. - target = $(1:S=$(versioned)) ; - symlink = $(1:S=$(SUFSHAREDLIB)) ; - SharedLibrary $(target) : $(2) ; - - # Create symlink - if $(4) != "nolink" { - # copy target directory or symlink will be created - # from place where jam is called - LOCATE on $(symlink) = [ on $(target) return $(LOCATE) ] ; - - LocalDepends lib : $(symlink) ; - - SymLink $(symlink) : $(target) ; - LocalClean clean : $(symlink) ; - } - } else { - SharedLibrary $(1) : $(2) ; + if ! $(UNIX) { + Exit "Don't know how to build shared libraries on this platform" ; } + + SharedLibraryFromObjects $(1) : $(2) : $(3:S=$(SUFOBJ_SHARED)) ; + SharedObjects $(3) ; +} + +# .la files are generated by libtool and we emulate that too +# NOTE: jam will discard comments that should be written to the file +# so instead plain '#' is used '@@#' and later is replaced with sed +actions GenLa +{ + today=`date` + + cat > "$(<).tmp" < "$(<)" + $(RM) "$(<).tmp" } diff --git a/build/Program.jam b/build/Program.jam index 65d1543..196178e 100644 --- a/build/Program.jam +++ b/build/Program.jam @@ -29,7 +29,7 @@ rule MakeProgramPrivate objects = [ FGristFiles $(2:S=$(SUFOBJ)) ] ; # Pick up values if someone set flags outside (via ObjectCcFlags and etc.) - CFLAGS on $(objects) += $(4) ; + CCFLAGS on $(objects) += $(4) ; C++FLAGS on $(objects) += $(4) ; if $(REMOVE_UNUSED_DEPENDENCIES_TRICK) = 1 { diff --git a/build/Utils.jam b/build/Utils.jam index 8e42776..783b02b 100644 --- a/build/Utils.jam +++ b/build/Utils.jam @@ -25,6 +25,22 @@ if ! $(INVOCATION_SUBDIR_SET) { } # Compatibility part ends +# [ RemoveFlag FLAG : FLAGS ] ; +# Removes FLAG from list of FLAGS +rule RemoveFlag +{ + local i ; + local ret ; + + for i in $(>) { + if $(i) != $(<) { + ret += $(i) ; + } + } + + return $(ret) ; +} + # Fltk use .cxx extension for C++ files so it must # be registered. This rule is called by jam so final # application must not use it. diff --git a/ede-desktop-conf/BoxBlur.cpp b/ede-desktop-conf/BoxBlur.cpp new file mode 100644 index 0000000..7e4637f --- /dev/null +++ b/ede-desktop-conf/BoxBlur.cpp @@ -0,0 +1,80 @@ +/* + * $Id$ + * + * Desktop configuration tool + * 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 +#include +#include +#include "BoxBlur.h" + +typedef unsigned char uchar; +typedef unsigned int uint; + +static int pixel_address(int x, int y, int w) { + return y * w + x; +} + +static uint get_pixel(uint* data, int x, int y, int w) { + int p = pixel_address(x, y, w); + if(p < 0) + p = 0; + if(p > w - 1) + p = w - 1; + return data[p]; +} + +Fl_RGB_Image* box_blur(Fl_RGB_Image* src) { + int radius = 4; + + uint* orig = (uint*)src->data()[0]; + uchar* buf = new uchar[src->w() * src->h() * src->d()]; + memcpy(buf, src->array, src->w() * src->h() * src->d()); + uint* bufptr = (uint*)buf; + + for(int x = 4; x < src->w() - 1; x++) { + for(int y = 4; y < src->h() - 1; y+= src->d()) { + int count = 0; + uint rsum = 0, gsum = 0, bsum = 0, asum = 0; + + for(int nx = x - radius; nx < x + radius; nx++) { + for(int ny = y - radius; ny < y + radius; ny++) { + /* get pixel from x,y */ + uint pix = get_pixel(bufptr, nx, ny, src->w()/src->d()); + uchar* ptr = (uchar*)&pix; + + rsum += *ptr++; + gsum += *ptr++; + bsum += *ptr++; + asum += *ptr; + + count += 1; + } + } + + /* set pixel at x,y */ + uint tmp; + uchar *tc = (uchar*)&tmp; + *tc++ = rsum / count; + *tc++ = gsum / count; + *tc++ = bsum / count; + *tc = asum / count; + + bufptr[pixel_address(x, y, src->w()/src->d())] = tmp; + } + } + + if(src->alloc_array) + delete [] (uchar*)src->array; + src->array = buf; + src->alloc_array = 1; + + return src; +} diff --git a/ede-desktop-conf/BoxBlur.h b/ede-desktop-conf/BoxBlur.h new file mode 100644 index 0000000..d38c2af --- /dev/null +++ b/ede-desktop-conf/BoxBlur.h @@ -0,0 +1,20 @@ +/* + * $Id$ + * + * Desktop configuration tool + * 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. + */ + +#ifndef __BOXBLUR_H__ +#define __BOXBLUR_H__ + +class Fl_RGB_Image; + +Fl_RGB_Image* box_blur(Fl_RGB_Image* src); + +#endif diff --git a/ede-desktop-conf/Jamfile b/ede-desktop-conf/Jamfile index 687e068..3940e4a 100644 --- a/ede-desktop-conf/Jamfile +++ b/ede-desktop-conf/Jamfile @@ -10,7 +10,7 @@ SubDir TOP ede-desktop-conf ; -SOURCE = ede-desktop-conf.cpp ; +SOURCE = ede-desktop-conf.cpp BoxBlur.cpp ; EdeProgram ede-desktop-conf : $(SOURCE) ; TranslationStrings locale : $(SOURCE) ; diff --git a/ede-desktop-conf/ede-desktop-conf.cpp b/ede-desktop-conf/ede-desktop-conf.cpp index 1f6d3b1..19649db 100644 --- a/ede-desktop-conf/ede-desktop-conf.cpp +++ b/ede-desktop-conf/ede-desktop-conf.cpp @@ -42,6 +42,8 @@ #include #include +#include "BoxBlur.h" + #define EDE_DESKTOP_UID 0x10 #define EDE_DESKTOP_CONFIG "ede/ede-desktop" @@ -128,6 +130,7 @@ void set_wallpaper(const char* path) { case IMG_STRETCH: { Fl_Image* transformed = rel_img->copy(area_w, area_h); wallpaper_img->size(area_w, area_h); + transformed = (Fl_RGB_Image*)box_blur((Fl_RGB_Image*)transformed); wallpaper_img->image(transformed); break; } @@ -276,7 +279,7 @@ void ok_cb(Fl_Widget*, void* w) { edelib::Window* win = (edelib::Window*)w; apply_cb(0, win); /* a hack so ede-desktop-conf can send a message before it was closed */ - sleep(1); + usleep(120000); win->hide(); } @@ -373,11 +376,13 @@ int main(int argc, char** argv) { g1->hide(); g1->begin(); + /* Fl_Box* b1 = new Fl_Box(85, 196, 100, 15); b1->box(FL_BORDER_BOX); Fl_Box* b2 = new Fl_Box(30, 43, 210, 158); b2->box(FL_THIN_UP_BOX); + */ /* box size is intentionaly odd so preserve aspect ratio */ wallpaper = new Fl_Box(43, 53, 184, 138); @@ -392,8 +397,10 @@ int main(int argc, char** argv) { wallpaper_img->box(FL_NO_BOX); wallpaper_img->align(FL_ALIGN_CLIP); + /* Fl_Box* b4 = new Fl_Box(60, 206, 145, 14); b4->box(FL_THIN_UP_BOX); + */ desk_background = new Fl_Input(295, 80, 190, 25, _("Image:")); @@ -471,6 +478,6 @@ int main(int argc, char** argv) { win->init(edelib::WIN_INIT_IMAGES); load_settings(); - win->show(); + win->show(argc, argv); return Fl::run(); } diff --git a/ede-tip/Jamfile b/ede-tip/Jamfile index 02d4b2c..878fc4a 100644 --- a/ede-tip/Jamfile +++ b/ede-tip/Jamfile @@ -29,7 +29,7 @@ rule FortuneCompile MakeLocate $(<) : $(SUBDIR) ; FortuneCompile1 $(<) : $(>) ; - Clean clean : $(<) ; + LocalClean clean : $(<) ; } actions FortuneCompile1 diff --git a/emountd/Jamfile b/emountd/Jamfile index b50d816..2d1921a 100644 --- a/emountd/Jamfile +++ b/emountd/Jamfile @@ -8,35 +8,17 @@ # GNU General Public License version 2 or later. # See COPYING for the details. - SubDir TOP emountd ; -rule RemoveFlag -{ - local i ; - local ret ; - - for i in $(>) { - if $(i) != $(<) { - ret += $(i) ; - } - } - - return $(ret) ; -} - -HALFLAGS = -DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/hal -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include ; -HALLIBS = -lhal-storage -lhal -ldbus-1 ; - SOURCE = emountd.cpp ; ObjectC++Flags $(SOURCE) : -Wno-long-long # libhal have a bug that fails on C++ with '-pedantic' flag [ RemoveFlag -pedantic : $(GLOBALFLAGS) ] $(EDELIBINCLUDE) - $(HALFLAGS) ; + $(HALINCLUDE) ; Main emountd : $(SOURCE) ; -LinkAgainst emountd : $(EDELIBLIB) $(HALLIBS) $(STDLIB) ; +LinkAgainst emountd : $(EDELIBLIB) $(HALLIB) $(STDLIB) ; InstallEdeProgram emountd ; EdeManual emountd.txt ;