aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
AgeCommit message (Collapse)AuthorFilesLines
2012-01-04FbTk/XrmDatabaseHelper.hh: operator== can be const.Ryan Pavlik1-1/+1
Found with cppcheck.
2012-01-04Check .empty() instead of .size() == 0Ryan Pavlik1-2/+2
Found with cppcheck.
2012-01-04Pre-increment non-primitive types.Ryan Pavlik6-9/+9
Found with cppcheck: "Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code."
2012-01-04No need to check if a pointer is null before de-allocating it.Paul Tagliamonte1-2/+1
5.3.5/2 of the C++ standard: "In either alternative, if the value of the operand of delete is the null pointer the operation has no effect."
2011-10-31src/Makefile.am,FbTk/StringUtil.cc: Search relative to the executable.Ryan Pavlik1-0/+65
On Windows, prepend /DUMMYPREFIX to default paths, and replace it at runtime with the prefix relative to the exe directory.
2011-10-31FbTk/StringUtil.cc: Don't return mid-routine.Ryan Pavlik1-2/+3
Prep for Windows dummy prefix code.
2011-10-31main.cc,FbTk/StringUtil.cc: On windows, use USERPROFILE instead of HOMERyan Pavlik1-0/+4
2011-10-31FbTk/FbString.cc,Font.cc: Windows doesn't have nl_langinfoRyan Pavlik2-4/+4
2011-10-31FbTk/Timer.cc: Check HAVE_SYS_SELECT_H, add alternate for windowsRyan Pavlik1-0/+2
2011-10-31Merge branches 'fix-out-of-range-memory', 'obey-configure' and ↵Ryan Pavlik5-11/+29
'other-improvements' into windows-mingw
2011-10-31FbTk/App.cc: make startup failure easier to diagnoseRyan Pavlik1-2/+7
2011-10-31FbTk/FileUtil.cc: Use only file masks defined.Ryan Pavlik1-3/+8
Needed for mingw-cross-env
2011-10-31FbTk/SignalHandler.cc: Use HAVE_SIGACTION, with signal() fallbackRyan Pavlik1-1/+7
This fixes platforms without sigaction, like Windows.
2011-10-31FbTk/Timer.cc: Check HAVE_SYS_SELECT_HRyan Pavlik1-1/+3
2011-10-31FbTk/StringUtil.cc: Fix out-of-range memory access.Ryan Pavlik1-1/+1
if pos is not npos, it will always be less than filename.size(). However, the access later is only safe if there is a character after pos, which would require pos + 1 to be less than filename.size.
2011-10-31FbTk/I18n.cc: Constructor should also check defined(NLS)Ryan Pavlik1-4/+4
2011-10-23bugfix: use the imlib cache for every imlib context usedMathias Gumz1-5/+5
calling imlib_set_cache_size() before a context is created by fluxbox creates an 'unknown' context. that one is never freed at shutdown.
2011-10-23clean up imlib2 loaders at shutdownMathias Gumz1-0/+2
2011-10-23clean up resources on shutdownMathias Gumz1-10/+12
2011-10-23small code simplificationMathias Gumz1-73/+68
2011-10-22Bugfix: clean up static resources correctlyMathias Gumz2-13/+11
93924af160ea303c94a2576b0e57a04e94c9228c might corrupt memory with gcc-4.6.1 when finishing fluxbox (clicking 'exit', sending it a SIGINT). Allthough the order, in which static / global objects are initialized is undefined (at least between separate compilation units), the order in which they are destroyed is well defined: in reverse order of initialization. this means, that if 'ScreenImlibContextContainer contexts' (of ImageImlib2.cc) gets initialized AFTER 'ImageImlib2 imlib2_loader' of Image.cc, it gets destroyed before imlib2_loader. When that happens, ~ImageImlib2() works on a destroyed object. (That lead to '* glibc detected * fluxbox: corrupted double-linked list: 0x0000000000dd2710 ***' later on in 'iconv_close')
2011-10-20Added support for ARGB visual, patch #3284774Gediminas Liktaras2-13/+30
fluxbox now properly displays windows that require ARGB visuals when an external compositor is running. This was done by creating the container window with the correct visual and colormap when needed. Closes #2874629
2011-09-14Enable connecting to const SignalsPavel Labath1-17/+19
The idea is that connecting to a signal doesn't change it's state or the state of the object owning the signal (even though it needs to add the functor to the list for later reference). Emitting, on the other hand, is usually done as a result of a state change and therefore remains non-const. Additional benefit of this arrangement is that objects can export const references to signals to allow connecting, while keeping the ability to emit to themselves.
2011-09-14Add explicit ReturnType cast to operator() of FbTk::SlotsPavel Labath1-4/+5
without this it wasn't possible to construct a Slot returning void from functors returning some real value because the compiler would complain about "return statement with a value in a function returning void". Theoretically, this may produce some unexpected type conversions, because static_cast is slightly stronger than implicit cast, but I judge the risk to be negligable (the alternative would be to provide explicit specializations for slots returning void - too much typing)
2011-09-14Upgrade FbTk::Timer so it can take an arbitrary functor as a parameterPavel Labath2-2/+20
2011-09-14Rename Signal::connect function taking an already-constructed slot to ↵Pavel Labath1-7/+7
connectSlot I do this to avoid compiler ambiguity between the two versions of connect()
2011-09-14Add comparison operators to FbTk::RefCountPavel Labath1-0/+30
without them, gcc would compare them by converting them to bool first, which is not exactly what one would expect. Frankly, I'm surprised it even worked without this.
2011-09-14Remove the assignment operator from a regular pointer to a RefCountPavel Labath3-9/+7
it is too easy too shoot yourself in the foot with it, other smart pointers also don't allow such assignments. If you do want to assign to a RefCount pointer, use reset(). ps: assignment between two RefCounts remains possible, of course.
2011-09-14add FbTk::makeRef function, for easier construction of RefCount pointersPavel Labath1-0/+20
2011-09-14FbTk::Timer accepts Slots instead of Commands as the former are more generalPavel Labath2-8/+8
2011-09-14Signal::connect now also accepts an already-constructed SlotPavel Labath1-3/+27
This way we can use Commands as signal handlers out-of-the-box.
2011-09-14Make FbTk::Command inherit from FbTk::SlotPavel Labath1-3/+8
Command offers a subset of functionality and could be completely removed at some point.
2011-09-14Add a reset() function to FbTk::RefCountPavel Labath1-0/+1
to make it's interface more compatible with other smart pointers.
2011-09-14Mark FbTk::StringConvertor as NotCopyablePavel Labath1-1/+3
2011-09-14Prepare the Slot classes to be used independently of SignalsPavel Labath2-64/+117
Added some polish around them and, to mark this special occasion, moved them out of the SigImpl namespace. PS: This partially reverts commit 0775350fee345e37fb59835dda4d85664346b606, since I had to reintroduce ReturnType template parameter, because it will be used in other places. But Signal classes remain without the ReturnType, because I still cannot imagine how would it be used.
2011-09-14Add template copy constructor to FbTk::RefcountPavel Labath1-2/+8
and remove a an "almost" copy constructor (almost, because it takes a non-const reference parameter) which was useless.
2011-09-11FbString: fix build without iconvPeter Korsgaard1-1/+2
Commit 690d926 (introduced FbTk::BidiString) broke building without HAVE_ICONV, because of wrong variable name and use of iconv_t type. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2011-05-10Make SignalTracker always disconnect itself from SignalsPavel Labath1-4/+3
previously, the tracker disconnected itself only when the caller passed withTracker = true to the leave() function. However, the default value was for the parameter was false. Non disconnecting from signal when stopping tracking creates very dangerous situation because the signal still holds a pointer to the tracker. This resulted in a segfault when exiting fluxbox, because the tracker (FluxboxWindow) got destroyed before the signal (BScreen::focusedWindowSig), and the signal was using an invalid pointer when it tried to disconnect itself from the tracker. Instead of setting withTracker to true by default or changing all invocations of leave(), I decided to make the tracker disconnect itself unconditionally because I could not find a use case for the opposite behaviour. PS: This message is in fact longer than the actual commit.
2011-05-10Remove all trace of Observers and SubjectsPavel Labath7-344/+1
this marks the completion of the transition to FbTk::Signal
2011-05-10Added FbTk::MemFunBind - a functor which binds all arguments of a functionPavel Labath1-0/+94
2011-05-10Make FbTk::MemFun[12] inherit from std::unary/binary_functionPavel Labath1-2/+3
this way, they can be used as inputs to std::bind1st and friends
2011-05-10Make FbTk::MemFun[0-3] use their ResultType parameterPavel Labath1-33/+33
previously they declared the parameter, but ignored the return value of the member function. I've changed it so they pass the return value, if it is not void. MemFunSelectArg didn't have the ReturnType template parameter, so I added it for consistency. Since I was already editing the, I made all the operator()s const.
2011-05-10Last round of simplification of Signal/Slot classesPavel Labath4-108/+72
- merged all the common stuff from 0,1,2,3 argument versions into one common base class - removed ReturnType template parameter as it was instantiated with "void" everywhere and the current ignores the return value of the callbacks anyway
2011-05-10Don't crash when a slot is deregistered in the middle of signal processingPavel Labath1-15/+46
this was possible (and used) with FbTk::Subject, but the implemetation of FbTk::Signal didn't support it, which made it impossible to continue with conversion.
2011-05-10Simplify Slot.hhPavel Labath2-254/+70
Replace CallbackHolder, FunctorHolder and SlotHolder with a (smaller) set of polymorphic classes. SignalHolder now stores a (smart) pointer to the class.
2011-05-10Make RefCount<> more sensiblePavel Labath6-12/+16
the previous version of operator*() made no sense. E.g., it violated the invariant (*ptr).foo <=> ptr->foo. The dereferencing operator now returns a reference to the pointed-to object, rather than a pointer to it. I also added a bool conversion operator, which can be used in testing the NULL-ness of the pointer. Anyone wondering if that could be done in a simpler way is encouraged to read <http://www.artima.com/cppsource/safebool.html>. And, finally, I removed the mutable flag from the m_data member, since it does not need it.
2011-05-10Remove the Observer dependency from FbTk::MenuPavel Labath2-7/+3
2011-05-10Convert FbTk::Theme::reconfigSig and friends to the new Signal systemPavel Labath5-12/+11
I removed the const versions of reconfigSig() in the process since FbTk::Signal has no const methods anyway.
2011-05-10Simplify FbTk::Signal template classes a bitPavel Labath1-64/+30
basically, i just got rid of Signal[0-3] classes and moved their contents to the appropriate specialization of FbTk::Signal also, this fixes the no matching function for call to 'MemFunIgnoreArgs(FbTk::Signal<void, FbTk::SigImpl::EmptyArg, FbTk::SigImpl::EmptyArg, FbTk::SigImpl::EmptyArg>&, void (FbTk::SigImpl::Signal0<void>::*)())' error i had in the following commit.
2011-05-08Can check CARDINAL properties in CLIENT PATTERNSnacitar sevaht2-19/+38
Introduces a new member function, FbWindow::cardinalProperty() This change also changes other code that previously used FbWindow::property() to do the same thing as the new function; this reduces code duplication. There are still some bits of code (Ewmh.cc, extractNetWmIcon()) that use FbWindow::property() to retrieve XA_CARDINAL values, but as the new method is designed for getting a _single_ property, and that code uses FbWindow::property() to retrieve the number of values present, and then grab all of them; it's a different use case. I opted to not try to make cardinalProperty() into some monolithic all-purpose cardinal method; FbWindow::property() works just fine for that. This change also adds an optional (default=NULL) boolean to FbWindow::textProperty and friends that allows the caller to determine whether or not a value was actually retrieved. This was necessary for integrating FbWindow::cardinalProperty with the codebase, and it seemed to fit with FbWindow::textProperty as well. Prior to this change, if you got a return value of "", you wouldn't know if you successfully retrieved the value which happened to be blank, or if you failed to retrieve the value. Now, you can pass the address of a boolean if you so choose in order to differentiate these situations; the same applies to the new FbWindow::cardinalProperty().