aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
AgeCommit message (Collapse)AuthorFilesLines
2015-05-02Fix bug in detecting text in MenuSearchMathias Gumz1-1/+1
A bug sneaked into my implementation of Boyer-Moore-Horspool. This lead to not finding certain patterns. Given the text 'abcdde' and the pattern 'dd', the faulty implementation would not find 'dd': 1. 'ab' does not match, skip 2 (length of pattern) 2. 'cd' does not match, skip 2 (length of pattern) <- the bug. 3. 'de' does not match, end of string The bug in step 2 is to not use 'd' to detect how far to skip but to use 'c' (which is not in the skip-table) and thus 2 bytes are skipped).
2015-05-01roll back 7e17056: m_index does not exist anymoreMathias Gumz1-6/+1
m_index was removed in 03ce82a.
2015-05-01TextBox::textStartPos can be const.Mario J. Rugiero1-1/+1
2015-05-01Make Layer::getLayerNum() const.Mario J. Rugiero1-1/+1
2015-05-01Initialize m_index in MenuItem's constructors.Mario J. Rugiero1-1/+6
2015-05-01Reduce the scope of the variable err in stringTokensBetween.Mario J. Rugiero1-2/+2
2015-04-11Don't assume ICONV_NULL = 0Casey Dahlin1-5/+9
We define the value ICONV_NULL = -1, but when we attempt to set the s_iconv_convs array to all NULL values, we zero the array instead of setting its entries to -1. This patch properly initializes and wipes s_iconv_convs.
2015-02-08Move internal code to internal side of FbTk::TransparentMathias Gumz2-20/+23
2015-02-07MinorMathias Gumz1-2/+2
2015-02-07Show toggleitems in menuMathias Gumz1-5/+7
2015-02-07CosmeticMathias Gumz1-27/+36
2015-02-07BoyscoutingMathias Gumz2-4/+0
2015-02-07Fix cleaning exposed menu itemsMathias Gumz1-30/+24
2015-02-07Avoid signed/unsigned woes; minor cleanupMathias Gumz1-80/+64
2015-02-06Add uncommited #include "MenuSearch.hh"Mathias Gumz1-0/+1
Note to myself: less gitting at late hours.
2015-02-05Cleanup; Remove unused functionMathias Gumz2-7/+1
2015-02-05Feature: different MenuSearch modesMathias Gumz6-146/+292
Fluxbox now supports three MenuSearch modes: * NoWhere - essentially "disabling" the menu search. * Somewhere - the search string matches somewhere. * ItemStart - the search string matches at the start of a menu item. The default value is "ItemStart", just in the good old times. As long as this feature is not configurable via the menu it would irritate users with distinct muscle memory who type without thinking OR checking the visual feedback: they would trigger items they did not intent to trigger after years of the old behavior. Once this feature get's an entry in the config menu the default value might change.
2015-02-04Move nls globals into #ifdef NLSMathias Gumz1-3/+8
2015-01-31Improve I18n supportMathias Gumz1-44/+121
Among the first steps to produce better i18n support is to test the created translations adhoc without running "make install". To achieve this, fluxbox now honors several environment variables: - NLSPATH: fluxbox won't create the absolute path to the catalog and thus catopen() is free to use NLSPATH as described in the manpage. Example given: "/tmp/%N" will pick "/tmp/fluxbox.cat". %N refers to FLUXBOX_CATFILE. - FLUXBOX_CATFILE: By setting FLUXBOX_CATFILE the users can make fluxbox to use a different name for the catalog file. Default: "fluxbox.cat" - FLUXBOX_CATDIR: Per default fluxbox tries to find FLUXBOX_CATFILE at several places. Setting this environment variable allows to point fluxbox to a different search path for the catalog files. Then, fluxbox tries catopen() first without changing the deduced catalog file name. After that it applies some heuristics to get a good catalog file name.
2015-01-31Clean up FbTk::I18n APIMathias Gumz2-118/+102
Move private stuff into FbTk/I18n.cc.
2015-01-29Use strncpy() instead of strcpy()Mathias Gumz1-1/+1
2015-01-29Make fluxbox strcat() freeMathias Gumz1-39/+41
Again, gcc-4.2.1 of OpenBSD-5.6 pointed out the use of strcat(). I took the chance to explain the reasons for the code a little bit.
2015-01-28Compiler boyscouting: init orderMathias Gumz1-4/+4
2015-01-28Fix correctness of string searchMathias Gumz1-1/+1
The lookup for the skip value needs to be based upon the lowercase version of the current byte.
2015-01-28Feature: typeahead in menu matches text anywhereMathias Gumz9-550/+381
This commit implements a tweak to the typeahead feature already existent in fluxbox: If the user opens up a menu and starts typing, fluxbox tries to detect matching menu items and makes them available for quick selection. The typed pattern is now search also in the middle of the text. I opted to strip down the code quite a bit and remove complexity by throwing out FbTk::TypeAhead and FbTk::SearchResult because I do not see the need for a general solution when the only use case for such a feature is in fluxbox' menus. FbTk::ITypeAheadable shrunk down to 2 functions; the whole file might be combined with the code that implements FbTk::Menu::TypeSearch. FbTk::Menu::setIndex() and related code is also gone: the position of each menu item is defined by it's position in the items container. This reduces the mount of book keeping fluxbox has to do. Fewer moving parts is a good thing. It's possible that users start to complaint because they expect their typed pattern to match only at the beginning of the text OR that some demand other tweaks. We will see. This commit also fixes a regression introduced by 8387742c. The bug made the menu vanish.
2015-01-24Improve code documentationMathias Gumz2-16/+24
'width' might imply something 'aligned horizontally'. The first parameter of maxTextLength() is given in pixels. To avoid confusion, the name of the parameter is changed. The comment before the binary search reflects better why and what we need to do.
2015-01-24Fix text rendering in rotated TextButtonsMathias Gumz1-5/+12
A vertically rotated text should be checked against the height of the button, not the width of it. Fixes #1119 ("Toolbar cannot display full text of workspace/​clock/​window title.")
2015-01-22Add -no-slit and -no-toolbar flagsMathias Gumz1-2/+1
Sometimes fluxbox is used as a component of a desktop environment ( e.g., the "Lumina Desktop"). It's easier and more stable for this kind of "users" to disable the toolbar or the slit alltogether. Why not configure these features out? Because then they would need 2 installations of fluxbox: One without the slit and the toolbar (and perhaps other components) and one with them. This implements feature request #314, at least partially. This commit also looks bigger than it actually is: I refactored and cleaned up classes Fluxbox and BScreen.
2015-01-22Remove 'always true' conditionMathias Gumz1-1/+1
2015-01-22Fix broken _NET_REQUEST_FRAME_EXTENTS supportMathias Gumz2-13/+14
There was a subtle flaw in the way fluxbox detects to which BScreen a given Window belongs: We have to compare the RootWindow of the given Window against the RootWindow of each BScreen. That underlying flaw made _NET_REQUEST_FRAME_EXTENTS fail: the code path needs a valid BScreen for the given window, otherwise we return early. Closes #1121.
2015-01-21Refactor: bundle related members togetherMathias Gumz2-220/+211
Also: try to avoid unsigned/signed problems in drawing code.
2015-01-21Fix potential memory leakMathias Gumz1-11/+3
If allocation of I2 does not succeed, we need to free I1. Closes #1120
2015-01-16Fix uncommited change (see 8387742c8...)Mathias Gumz1-1/+1
2015-01-16Fix casting issuesMathias Gumz1-2/+2
2015-01-16Fix uninitialized variables; cosmeticsMathias Gumz5-42/+22
Note: I expect only modern compilers will hit the source of fluxbox. It seems futile to guard stdlib headers while demanding <algorithm> etc. This should trim down the noise in the source quite a bit.
2015-01-16Avoid modulo 0Mathias Gumz1-0/+4
Coverity pointed out that 'size' might be 0 (even if the 'find()' would detect this). This commit fixes this and avoids entering 'find()' at all.
2015-01-16Reduce number of allocations for menu creationMathias Gumz2-7/+29
Every time either the Slit menu or the Toolbar menu were added to the root menu, the whole root menu was (re)created from scratch. Now we create and remove only the menus needed. Side effect: the position of these menus is now at the end of the root menu and not somewhere in between. If users complaint, I' ll think about it.
2015-01-15Refactor menu code: be more explicit and compactMathias Gumz2-133/+117
This commit is a preparation step for some menu cleanup ahead. To make it easier to understand which types of MenuItems are added where and when, I converted the overloaded FbTk::Menu::insert() functions into explicit ones (Menu::insertSubmenu(), Menu::insertItem(), etc. ). This makes it possible to just grep for 'insertSubmenu()'. Side effect this commit: it trims down the very verbose creation of menu items in regards to how the labels are created. Minor: FbTk::Menu::shown and FbTk::Menu::s_focused are moved out of the class.
2015-01-10Code cleanupMathias Gumz3-53/+20
Reorder some includes; remove unused includes
2015-01-10Remove dead codeMathias Gumz2-20/+0
2015-01-10Fix bug: integer underflow in startup phaseMathias Gumz1-1/+7
When fluxbox comes up some of it's drawables span a 1x1 area. Subtracting from such small numbers bigger ones always lead to massive problems when 'unsigned int' are involved: 'button_width' is an unsigned int of '1' (this might be caused by another issue or on purpose, anyway), subtracting -10 or any other number should result in something < 0 when in reality an integer underflow happen: max_width is now MAX_INT-something big. This makes fluxbox crash under certain circumstances. This fixes bug #1116.
2015-01-03Fix to make clang happyNable 801-3/+5
POSIX states that 'd_name' in 'struct dirent' is char[], so it cannot be NULL. This will result in the compiler complainting about an expression which always evaluates to true ... for this compiler (clang). But in some implementations 'd_name' is a 'char*' that's why it's better to keep the check for possible NULL.
2015-01-03Fix signature ITypeAheadable::isEnabled()Mathias Gumz1-1/+1
2015-01-03Fix signature FbTk::FontImp::rotate()Mathias Gumz1-1/+1
2015-01-03Clean unused variablesMathias Gumz4-7/+1
2015-01-03Fix number2*() functionsMathias Gumz1-7/+7
As correctly pointed out by 'Nable80': "%llx" does not create the 0x prefix for the hex-string. In addition to that: snprintf() adds a terminating \0.
2015-01-03Remove dead / unused codeMathias Gumz2-78/+5
Again: Compiler happy, we are happy.
2015-01-03Fix typo / editor bug or something like that.Mathias Gumz1-1/+1
While running code analysis tools this issue popped up. As it is written it is clearly a NOP, but the reason for why it is written that way remains unknown. I suspect that it was a textfragment introduced by some repeat-function of the used editor (think '.' in VIM). The code was introduced by commit a932a7a801 and looked like this in the original form: if(!XQueryTree(FbTk::App::instance()->display(), window().window(), &root_return, &parent_return, &children_return, &nchildren_return)) parent_return=parent_return;//return; Look at the outcommented return statement. I decided to return from that function instead of the NOP.
2015-01-03Remove various unused variablesMathias Gumz1-1/+0
Clang and Gcc-4.9 complaint about some unused variables here and there. And who are we to not make a compiler happy :)
2015-01-03Use correct buffer size for number2*()Mathias Gumz1-3/+6