Commit graph

1103 commits

Author SHA1 Message Date
Mathias Gumz
4d307dcd10 Fix bug: handle the list of Timers not in-place
With commit 541c8c4 we switched from an (manually) ordered list to a
std::set<> to handle the active timers. The code which checks for overdue
timers now traverses and modifies the std::set<> in place. This might
lead to an infinite loop. Examples of such bad behavior are "flickering of
the tooltip" (bug #3590078) or crashes (bug #3600143) or just insanely high
cpu load when autoraising windows or submenus.

We now make a copy of the std::set<> traverse this instead of the original.
2013-01-12 09:24:11 +01:00
Mathias Gumz
f587cc9e7e Compile fix: forgotten parentheses around value 2013-01-02 09:57:32 +01:00
Sami Kerola
1f89a19cfc replace XKeycodeToKeysym() with XkbKeycodeToKeysym()
The XKeycodeToKeysym() is deprecated.

References: http://comments.gmane.org/gmane.comp.misc.suckless/9403
2012-12-30 20:31:25 +01:00
Vladimir A. Pavlov
5efef22cba Fix double text rendering if using parentRelative 2012-12-30 12:27:55 +01:00
Vladimir A. Pavlov
36489e4a17 Set WM_WINDOW_ROLE for fluxbox windows 2012-12-30 12:27:43 +01:00
Mathias Gumz
d8cd6a928b Fixed bug: use expanded style/theme filename
'filename' might contain a '~' which has to be expanded to work for
regular system calls. We expanded 'filename' already but then did not use
it. Fixes bug #3576586.
2012-12-11 19:37:59 +01:00
Mathias Gumz
b4534e0f28 Rewrite of FbTk::TextureRender
* much more readable and easier to read code
* smaller code
* reduced binary size due to removed big lookup-table for square root
* simple 'optimizations (lookup tables, packing of data), nothing too fancy
2012-11-08 11:02:28 +01:00
Mathias Gumz
7b6ab828c7 Improved vertical alignment of text in FbTk::TextButton
The old formula for vertical align text inside FbTk::TextButton ('height/2 +
font_ascent/2 - 1') produced not always good looking results, escpecially
when different fonts are involved (eg, ClockTool and WorkspaceName have
different fonts and font-sizes).

'(height - font_ascent) / 2 - 1' produces better results.

Additional changes:

* added ASCII-Art to document the involved entities when calculating the
  baseline
* rewritten tests/testFont.cc to accept multiples texts and multiple
  fonts
* removed some internal parts of FbTk::Font from the public interface
2012-10-03 10:27:16 +02:00
Mathias Gumz
032a23d1e7 removed duplicate function signature for FbTk::StringUtil::extractNumber() 2012-09-14 08:53:38 +02:00
Mathias Gumz
e512c1becd minor cosmetic 2012-09-14 08:52:13 +02:00
Mathias Gumz
2f279e96b1 Fix regression: switch back to microseconds for DelayCmd 2012-09-14 08:51:42 +02:00
Mathias Gumz
59d097bcea Fix bug: (re)setting timeouts on a running FbTk::Timer might lead to broken timer list
Setting a new timeout on a running FbTk::Timer must remove it from the timerlist,
otherwise the list is not ordered correctly anymore. So, we stop the running
FbTk::Timer, set the new timeout and restart it.
2012-09-14 08:48:37 +02:00
Mathias Gumz
541c8c407b changed timing functions to use a monotonic increasing clock
gettimeofday() is subject to be changed on daylight-saving or to ntp-related
(think leap-seconds). even worse, it is subject to be changed BACK in time. this
is hard to fix correctly (see commit 45726d3016 and bug #3560509). it is
irrelevant for timers to know the nano-seconds since the epoch anyways.
2012-08-28 10:51:55 +02:00
Vladimir A. Pavlov
71f75c70ae Add menu.hilite.font and menu.hilite.justify style resources 2012-08-03 11:37:34 +02:00
Vladimir A. Pavlov
9d25ea54a1 FbTk/ThemeItems.cc: move loading additional font resources to load()
The same logic had been already implemented for texture resources.
2012-08-03 11:37:17 +02:00
Vladimir A. Pavlov
8c50e81e44 FbTk/ThemeItems.cc: don't use style resources in ThemeItem<Font>::setDefaultValue() 2012-08-03 11:37:07 +02:00
Paul Tagliamonte
940fbca3fe removed 'always-true' expression 2012-04-10 09:28:52 +02:00
Paul Tagliamonte
e6a01dcabb use the 'z' modifier for printing 'size_t' like variables 2012-04-10 09:27:44 +02:00
Mathias Gumz
56af5a1635 Bugfix: Don't draw the interlace lines 1px too far 2012-04-10 09:13:04 +02:00
Lajos Koszti
7b6dc2ad72 Allow percentage values for some Window commands 2012-04-06 14:11:16 +02:00
Ryan Pavlik
85596c1ee2 FbTk/XrmDatabaseHelper.hh: operator== can be const.
Found with cppcheck.
2012-01-04 07:55:17 +01:00
Ryan Pavlik
d70bdbe675 Check .empty() instead of .size() == 0
Found with cppcheck.
2012-01-04 07:54:46 +01:00
Ryan Pavlik
5ae8bdf49d Pre-increment non-primitive types.
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-04 07:53:54 +01:00
Paul Tagliamonte
0f994dbb28 No need to check if a pointer is null before de-allocating it.
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."
2012-01-04 07:43:21 +01:00
Ryan Pavlik
ea5f7b56ec src/Makefile.am,FbTk/StringUtil.cc: Search relative to the executable.
On Windows, prepend /DUMMYPREFIX to default paths, and replace it at
runtime with the prefix relative to the exe directory.
2011-10-31 10:54:33 -05:00
Ryan Pavlik
65cb53b685 FbTk/StringUtil.cc: Don't return mid-routine.
Prep for Windows dummy prefix code.
2011-10-31 10:54:33 -05:00
Ryan Pavlik
25d04827b5 main.cc,FbTk/StringUtil.cc: On windows, use USERPROFILE instead of HOME 2011-10-31 10:54:32 -05:00
Ryan Pavlik
b82999c1ac FbTk/FbString.cc,Font.cc: Windows doesn't have nl_langinfo 2011-10-31 10:54:09 -05:00
Ryan Pavlik
b0779c413b FbTk/Timer.cc: Check HAVE_SYS_SELECT_H, add alternate for windows 2011-10-31 10:54:08 -05:00
Ryan Pavlik
5bf23bb05d Merge branches 'fix-out-of-range-memory', 'obey-configure' and 'other-improvements' into windows-mingw 2011-10-31 10:53:05 -05:00
Ryan Pavlik
afa870802b FbTk/App.cc: make startup failure easier to diagnose 2011-10-31 10:51:51 -05:00
Ryan Pavlik
75c6cee969 FbTk/FileUtil.cc: Use only file masks defined.
Needed for mingw-cross-env
2011-10-31 10:51:13 -05:00
Ryan Pavlik
cc1193ef0c FbTk/SignalHandler.cc: Use HAVE_SIGACTION, with signal() fallback
This fixes platforms without sigaction, like Windows.
2011-10-31 10:50:26 -05:00
Ryan Pavlik
f40be36f75 FbTk/Timer.cc: Check HAVE_SYS_SELECT_H 2011-10-31 10:47:59 -05:00
Ryan Pavlik
757f78035d FbTk/StringUtil.cc: Fix out-of-range memory access.
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-31 10:44:11 -05:00
Ryan Pavlik
f47ed1be51 FbTk/I18n.cc: Constructor should also check defined(NLS) 2011-10-31 10:41:32 -05:00
Mathias Gumz
fe0eda27bd bugfix: use the imlib cache for every imlib context used
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-23 11:58:32 +02:00
Mathias Gumz
a545ddef17 clean up imlib2 loaders at shutdown 2011-10-23 11:52:05 +02:00
Mathias Gumz
2628a0a4cf clean up resources on shutdown 2011-10-23 11:51:36 +02:00
Mathias Gumz
dc18666ef2 small code simplification 2011-10-23 09:01:19 +02:00
Mathias Gumz
ee34b376d7 Bugfix: clean up static resources correctly
93924af160 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-23 00:01:45 +02:00
Gediminas Liktaras
12f44680df Added support for ARGB visual, patch #3284774
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-10-20 09:41:55 +02:00
Pavel Labath
aa84c95253 Enable connecting to const Signals
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-14 19:39:11 +02:00
Pavel Labath
3c050c3d99 Add explicit ReturnType cast to operator() of FbTk::Slots
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-14 19:39:11 +02:00
Pavel Labath
e67b9a6f83 Upgrade FbTk::Timer so it can take an arbitrary functor as a parameter 2011-09-14 19:39:11 +02:00
Pavel Labath
ae252c62cb Rename Signal::connect function taking an already-constructed slot to connectSlot
I do this to avoid compiler ambiguity between the two versions of connect()
2011-09-14 19:39:11 +02:00
Pavel Labath
05b5974e62 Add comparison operators to FbTk::RefCount
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-14 19:39:11 +02:00
Pavel Labath
d21ceb4a23 Remove the assignment operator from a regular pointer to a RefCount
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-14 19:39:11 +02:00
Pavel Labath
2e75d238ab add FbTk::makeRef function, for easier construction of RefCount pointers 2011-09-14 19:39:10 +02:00
Pavel Labath
cfcc4d44aa FbTk::Timer accepts Slots instead of Commands as the former are more general 2011-09-14 19:39:10 +02:00
Pavel Labath
d338e6c003 Signal::connect now also accepts an already-constructed Slot
This way we can use Commands as signal handlers out-of-the-box.
2011-09-14 19:39:10 +02:00
Pavel Labath
bca20c5db4 Make FbTk::Command inherit from FbTk::Slot
Command offers a subset of functionality and could be completely removed at some point.
2011-09-14 19:39:10 +02:00
Pavel Labath
e4157821fc Add a reset() function to FbTk::RefCount
to make it's interface more compatible with other smart pointers.
2011-09-14 19:39:10 +02:00
Pavel Labath
0f85ade9be Mark FbTk::StringConvertor as NotCopyable 2011-09-14 19:39:10 +02:00
Pavel Labath
7bca844581 Prepare the Slot classes to be used independently of Signals
Added some polish around them and, to mark this special occasion, moved them out of the SigImpl
namespace.

PS: This partially reverts commit 0775350fee, 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-14 19:39:10 +02:00
Pavel Labath
0a40d1caf3 Add template copy constructor to FbTk::Refcount
and remove a an "almost" copy constructor (almost, because it takes a non-const reference
parameter) which was useless.
2011-09-14 19:39:10 +02:00
Peter Korsgaard
b9e9eb4e44 FbString: fix build without iconv
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-09-11 17:18:30 +02:00
Pavel Labath
16c90dc19f Make SignalTracker always disconnect itself from Signals
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-10 13:00:46 +02:00
Pavel Labath
7525ca9f77 Remove all trace of Observers and Subjects
this marks the completion of the transition to FbTk::Signal
2011-05-10 13:00:46 +02:00
Pavel Labath
19ac8e40d8 Added FbTk::MemFunBind - a functor which binds all arguments of a function 2011-05-10 13:00:45 +02:00
Pavel Labath
6cfa087536 Make FbTk::MemFun[12] inherit from std::unary/binary_function
this way, they can be used as inputs to std::bind1st and friends
2011-05-10 13:00:45 +02:00
Pavel Labath
2024f258b6 Make FbTk::MemFun[0-3] use their ResultType parameter
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-10 13:00:45 +02:00
Pavel Labath
0775350fee Last round of simplification of Signal/Slot classes
- 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-10 13:00:45 +02:00
Pavel Labath
bef2039d2c Don't crash when a slot is deregistered in the middle of signal processing
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-10 13:00:45 +02:00
Pavel Labath
144d716a42 Simplify Slot.hh
Replace CallbackHolder, FunctorHolder and SlotHolder with a (smaller) set of polymorphic classes.
SignalHolder now stores a (smart) pointer to the class.
2011-05-10 13:00:45 +02:00
Pavel Labath
4b47675441 Make RefCount<> more sensible
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-10 13:00:45 +02:00
Pavel Labath
fa15400cc2 Remove the Observer dependency from FbTk::Menu 2011-05-10 13:00:45 +02:00
Pavel Labath
f7d7dfd2a8 Convert FbTk::Theme::reconfigSig and friends to the new Signal system
I removed the const versions of reconfigSig() in the process since FbTk::Signal has no const
methods anyway.
2011-05-10 13:00:45 +02:00
Pavel Labath
54230c9a44 Simplify FbTk::Signal template classes a bit
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-10 13:00:44 +02:00
nacitar sevaht
1dacf57d20 Can check CARDINAL properties in CLIENT PATTERNS
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().
2011-05-08 07:48:03 +02:00
Pavel Labath
a83cedf37e Fix a pair of warnings reported by clang 2011-04-11 08:37:58 +02:00
Pavel Labath
91958279d3 Menu.cc: send debug output to cerr, make the output more sensible 2011-04-11 08:31:52 +02:00
Daniel Diaz
d28e105075 compile fix: added <cstdlib> to provide declaration for 'size_t' (gcc-4.6.x likes it that way) 2011-03-28 09:06:22 +02:00
Mathias Gumz
21022a1952 cosmetics 2011-03-23 12:03:17 +01:00
Mathias Gumz
9086ccafbe compile fix: sunCC again, wants a compile time constant for arrays 2011-03-23 12:03:08 +01:00
Mathias Gumz
d2e7feaa85 bugfix: submenus didn't hide if a delay was set
use the FbTk::Timer API correctly, bug(s) introduced by

   1f0adef4da
   e685117941
2011-02-25 18:39:48 +01:00
Mathias Gumz
49623390b6 little helper function 'isTitleVisible()' for FbTk::Menu 2011-02-24 11:17:48 +01:00
Mathias Gumz
9616a676d8 renamed FbTk::XLayer to FbTk::Layer and FbTk::XLayerItem to FbTk::LayerItem 2011-02-23 22:49:27 +01:00
Mathias Gumz
813e6c4402 disabled overhead base classes 'FbTk::Layer' and 'FbTk::LayerItem'
had to add <algorithm> at various other files as a result of this change.
2011-02-23 22:46:13 +01:00
Mathias Gumz
c859ae3987 irrelevant 'virtual' destructor 2011-02-23 21:47:16 +01:00
Mathias Gumz
32cc4ba69b code deduplication 2011-02-23 21:45:50 +01:00
Mathias Gumz
6fb2960756 moved rarely used 'cpccpc' out of class declaration 2011-02-22 22:33:56 +01:00
Mathias Gumz
d11aa42ace bugfix: consistent use of 'int' for alpha values (#3187373)
WindowMenuAccessor returned strange alpha values if compiled
with 'g++ -Os'; unholy black magic happens if template<int> faces
functions returning only 'usigned char'.
2011-02-22 22:07:39 +01:00
Mathias Gumz
b7e84104a6 bugfix: render 'sunken' gradients correctly 2011-02-22 15:53:18 +01:00
Mathias Gumz
3c7407beb4 use FbTk::StringUtil API 2011-02-22 15:18:53 +01:00
Mathias Gumz
84a81a1ac1 renamed Texture:DEFAULT_BEVEL to Texture::DEFAULT_LEVEL 2011-02-22 15:18:20 +01:00
Mathias Gumz
0569849c6d cosmetics 2011-02-22 15:17:15 +01:00
Mathias Gumz
78adeb2919 Bugfix: don't render textures with dimension of 0
At least 'invertRGB()' does not like 'width' or 'height' being 0.
341b2f43e5 was triggered by this problem as well.
2011-02-22 12:32:16 +01:00
Mathias Gumz
341b2f43e5 Fix bug: 'src_image' might be NULL if width||height are 0 (#3188223)
With ROT90-SystemTray fluxbox crashed. It is a bit unclear of where
to catch pixmaps / windows with either width or height equal to 0; IMHO
this needs more investigation.
2011-02-21 19:21:38 +01:00
Henrik Kinnunen
34bf3b4833 Fixed a possible crash when using a slot m_holder = 0 2011-02-20 15:48:42 +01:00
Mathias Gumz
e868ff5928 bug fix: make fluxbox work under nxserver, closes #2813828
nxserver-3.x creates a XExposeEvent for the unmapped FbTk::Menu(), which is
not configured completely yet (hence unmapped). this causes a call to
FbTk::Menu::clearItem() which then uses a value of 0 for m_rows_per_column
to divide the current index which triggers a SIGFPE.

it is still unclear, why nxserver-3.x creates the XExposeEvent for the
unmapped (menu) window. doing nothing if the menu is unmapped 'fixes'
the problem for now.

many thanks to Lars Engels (bsd-geek.de) to assist me in debugging this
issue.
2011-01-18 21:43:41 +01:00
Mathias Gumz
cc2774871a removed useless include statements
'typeinfo' was needed for RTTI in isItemSelectable() (see last commit)
'algorithm' is already included some lines above
2011-01-15 21:49:37 +01:00
Mathias Gumz
1f0adef4da better use of API, no need for 'timeval' in Menu 2011-01-15 21:38:56 +01:00
Mathias Gumz
05a52116df MenuItem::isEnabled() is sufficient to decide Menu::isItemSelectable()
MenuSeparator is never enabled since it returns always 'false' in its
implementation of isEnabled(). no need to use RTTI imho.
2011-01-15 21:37:45 +01:00
Mathias Gumz
bb480030f5 small refactoring of FbTk/Menu code
* removed useless struct _menu
* code deduplication via renderMenuPixmap()
* improved documentation:
   - 'sublevel' actually means 'column'
   - 'persub' means 'row_per_column'
2011-01-15 21:31:37 +01:00
Mathias Gumz
ae7a54a4b6 bugfix: ' floating point exception' due wrongly placed code
while integrating the old 'getSqrt()' function into the 'bsqrt()'
function i misplaced some code. this lead to 'r' being 0 on the
first run. doh.
2010-09-21 00:04:46 +02:00
Mathias Gumz
87b45bd0d1 bugfix: avoid naive use of 'putenv' by providing 'FbTk::App::setenv()'
to quote from 'man putenv':

   The string pointed to by string becomes part of the environment,
   so altering the string changes the environment.

so, using putenv like

   {
      std::string foo("FOO=bar");
      putenv(foo.c_str());
   }

is wrong and leads to a potentially corrupted environment. valgrind
complaint correctly.

FbTk::App seems to be the appropriate place to hold '::seten()'
because it alters the environment of the application.
2010-09-17 23:43:24 +02:00
Mathias Gumz
87cffef7f5 request explicitly as many elements for the gradient tables as we need
the next step is to not use 'unsigned int' and then only store 'chars'
in it, maybe even using RGBA data instead of separated arrays for
r, g and b.
2010-09-17 23:32:02 +02:00
Mathias Gumz
786eef6e39 bugfix: forgot to resize 'pixels' before putting values into it (facepalm) 2010-09-17 23:26:56 +02:00
Mathias Gumz
e84c64f7be lots of code cleanup, reordering, trimming public API, bugfixes
## FbTk/ImageControl.hh:

* moved 'getSqrt()' over to TextureRender.cc because it is used only there
* removed unused members m_root_window
* use std::vector<> for colors and for the gradient buffers.

## FbTk/ImageControl.cc:

* fixed memory leak in '~ImageControl', 'pixels' where not deleted[]
  at all. switched to std::vector, non-issue anymore.
* moved identical code into functions 'allocateUnallocatedColors', 'initColortables'

## FbTk/TextureRenderer:

* removed 'from', 'to', 'interlaced' from class, only used in
  'renderGradient()' and are actually part of the given
  texture.
* removed 'xtable', 'ytable' from class, only used in
  'renderGradient()'
* removed 'colors' from the class, is part of 'control'
* moved render actions (invert, bevel1, bevel2, *gradient), they need more
  love but for now this is sufficient
2010-09-17 15:34:12 +02:00
Mathias Gumz
603b36a2cc use FbTk::API to reduce code duplication 2010-09-17 14:46:01 +02:00
Mathias Gumz
12e1ef7826 code deduplication by using <algorithm> and FbTk/STLUtil.hh 2010-09-15 02:07:09 +02:00
Mathias Gumz
52f614b598 bugfix: 'reset' nr_shapes to '0' after last instance of 'Shape' 2010-09-15 01:23:56 +02:00
Mathias Gumz
2b62cf9733 cleanup and code deduplication
* ClientPattern.cc: make compiler happy (complaints about XPROP not handled in switch)
* FbTk/FbPixmap.cc FbTk/StringUtil.cc: signed vs unsigned
* FbTk/FbString.cc: missing return
* WinClient.cc: create atoms only once; use helper function
* Window.cc: use a helper function
2010-09-15 01:22:01 +02:00
Mathias Gumz
c6047e9eba use one array instead of two to hold both 'names' and 'atoms' for the rootwindow 2010-09-14 16:59:05 +02:00
Mathias Gumz
f39bcbd93c bugfix: create the corner pixmaps only once per screen
for each window (windows, menue etc) the initCorners() function of
FbTk/Shape.cc was called (which is ok). On each call the corner pixmaps
(of the Screen the window belongs to) were created and destroyed the
formerly created pixmaps. this is not needed.
2010-09-14 16:58:08 +02:00
Mathias Gumz
75b9a4ed72 bugfix: free the shape-corners on the last used 'Shape'
the global 's_corners' vector was still used on an application shutdown
(including ctrl-c SIGINT). depending on when 's_corners' was created on
the stack this could lead to an exception ('pure virtual called') while
trying to free the 'FbPixmaps' without having a valid
'FbTk::Application::instance()' left.
2010-09-14 16:54:08 +02:00
Mathias Gumz
4e2c7e2167 moved helper struct TextPropPtr into anonymous namespace 2010-09-10 16:36:17 +02:00
Mathias Gumz
7fdb0676a7 bugfix: initialize the Shape of a menu AFTER we created the window for the menu
on startup a lot of 'Fluxbox: X Error: BadDrawable (invalid Pixmap ...)' occured.
this was caused by using an empty 'Window' to create the shape.
2010-09-09 23:23:33 +02:00
Mathias Gumz
77f39235cf added FbTk::Util::clamp() and simplified related code 2010-09-09 15:31:54 +02:00
Mathias Gumz
e685117941 simpler to use FbTk/Timer api 2010-09-09 12:47:38 +02:00
Mathias Gumz
b76be98227 improved extract*Number functions from FbTk/StringUtil.cc 2010-09-08 21:42:48 +02:00
Mathias Gumz
6ecfa0ef3e cosmetic fix: looks like a copyNpaste issue 2010-09-08 20:48:37 +02:00
Mathias Gumz
26c1cd0cee code simplification 2010-09-08 20:48:01 +02:00
Mathias Gumz
690d926ac4 introduced FbTk::BidiString
a 'BidiString' holds both the logical content and the visual reordered
version of the content of a string. this helps to reduce the number of
calls to reorder the string before drawing it (as introduced in the patch
from Ken Bloom) and to be more consistent in menus and textboxes (drawing
cursors and underlining text).
2010-09-08 20:17:21 +02:00
Mathias Gumz
8feb0b8c83 avoid constructing new strings implicit 2010-09-05 10:49:05 +02:00
Mathias Gumz
83656fc0e8 cosmetic 2010-09-05 10:47:12 +02:00
Mathias Gumz
63f9c8c1a2 reuse temporary memory for reencoding / reordering fribidi-strings 2010-09-05 10:47:01 +02:00
Ken Bloom
ea98db4140 added support for bidirectional text 2010-09-04 15:01:33 +02:00
Mathias Gumz
b8987fc623 code simplification / deduplication
* parse the string only once for a bunch of chars to check instead of
  starting over again and again from the beginning, created a helper
  function to do this (FbTk::StringUtil::findCharFromAlphabetAfterTrigger)

* put same code into a function (setClockModeLabel())

* use much simpler code to switch between 12h and 24h mode and replace
  the fmt-switches
2010-08-24 17:30:24 +02:00
Jim Ramsay
a3b063292c bugfix: another crash when cleaning up signals
While 769130f51a did fix one issue, it introduced another by changing the
logic related to the new SignalTracker.  The original logic (introduced in
9ad388c5bf) was:
  -> in 'leave(Signal)', only call 'disconnect'
  -> in 'leaveAll()', call 'disconnect' and 'disconnectTracker'
But 769130f51a inverted this, calling 'disconnectTracker' in both cases but
only 'disconnect' in the 'leaveAll()' case, which would leave unattached signals
around after calling 'leave(Signal)'.

This fix not only repairs the logic, but renames the ambiguous 'disconnect'
boolean to something more explicit: 'withTracker'.
2010-07-14 11:36:00 -04:00
Mathias Gumz
769130f51a bugfix: do not use invalid iterators while looping thru a container which gets destroyed 2010-05-23 15:58:35 +02:00
Mathias Gumz
fbcdd34b22 mostly cosmetic fixes, mainly discovered by 'clang --analyze'
reordering of Resource-related stuff was because of

   "error: explicit specialization of 'getString' after instantiation"

complaints.
2010-05-23 12:25:47 +02:00
Mathias Gumz
ff9c68e247 fixed potential memory leak 2010-05-16 14:25:59 +02:00
Mathias Gumz
17b21635a2 cleanup created corner pixmaps, moved the initCorners() function out of the class 2010-05-16 14:25:36 +02:00
Mathias Gumz
04739b2d1f initialize all member variables, otherwise unclean state in some circumstances
(valgrind complained a lot about ::updateGeometry() accessing uninitialized variables)
2010-05-16 14:24:34 +02:00
Mathias Gumz
bca59851f3 bugfix: crash when cleaning up signals
22fa5f544b was not fixing anything, the real cause is that the
SignalHolder still has a reference to a not existing Tracker.
2010-05-07 09:36:30 +02:00
Mathias Gumz
615e9cec32 compile fix: FD_ZERO (sys/select.h) on solaris wants to use memset(); closes #2997117 2010-05-06 21:19:31 +02:00
Mathias Gumz
22fa5f544b bugfix: added missing 'virtual' keyword, otherwise fluxbox crashes with 'pure virtual method called' 2010-05-06 20:25:47 +02:00
Henrik Kinnunen
9ad388c5bf Added Tracker interface for SignalHolder.
This is used by SignalTracker so Signals can disconnect from it when
they die.
2010-03-26 18:04:58 +01:00
Henrik Kinnunen
1cae9f22f8 Minor fix for argument reference in MemFunSelectArgImpl 2010-03-26 18:00:23 +01:00
Henrik Kinnunen
5bc782561b Initialize all variables in FbWindow 2010-03-26 17:28:18 +01:00
Henrik Kinnunen
f150f727b2 Added SelectArg.hh to Makefile.am 2010-03-19 02:32:17 +01:00
Henrik Kinnunen
ceff86b794 Added SelectArg and MemFunSelectArg*
The MemFunSelectArg* functions can be used to select
a specific argument from a signal. For example this would
select the string argument as argument to the callback:

Signal<void, int, float, string> signal;
signal.connect(MemFunSelectArg2(obj, &Object::takesOneStringArg));
signal.emit(10, 3.14, "hello");

...

void Object::takesOneStringArg(const string& value) {
...
}
2010-03-19 02:23:41 +01:00
Henrik Kinnunen
68e90ab84f Added missing RelaySignal.hh to Makefile.am 2010-03-18 19:47:14 +01:00
Henrik Kinnunen
02bb93590c Added FbTk::relaySignal, which relays new signals to old Subject type signals. 2010-03-18 19:35:19 +01:00
Henrik Kinnunen
18570d83a2 minor cleaning in MemFun.hh 2010-03-18 10:56:15 +01:00
Henrik Kinnunen
0504de454a Added MemFunIgnoreArgs which ignores aditional arguments.
For example connecting a function that takes two arguments
to a signal that emits three arguments:
struct Functor {
    void show(int a, int b);
};
Functor f;
Signal<void, int, int, int> s3;
s3.connect(MemFunIgnoreArgs(f, &Functor::show));
2010-03-18 10:45:33 +01:00
Mathias Gumz
254bc96daf fixed little preprocessor error 2010-02-27 10:33:06 +01:00
Mathias Gumz
c65dc30fc2 improved documentation of the code 2010-01-19 20:20:13 +01:00
Mathias Gumz
46261a8284 implemented 'MoveN' and 'ClickN' support in keys file.
the hardcoded 'OnTitlebar Mouse1 :Raise' (see Window.cc, FluxboxWindow::buttonPressEvent())
is disabled for now, should be added to fluxbox-update_configs
2009-12-18 08:05:07 +01:00
Mark Tiefenbruck
8def80cec3 reportedly fix compiling on gcc 4.4 on Solaris 2009-10-08 00:18:43 -07:00
Mathias Gumz
6645688880 definition should match declaration 2009-10-03 13:53:13 +02:00
Mathias Gumz
69bf3965b7 compile fixes for sun compiler 5.10: class Layer conflicts with class FbTk/Layer .. so just a little renaming 2009-10-03 13:53:00 +02:00
Mathias Gumz
f2ea245f1d compile fixes for sun compiler 5.10: complains about 'not beeing able to initialize this from that' 2009-10-03 13:38:41 +02:00
Mathias Gumz
261ba26d27 another little helper for FbTk::StringUtil: extractNumber() 2009-10-01 21:16:46 +02:00
Mathias Gumz
4eeac74a3d removed unused code 2009-10-01 08:58:56 +02:00
Mathias Gumz
65a45dc65f compile fix: missing include guards 2009-10-01 08:57:46 +02:00
Mathias Gumz
c4c96ec830 simpler code 2009-10-01 08:57:31 +02:00
Mathias Gumz
078438e993 compile fix: missing headers (sun compiler complained about) 2009-10-01 08:41:04 +02:00