Commit graph

4491 commits

Author SHA1 Message Date
Thomas Lübking
f6132b7602 explicitly set s_focusedWindow for cycle protection 2016-07-30 15:10:21 +02:00
Thomas Lübking
87c0182ea5 Do not reset cycle focus when unsetting focus only 2016-07-30 15:10:21 +02:00
Thomas Lübking
635f14e5c9 Do not protect focus while cycling
We've better things to do and the focus is moving around anyway
BUG: 1048
2016-07-30 15:10:21 +02:00
Thomas Lübking
2758485d35 do not lock focus against unfocusing.
Latter happens when eg. closing windows, including such with
locked focus
2016-07-30 15:10:20 +02:00
Thomas Lübking
34bf7d31c4 prefer m_cycling_next over s_focused_window
as cycle start (former is where we wanted to go and X11 is still async)
2016-07-30 15:08:41 +02:00
Thomas Lübking
4bc08709f1 allow to force moveResize and use on applyState
applyState also requires some updates implied by moveResize, notably the
reconfigure, the setBackground on the window etcetc.
Instead of testing what'd be missing from a moveResize, we just force
the latter to apply even when seeming unrequired.

This has notable impact when switching fullscreen state for a window
with fullscreen dimensions.

BUG: 992
2016-07-30 11:22:24 +02:00
Thomas Lübking
ed75e883db clear selection on text input
Entering upcase chars would auto-select them
Seems I don't need upcase chars very often ;-)
2016-07-23 16:58:04 +02:00
Thomas Lübking
abd5c9e478 smart handling of NotifyUngrab crossing events
closing a keyboard driven popup had the sideeffect to return the focus
where the pointer is, regardless of whether that window had the focus
before (due to a NotifyUngrab crossing event), bug #597
This was resolved by simply ignoring NotifyUngrab mode crossings, but
that had the unfortunate sideeffects to break focus passing when the
mouse was actually moved (in a DnD operation, 730) or the focus shall be
passed on for strict mouse focus and a mouse triggered lower action (1012)

So instead we record the window that was last entered by a *real*
crossing and only ignore the NotifyUngrab event if this window didn't
change.

BUG: 1012
BUG: 730
CCBUG: 597
2016-07-03 09:29:07 +02:00
Thomas Lübking
ca452a5886 ignore font for empty title height calculation
and align calculation on init and reconfigure

As a result, if a menu has no label, the title height is determined
only by menu.titleHeight (and the border sizes), not by the unused font.
2016-07-01 20:14:04 +02:00
Thomas Lübking
ea306493f9 re-fix alt+tab'bing through tabbed windows
commit 98313bf broke (i'm terribly sorry) this because m_cycling_last stores
the first client in a tabgroup, thus cannot be abused for this purpose.
So we explicitly store a value and btw. do it before sending the focus,
ie. "in time" for sure instead of "for sure™"
2016-07-01 19:42:28 +02:00
Thomas Lübking
e85cf49035 fix tabbing of unfocusable clients
this affects all java clients, because java uses the retarded
WM_TAKE_FOCUS protocol, but also very important clients like xeyes ;-)

BUG: 1055
2016-07-01 19:42:22 +02:00
Thomas Lübking
2aba567ea6 do not leave stale oplock behind
deiconify'ing a client on a different workspace left an oplock by a
shortcut return, turning the client semi- to inaccessible

BUG: 1010
2016-07-01 19:42:14 +02:00
Thomas Lübking
9d34cdbfa9 avoid calling into XLib
Testing one bug, the function seems usually be called with the root
window as parameter, so we can save a pointless lookup for the root of
the root by testing against window before testing against window_root.

Elegantly, this will "fix" the bug where XGetGeometry of the second
heads root will either report the first heads root or some junk (xephyr
case?)

BUG: 1128
2016-07-01 19:41:59 +02:00
Thomas Lübking
9dccccb84d ensure to update the current client tab from menu
the menu focuses which tries to set the current tab, but fails because
the iconified client won't have the input focus (yet), so we pass it a
dedicated "set this client and do not try to set input because we're
going to do next anyway explicitly" call =)

BUG: 997
2016-07-01 19:41:16 +02:00
Thomas Lübking
0951134ced do not move unfocused windows to the desktop layer
While usually™ the window is just reset to its original layer, ensuring
to show the active window is certainly a good idea, but it's not
required to lower the fullscreen window to the desktop layer, the other
windows layer + an extra raise is entirely sufficient and it's rather
odd to see conky when activating a utility window to a video player ;-)

CCBUG: 894
2016-07-01 19:40:55 +02:00
Thomas Lübking
666e7b0337 add _NET_WM_NAME to FbWindow::setName
since fluxbox is a f**** WM it should be able to use f**** NETWM hints
in its toolkit ;-)

CCBUG: 702
(does not fix input)
2016-07-01 19:40:47 +02:00
Thomas Lübking
475e966f19 fix tab selection by mousepress
Tabs outside the titlebar are not selectable by mouseclicks (ie. the
feature does not work)
The patch clones the enterNotifyEvent code and ignores (for now) the
actual button (no idea whether it makes any sense to restrict it the
left button?)

BUG: 1103
2016-07-01 19:40:34 +02:00
Thomas Lübking
07d8fbfba8 merge remember focusnew into focusprotection
The FocusNewWindow key is still read, but not written and OVERRIDDEN in
case of conflict with the FocusProtection key
2016-06-26 16:35:26 +02:00
Thomas Lübking
1a61881ec3 Add FocusProtection features
The apps file gets a new key
FocusProtection
supporting a comma separated list.
* None : regular behavior
* Lock : If this window has the focus, no other may claim it
* Deny : This window is not allowed to focus itself

I addition there's preparation for a follow-up patch to incorporate and
substitute the present FocusNewWindow feature:
* Gain : Pass focus to new window
* Refuse : Do not pass focus to new window

rationale:
clients stealing the focus sucks badly and while there's an input driven
timeout, that only protects actual typing flow, but if eg. vlc proceeds on
the playlist, you'll suddenly control vlc instead of your browser
(ie. typing ctrl+w doesn't close the tab, but the playlist ...)
2016-06-26 16:35:16 +02:00
Thomas Lübking
69b0f0fa97 remove strut when property is withdrawn
CCBUG: 1133
2016-06-26 16:31:37 +02:00
Thomas Lübking
bfe4737427 fix tracking of MWM hints in case of removal 2016-06-26 16:31:22 +02:00
Thomas Lübking
dcdde4d32c replace FbRootWindow::depth with maxDepth
The depth member of FbWindow was abused to store the maximum depth
but that gets overridden with geometry changes of the root window
(screen layout changes) so we store and read the value explicitly while
::depth() maintains the actual depth of the root window

The result of this is that frames for ARGB windows were created with a
wrong depth and failed to reparent the client window.

BUG: 1102
BUG: 1058
2016-06-26 16:29:34 +02:00
Thomas Lübking
484c33bf25 prevent clients from positioning out of workspace
Still enough stupid ones around which ask for 0,0
(despite there's a panel ...) or restore a position
on a VGA screen which they stored while being on a 4k
screen.

Otoh, do not forcefully position the window just because
the topleft position is outside any head, this can still
be desired and isn't a problem.
Actually, the corner could be covered by the close button
and if *only* it is onscreen the window can hardly by used
or seen.
2016-06-26 16:21:02 +02:00
Thomas Lübking
6201286cdf keep cmd menus off struts when the mouse is in it
the mouse is likely the trigger, so the popup would cover the
trigger item.
The present behavior of the iconbar suggests such behavior is
desired.
2016-06-26 16:16:04 +02:00
Mathias Gumz
b9ed1c16de improve consistency
for a std::string::size_type, the right value to use is not "-1", but
std::string::npos.
2016-05-28 16:57:43 +02:00
Mathias Gumz
a9e17d4091 fix broken text selection for FbTk::TextBox
uninitialized variables cause all kind of problems.
2016-05-28 16:52:28 +02:00
Thomas Lübking
98313bfb91 harden focus cycling against client focussing
Clients which implement a client-side modality might cause
livelocks by reverting the focus to the transient (after the
WM tried to put it on the leader as the transient's modality
is unknown)

So while cycling we revert the focus whenever it moves somewhere
where we don't expect it.
When done, we also focus the window that should have the focus anyway
to allow the client to redistribute the focus (as we prevented it
during cycling)

Hall of Shame: Softmaker Freeoffice uses (only) client side modality.
2016-05-28 11:05:45 +02:00
Juan Gonzalez Lopez
5d90b7984c Fix menus over a single column wide
Fixes menus more than 1 column wide (such as the Placement menus for
the Toolbar/Slit/Tabs) which stopped working with commit 3e4570b.
2016-04-25 19:30:38 +02:00
Thomas Lübking
58b50fb786 Allow text selection
FbTk::TextBox now acts like any contemporary input field ;-)
2016-04-25 19:04:13 +02:00
Thomas Lübking
2e8766174e place transient centered on its parent
so far, transients are simply unplaced, resulting in a static
0,0 position.
2016-04-06 21:54:26 +02:00
Arkadiusz Bokowy
53de872163 Mixed relative and absolute values for apps
Allow setting relative value for x and y or width and height separately in
the apps configuration file. This makes these settings compatible with ones
available in the keys file.

Previous buggy behavior:
If someone has specified, e.g. "[Dimensions] {50% 100}" it was parsed as
"{50% 100%}" not as "{50% 100px}" which was inconsistent with the "keys"
configuration file.

From now on it is possible to write something like this:
[app]
  [Position] (RIGHT) {50% 0}
  [Dimensions] {300 100%}
[end]

Signed-off-by: Arkadiusz Bokowy <arkadiusz.bokowy@gmail.com>
2016-02-28 14:55:36 +01:00
Mathias Gumz
3c06e9e93f minor code cosmetics 2016-01-09 18:30:22 +01:00
foobar0815
6346368b58 send ConfigureNotify using root coordinates 2016-01-09 17:45:23 +01:00
Nephiel
1f1d43bdbf Add Resize Snap
Make windows snap to edges when resizing them, as well as when moving.
From http://darkshed.net/files/patches/fluxbox/fluxbox-resize-snap-try2.diff
2016-01-04 21:17:26 +01:00
Mathias Gumz
3e4570becc merge pull-request 14 2016-01-04 20:41:01 +01:00
Ken Moore
a1f647d09c Update MinOverlapPlacement.cc
Skip any windows which are not in the same layer as the window to be placed.
2015-07-29 12:26:15 -04:00
Ken Moore
5905c4623e Update ColSmartPlacement.cc
Skip any window that is not in the same layer as the window to be placed.
2015-07-29 12:22:22 -04:00
Ken Moore
17f8a936ce Update RowSmartPlacement.cc
Skip any window that does not exist in the same layer as the window to be placed.
2015-07-29 12:17:51 -04:00
Peter Ganzhorn
69d13337fe Fix hidden toolbar placement 2015-05-14 14:50:34 +02:00
Mathias Gumz
169d640610 Simplify code
* assume 'pattern' to always be lowercase
* rename some variables
2015-05-02 15:45:16 +02:00
Mathias Gumz
533c9a2aa5 Fix bug in detecting text in MenuSearch
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-02 14:04:50 +02:00
Lajos Koszti
c8a1c67494 Make sure render new styles into full menu
Different styles makes the menu width different.
When the original menu width is bigger than the newly selected style's
width, the rendering produces pretty strange effects:
The old style's frame not cleared, so it was rendered and visible next
to the new style edge.

With this change, the menu width will be as wide as the widest menu
item.

Style switching still not perfect, because the height of a menu item is
from the "first" selected menu, also font color are not updated.
2015-05-01 22:16:03 +02:00
Peter Ganzhorn
e117f5acd6 Fix RIGHTCENTER placement of the toolbar. Instead of subtracting borderwidth (bw) from (frame.height))/2 they were multiplied causing wrong placement for this case. 2015-05-01 14:19:58 +02:00
Peter Ganzhorn
949e973dd2 Shape only toolbar corners not touching any edges of the screen. It just looks better this way. 2015-05-01 14:19:49 +02:00
Peter Ganzhorn
95b7c77409 Fix shaped toolbar being drawn incorrectly at TOPCENTER Fix round corners being drawn incorrectly on the TOP instead BOTTOM of the toolbar when toolbar placement is TOPCENTER. Also align the _values[] table a bit more nicely to make it easier to spot bugs like this. The bug was introduced in commit 67c31b49bd 'Refactor Toolbar.cc, less noise'. 2015-05-01 11:24:25 +02:00
Mathias Gumz
5b6fe35287 roll back 7e17056: m_index does not exist anymore
m_index was removed in 03ce82a.
2015-05-01 10:50:50 +02:00
Mario J. Rugiero
dce4721c84 TextBox::textStartPos can be const. 2015-05-01 10:46:21 +02:00
Mario J. Rugiero
6aff2f7c28 ButtonTheme::name can be const. 2015-05-01 10:46:21 +02:00
Mario J. Rugiero
9667d538eb Make Layer::getLayerNum() const. 2015-05-01 10:46:21 +02:00
Mario J. Rugiero
7e17056c35 Initialize m_index in MenuItem's constructors. 2015-05-01 10:46:21 +02:00
Mario J. Rugiero
2238c004aa Reduce the scope of the variable err in stringTokensBetween. 2015-05-01 10:46:21 +02:00
Mario J. Rugiero
2275e1e6e4 doSubmenu function in menutest.cc avoids copying labelstr by using a const reference. 2015-05-01 10:46:21 +02:00
Mario J. Rugiero
bf607341da addMatching and insertFromParent functions from FocusableList now avoid copying m_parent->clientList() and use a const reference instead. 2015-05-01 10:46:21 +02:00
Mario J. Rugiero
63f89cb433 Pass pre_command to CommandDialog as const reference to avoid unnecessary copying. 2015-05-01 10:46:20 +02:00
Casey Dahlin
79a358346a Don't assume ICONV_NULL = 0
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-04-11 08:25:59 +02:00
Arkadiusz Bokowy
e3300411eb Fix: typo during refactoring
Commit 63d9d69 introduced a bug, which has manifested itself by setting
window transparent state to the fully opaque (255).
2015-02-08 11:14:48 +01:00
Mathias Gumz
9f824b89fd Move internal code to internal side of FbTk::Transparent 2015-02-08 11:06:58 +01:00
Mathias Gumz
f84671ef8e Minor 2015-02-07 18:05:41 +01:00
Mathias Gumz
bd983fab55 Create buttons for titlebar with proper sizes
Instead of creating the titlebar buttons with a size of 10x10 pixels
and rely on resizing later on we now pick the correct dimensions
right on.

This fixes also bug #1125 ("Detaching a window from a tab-group renders
app-icon to 1/2"); the problem also occurred on restart.

I took the chance to refactor a little bit.
2015-02-07 17:59:37 +01:00
Mathias Gumz
c30b75091a Fix glitch of TabOptions menu 2015-02-07 11:46:00 +01:00
Mathias Gumz
9814549fb3 Show toggleitems in menu 2015-02-07 10:13:43 +01:00
Mathias Gumz
17bd806337 Cosmetic 2015-02-07 10:09:24 +01:00
Mathias Gumz
1bacaa7ecb Boyscouting 2015-02-07 09:41:38 +01:00
Mathias Gumz
046092d166 Fix cleaning exposed menu items 2015-02-07 09:38:22 +01:00
Mathias Gumz
8834435bd0 Avoid signed/unsigned woes; minor cleanup 2015-02-07 09:30:28 +01:00
Mathias Gumz
a649a45ed8 Add uncommited #include "MenuSearch.hh"
Note to myself: less gitting at late hours.
2015-02-06 07:31:04 +01:00
Mathias Gumz
92940571f3 Cleanup; Remove unused function 2015-02-05 21:35:02 +01:00
Mathias Gumz
0da4be2a01 Feature: different MenuSearch modes
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-05 21:30:44 +01:00
Mathias Gumz
e79228cc08 Fix problem with too small WinButtons
Under some circumstances a WinButton might be tiny (1x1 pixel). Substracting
values > 1 yields either 0 or something reaaaaly big (UINT_MAX). This will
make fluxbox either crash or make it act weird. We don't want this.
2015-02-04 21:06:51 +01:00
Mathias Gumz
53b3120b32 Move nls globals into #ifdef NLS 2015-02-04 21:06:32 +01:00
Mathias Gumz
461d4b7dbd Fix crash: click the Remember-menu works again
This commit fixes a subtle regression introduced by myself in
f64727ca: WinClient wc = FbMenu::window()->winclient() creates a
copy and this copy gets cleaned up at the end of the scope. What
I really wanted was a reference.
2015-02-01 19:41:07 +01:00
Mathias Gumz
c207226a32 Fix regression: use proper texture for the grips 2015-02-01 09:40:49 +01:00
Mathias Gumz
e1359adfd0 Cosmetic 2015-02-01 08:07:26 +01:00
Mathias Gumz
fff0abad76 Improve I18n support
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-31 21:37:44 +01:00
Mathias Gumz
0a87632032 Clean up FbTk::I18n API
Move private stuff into FbTk/I18n.cc.
2015-01-31 12:04:30 +01:00
Mathias Gumz
f8b9c9a211 Fix sometimes missing windowmenu
When the windowmenu file is empty in ~/.fluxbox/init the code falls
back to the default. In ab2eef4 I forgot to set the rc_path which
caused this bug to happen.
2015-01-30 22:09:27 +01:00
Mathias Gumz
bf43ba16c4 Use strncpy() instead of strcpy() 2015-01-29 11:52:00 +01:00
Mathias Gumz
37e8c1e93e Use strncpy() instead of strcpy() 2015-01-29 11:46:57 +01:00
Mathias Gumz
129d0ac31e Make fluxbox strcat() free
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-29 11:43:05 +01:00
Mathias Gumz
8b44c7a184 Simpler code to set _NET_DESKTOP_NAMES
gcc-4.2.1 on OpenBSD-5.6 hinted that strcpy() is not the safest function on
earth. While seeing the code I wondered why it we first create copies
of the names at all (let alone using memset() and then strcpy() after it).
2015-01-29 11:38:48 +01:00
Mathias Gumz
8e5a10ea6c Compiler boyscouting: init order 2015-01-28 21:44:20 +01:00
Mathias Gumz
876500a259 Fix correctness of string search
The lookup for the skip value needs to be based upon the lowercase version of
the current byte.
2015-01-28 21:42:05 +01:00
Mathias Gumz
aa39a1a666 Fix mishandled [maxmized] statement in apps file
In f64727ca I removed one 'else' too much. As a result all [maximized] lines
were mapped to MAX_NONE. Fixed.

The rest of the commit is just some cosmetic to reduce indentation and shorten
function names, easier to read.
2015-01-28 20:28:58 +01:00
Mathias Gumz
03ce82a473 Feature: typeahead in menu matches text anywhere
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-28 16:02:59 +01:00
Mathias Gumz
75cf246de5 Cleanup 2015-01-24 10:36:00 +01:00
Mathias Gumz
e0c5436f44 Improve code documentation
'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-24 10:35:21 +01:00
Mathias Gumz
00cca1284f Fix text rendering in rotated TextButtons
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-24 10:31:38 +01:00
Mathias Gumz
67c31b49bd Refactor Toolbar.cc, less noise 2015-01-23 23:38:34 +01:00
Mathias Gumz
63d9d695be Refactor FbWinFrame
FbWinFrame is now simpler to read due to less overall noise.
2015-01-23 15:23:02 +01:00
Mathias Gumz
0d8a3dfb6b Cosmetic 2015-01-23 15:17:02 +01:00
Mathias Gumz
ab2eef4937 Add -no-slit and -no-toolbar flags
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-22 16:28:53 +01:00
Mathias Gumz
6fc392fb64 Remove 'always true' condition 2015-01-22 10:14:59 +01:00
Mathias Gumz
c0e5d1c7a3 Fix broken _NET_REQUEST_FRAME_EXTENTS support
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-22 10:14:12 +01:00
Mathias Gumz
5428edf3da Fix removing windows from icon list
std::remove_if() removes an item from a container and returns a
past-the-end iterator ... which equals m_icon_list.end(). As a result
the check

    if (erase_it != m_icon_list.end()) {
        iconList().erase(erase_it);
        iconListSig().emit(*this);
    }

will never succeed and thus the iconListSig() will never be emitted.
2015-01-22 10:09:08 +01:00
Mathias Gumz
1ec4fb6b6c Cosmetic 2015-01-22 09:45:35 +01:00
Mathias Gumz
6d749d6f1a Cosmetic 2015-01-21 22:16:38 +01:00
Mathias Gumz
e2dbdeeb2e Fix segfault on shutdown
There was a problem deep within how the menus were connected and when and
what gets deleted. It was clearly related to a menu which was kind of
global. In order to better understand the code flow I eliminated the
ExtraMenu code: it was used only to get the Remember-Menu into the
Window-Menu. Instead of having a singleton of the Remember-Menu and fight
against the shaky interconnections we just create a new one on demand
and delete when the menu gets deleted. Looks like this fixes the problem.

The menu code needs more love anyway.

Closes #1118
2015-01-21 22:16:19 +01:00
Mathias Gumz
145cf94ea6 Refactor: bundle related members together
Also: try to avoid unsigned/signed problems in drawing code.
2015-01-21 21:59:42 +01:00
Mathias Gumz
f64727caff Cosmetic: less code bloat 2015-01-21 21:54:30 +01:00
Mathias Gumz
dae7fca7cb Fix potential memory leak
If allocation of I2 does not succeed, we need to free I1.

Closes #1120
2015-01-21 21:53:00 +01:00
Mathias Gumz
980ab5e3f5 Fix behavior for autorepeat keys
This reverts 58e09b7190 after having regressions
and bug reports in regards to autorepeated key events are not working anymore.

So, the problem with the lost keypress after the workspace change is still
open but at least the behavior for other folks is as it was. Since 58e09b7190
seems to be corelated to "auto repeat" keys it might indicate the problem
which 58e09b7190 "fixed". We will see.

Fixes #1115.
2015-01-21 10:06:01 +01:00
Mathias Gumz
8e92ad53e0 Minor cosmetics 2015-01-21 10:02:38 +01:00
Mathias Gumz
2b70480b97 Fix compile errors with clang 2015-01-21 09:53:54 +01:00
Mathias Gumz
d3c960da99 Remove unused variable 2015-01-21 09:53:16 +01:00
Mathias Gumz
382d7be6f6 Fix compile error: old g++ does not like c-like struct initialization 2015-01-19 08:29:48 +01:00
Mathias Gumz
11566bbb83 Fix uncommited change (see 8387742c8...) 2015-01-16 13:08:53 +01:00
Mathias Gumz
5ede399d4d Fix casting issues 2015-01-16 10:52:38 +01:00
Mathias Gumz
772ec14595 Fix uninitialized variables; cosmetics
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-16 10:52:00 +01:00
Mathias Gumz
e37cad714c Avoid modulo 0
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-16 10:47:01 +01:00
Mathias Gumz
a65e9c686e Fix semantic errors (wrong variable names etc)
Uncovered by coverity-scan.
2015-01-16 10:38:32 +01:00
Mathias Gumz
df996370d0 Fix leak in ClientPatternTestCmd
Coverity-scan points to the leaking ClientPattern. The rest is just
cosmetics.
2015-01-16 10:36:14 +01:00
Mathias Gumz
b30438c311 Refactor: bundle xinerama-info together, simpler code
Part of this massive looking but simple rather simple change is a the way we
check for active Xinerama: XineramaIsActive() was used before. The docs for
XineramaQueryScreens() state that

    XineramaQueryScreens() returns NULL and sets number to
    0 if Xinerama is not active.

Sold.
2015-01-16 08:45:11 +01:00
Mathias Gumz
6d5781ce71 Refactor: move some menu-creation functions to MenuCreator
Another patch to trim down the code that needs to be part of BScreen
2015-01-16 08:39:05 +01:00
Mathias Gumz
b495878065 Reduce number of allocations for menu creation
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-16 08:36:49 +01:00
Mathias Gumz
bd9afcafb9 Refactor: split out menu generation from BScreen
Again, it's easier to read the code when the whole menu-generation is out of
the way.
2015-01-15 18:49:45 +01:00
Mathias Gumz
8387742c88 Refactor menu code: be more explicit and compact
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-15 14:25:05 +01:00
Mathias Gumz
dc9793c90a Code cleanup
Reorder some includes; remove unused includes
2015-01-10 22:57:00 +01:00
Mathias Gumz
b16528de87 Make use of API instead of hardcoded default font 2015-01-10 22:56:28 +01:00
Mathias Gumz
c47280236f Fix order of reconfigure the theme of an IconButton
The font might have an impact to the result of width() and height(). In order
to render the new pixmap correctly fluxbox now first sets the font and the
width of the border and after that it recreates the pixmap.
2015-01-10 22:53:37 +01:00
Mathias Gumz
09da97e6f3 Remove dead code 2015-01-10 22:51:57 +01:00
Mathias Gumz
7b8fd2d81a Fix bug: integer underflow in startup phase
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-10 22:51:04 +01:00
Mathias Gumz
d8c11d0852 Fix 'make check' 2015-01-05 21:38:14 +01:00
Mathias Gumz
f8d0bd4cb3 Fix build-system: install data files (keys, apps, menu ...)
* Correctly build data files when operate outside of the $(srcdir)
* Actually install data files
* Use pkg-config to detect X11, works better on MacOSX. We used pkg-config
  already anyway, double checking for X11 does not yield better results.
* Replace EXEEXT in some files while before installing them
2015-01-05 15:08:32 +01:00
Mathias Gumz
0820bcb640 Fix build-system: use xxx_LDADD instead of xxx_LDFLAGS
xxx_LDFLAGS place the libraries like '-lX11' or '-lXft' at the beginning of
the linker command. Some systems were not able to handle the situation and
this lead to a lot of unresolved symbols. Reading the documentation of
automake:

    ... you can use LDADD to do so. This variable is used to specify
    additional objects or libraries to link with; it is inappropriate for
    specifying specific linker flags, you should use AM_LDFLAGS for this
    purpose.

In addition we link against -lm in order to satisfy symbols refering to 'cos'
and 'sin'.
2015-01-04 16:21:02 +01:00
Nable 80
ad968e32b3 Fix to make clang happy
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-03 21:47:51 +01:00
Mathias Gumz
90f2fcf031 Minor API change for OSDWindow
OSDWindow::resize(const FbTk::BiDiString&) shadowed FbWindow::resize(x, y). To
fix this I renamed the function to OSDWindow::resizeForText() to make the
intention clear.
2015-01-03 21:45:14 +01:00
Mathias Gumz
3c85ace912 Fix signature ITypeAheadable::isEnabled() 2015-01-03 21:44:31 +01:00
Mathias Gumz
ccd86cfe9c Fix signature FbTk::FontImp::rotate() 2015-01-03 21:43:51 +01:00
Mathias Gumz
63f9a1637f Clean unused variables 2015-01-03 21:42:24 +01:00
Mathias Gumz
60e97b968b Fix clang warning 'expression with side effects' 2015-01-03 21:36:35 +01:00
Mathias Gumz
fb7bc7380d Fix number2*() functions
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-03 21:33:20 +01:00
Mathias Gumz
6fe7fbdc6b Remove dead / unused code
Again: Compiler happy, we are happy.
2015-01-03 18:50:20 +01:00
Mathias Gumz
65e0654249 Fix typo / editor bug or something like that.
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-03 18:45:28 +01:00
Mathias Gumz
bd519dd952 Remove various unused variables
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-03 18:43:44 +01:00
Mathias Gumz
11974fa40a Update copyright info 2015-01-03 18:40:55 +01:00
Mathias Gumz
3e76d43987 Use correct buffer size for number2*() 2015-01-03 18:39:09 +01:00
Mathias Gumz
4952718536 Fix build issue 2015-01-03 14:40:56 +01:00
Mathias Gumz
a8dfb56739 Remove reference to src/tests/testSignal 2015-01-03 14:39:59 +01:00
Mathias Gumz
376ed523cb Update release version 2015-01-03 14:07:34 +01:00
Mathias Gumz
2309751143 make use of FbTk-api 2014-10-27 13:46:32 +01:00
Mathias Gumz
c5fd69cc9d treat windows having WM_CLASS == "DockApp" like DockApps
this commit implements feature-request #317: "Add support for GTK dockapps.":

"Back in 2010, WindowMaker implemented a system where windows with WM_CLASS
res_class = DockApp would be treated as if they had initial_state =
WithdrawnState, since GTK refuses to allow this."
2014-09-29 09:26:52 +02:00
Arkadiusz Bokowy
ed7bcc5dbc Corrections for border width for relative resize 2014-09-29 09:06:03 +02:00
Arkadiusz Bokowy
786d8bacc0 Code cleanup
File name expansion is done internally by the Slit::loadClientList, so there
is no need to duplicate the code.
2014-09-14 19:09:11 +02:00
Mathias Gumz
f0a178f515 fix: check the correct XClassHint property
kudos to Arkadiusz Bokowy (this commit is a slightly changed version
of a patch sent to the devel-ml): when retrieving the '.res_name' of
a XClassHint we should check '.res_name' and not '.res_class'.

the other changes only reduce the code.
2014-09-14 17:52:29 +02:00
Mathias Gumz
026343b6b1 fix uninitialized variables 2014-07-22 22:25:47 +02:00
Mathias Gumz
5f45524211 fix _NET_MOVERESIZE_WINDOW resize issue (#1108)
handing over the dimensions of a WinClient client must not contain properties
of the FbWinFrame, otherwise they get added twice in
FbWinFrame::moveResizeForClient() and thus result in a resizes when no resize
is wanted.

other changes: it's easier for me to detect the nth bit when the value looks
like (1 << 8) instead of 0x0100 (for the 8th bit). that is why i changed
0x0100, 0x0200 etc. in the nearby code.
2014-07-22 22:03:33 +02:00
Mathias Gumz
f3e82cae83 allow a timeout of a full 'unit'
the -1 in the FbTk::FbTimer::remainingNext() function was pointless in the
first place anyway: reducing the timeout by just 1 microsecond improves
nothing (in this case). if the timer triggers exactly at a full unit (second)
then it's correct to wait for the full next unit.
2014-05-12 12:28:31 +02:00
Mathias Gumz
6700eb354f cosmetic, less code 2014-05-12 12:27:46 +02:00
Mathias Gumz
948e63eb60 detect minute-based strftime-formats (again)
the lag / skipping of the clock was not caused by faulty timer code
on fluxbox's side but by the behavior and inner workings of time().
since this is fixed now (913244789f) we can now rollback ec7fe513c8
and detect strftime-formats which need intervals of seconds or minutes.

minor: the small change to FbTk::Timer::setTimeout() reduces one
start() / stop() cycle for a running timer.
2014-05-12 12:17:00 +02:00
Mathias Gumz
913244789f fix clocktool lagging behind and skipping seconds
from time to time (...) time() might be off to gettimeofday() by a
second. the reason for this is that time() is usually implemented
by just returning the field 'second' of the struct that represents
the clock inside the kernel. gettimeofday() on the other hand also
takes the 'fraction' field (mostly 'nanoseconds') into account and
thus is closer to the current time than time().

the result of using time() was a perceived 'lag', sometimes the
clocktool even skipped a second. by using FbTk::FbTime()::system()
instead fixes the issue.
2014-05-12 10:22:49 +02:00