Iain Patterson [Mon, 14 Sep 2009 13:37:15 +0000 (14 14:37 +0100)]
Mac OS X-style window cycling.
For those not familiar with the way Macs cycle windows, the Command-Tab
sequence (Alt-Tab elsewhere) switches between DIFFERENT application windows
and Command-Grave (key above tab) switches between windows owned by the
SAME application as is currently focused. So if you had three Safari and
two Finder windows open, and Safari had focus, Command-Tab would switch to
Finder; Command-Tab would switch back to Safari; Command-Grave would switch
to a different Safari window etc.
This patch implements "something like" the above by only populating the
switchpanel with windows matching the currently-focused WWindow's wm_class
when the new cycling mode is activated. In practice this means you can
switch to The Next XTerm or The Next Firefox Window using this method.
The configuration names for these new shortcuts are GroupNext and
GroupPrev. The patch tells WPrefs.app about them. Of course switching to
The Next Window is still possible with the (unchanged) FocusNext and
FocusPrev keys.
Iain Patterson [Mon, 14 Sep 2009 13:13:58 +0000 (14 14:13 +0100)]
Support Xinerama in wmsetbg.
Allow wmsetbg to revert to pre-0.90.0 behaviour when choosing a
background image that is large enough to span several heads in a
Xinerama setup. If the -X flag is passed to wmsetbg, the background
image will be stretched to fill the logical screen (as it would be by
default in older versions of wmsetbg) instead of being tiled across
screens.
Iain Patterson [Mon, 14 Sep 2009 12:28:37 +0000 (14 13:28 +0100)]
Pad workspace name display.
Shift the workspace name, shown when switching workspaces, by 32
pixels. This is purely for aesthetic reasons. It just looks better
(IMO) than having the name flush against the screen edge.
Iain Patterson [Mon, 14 Sep 2009 11:59:10 +0000 (14 12:59 +0100)]
Constrain switching workspace name to one head.
When switching workspaces, force the name to be shown entirely within
one head of a Xinerama display. Previously the name would span heads if
set to TOP, CENTER or BOTTOM alignment, and was hence hard to read when
the display comprised an even number of heads.
Carlos R. Mafra [Mon, 14 Sep 2009 14:34:37 +0000 (14 16:34 +0200)]
Add Maximus key back in WPrefs.app
Somehow I had forgotten to include this change in version 2
of the patch.
Carlos R. Mafra [Mon, 14 Sep 2009 13:57:52 +0000 (14 15:57 +0200)]
Fix the use of uinptr_t
Remove the additional cast to (int), as that makes no sense.
Alexey Voinov [Mon, 14 Sep 2009 00:07:20 +0000 (14 02:07 +0200)]
x86_64 mmx fixes
This patch combines two small patches which fix issues with x86_64 and mmx in
the configure script.
Submitted by: Gilbert Ashley
Author: unknown?
Origin: ALT/Sisyphus Linux, Alexey Voinov <voins@altlinux.ru>
Nicolas Bonifas [Sun, 13 Sep 2009 20:28:40 +0000 (13 22:28 +0200)]
Un-maximize window inside current head
If the old_geometry coordinates were saved while the window
was in another xinerama head, use current coordinates as
the old ones to avoid making the window jump heads when
un-maximizing it.
Nicolas Bonifas [Sun, 13 Sep 2009 20:28:40 +0000 (13 22:28 +0200)]
Maximus: Use unsigned int for width/height variables
And move its prototype to actions.h (and also that of
save_old_geometry()).
Nicolas Bonifas [Sun, 13 Sep 2009 20:28:40 +0000 (13 22:28 +0200)]
Remove commented code in xinerama.c
Tamas TEVESZ [Sun, 13 Sep 2009 19:05:57 +0000 (13 21:05 +0200)]
Remove bundled wrlib stuff
This patch removes bits and pieces of xmu that for some reason
have been bundled with wmaker. I can very well imagine that at the time
they were bundled, xmu was not, was not available everywhere, or
whatever.
I couldn't come across a system that doesn't have these things in its
system-supplied x libs, though i've been carrying this since january,
and my memory is quite flakey at times.
certainly nothing xorg is at danger, nor xfree86 dating back to at
least 3.3. i believe this stuff should be everywhere that calls itself
to be on par with x11r6.3 at the very least.
it would be incredibly useful if people having access to commercial
unixes could check this on things released in the past, say, 15 years.
i believe back then i had solaris 8+and sco openserver 5+ covered.
Nicolas Bonifas [Sat, 12 Sep 2009 17:45:58 +0000 (12 19:45 +0200)]
Maximizing a resized window
When a maximized window is resized (either using wmaker or because the
application changed the window size), and you want to maximize it again,
you first have to unmaximize it (because wmaker thinks the window is still
maximized), and only then you can maximize it. The following patch
corrects this behaviour.
Carlos R. Mafra [Sun, 13 Sep 2009 16:28:42 +0000 (13 18:28 +0200)]
Make left/right maximization work again
The patch "Clean up maximization and un-maximization logic" introduced
a regression wrt to the left/half maximization feature, due to a C
operator order precedence issue.
Carlos R. Mafra [Sun, 13 Sep 2009 14:05:55 +0000 (13 16:05 +0200)]
Ansify function declaration
Carlos R. Mafra [Sun, 13 Sep 2009 10:59:25 +0000 (13 12:59 +0200)]
Delete stale .cvsignore files
BERTRAND Joel [Thu, 10 Sep 2009 18:30:06 +0000 (10 20:30 +0200)]
Fix miniwindows auto-arranging bug
With this patch, minimized windows do not reshuffle anymore.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=361241
where Martin Hinsch reported:
"The behaviour of icons (minimized applications) is severely broken when
automatic placement is switched on.
* When switching the workspace icons often stick thereby covering (and
hiding) icons on the workspace one is switching to.
* After minimizing an application, clicking (singly or doubly) on one of
the icons causes all of them to reshuffle, usually in a way that the
icon in question changes its place (which is extremely annoying).
* Icon placement ignores the dock so that icons disappear behind
it/cover it.
All of these suddenly appeared about a year ago (I think with 91.0). The
problems are not architecture-specific since they occur in exactly the
same way on my pentium machine. Wiping the complete configuration (rm -r
~/GNUstep) did not make a change either."
Andreas Tscharner [Tue, 8 Sep 2009 21:05:35 +0000 (8 23:05 +0200)]
Fix compilation failure
This fixes a compilation failure with gcc-4.3.4, where it complains
nxpm.c: In function RGetImageFromXPMData:
nxpm.c:99: error: expected expression before ] token
...
Alexey Voinov [Tue, 14 Aug 2007 10:35:24 +0000 (14 14:35 +0400)]
Fix session saving for apps with shared appicons
This patch comes from
http://git.altlinux.org/people/raorn/packages/WindowMaker.git
Carlos R. Mafra [Fri, 4 Sep 2009 13:02:00 +0000 (4 15:02 +0200)]
Reduce the number of simultaneous inotify events
There is no point in having a buffer capable of 512 simultaneous events,
as it will typically be only 1. But increase the value for the length
of the path + filename to 64 (which is a reasonable size for a
typical /home/something/GNUstep/Defaults/WMRootmenu filename).
Alexey Voinov [Tue, 14 Aug 2007 11:32:00 +0000 (14 15:32 +0400)]
Christmas does not last forever
From https://bugzilla.altlinux.org/show_bug.cgi?id=3480
"If you open "Info Panel" on 25 dec (Christmas), the
"Christmas tree" is shown. And after that on all days
Christmas tree is shown. (Until you restart WM, i think)"
Taken from http://git.altlinux.org/people/raorn/packages/WindowMaker.git
Carlos R. Mafra [Thu, 3 Sep 2009 20:27:25 +0000 (3 22:27 +0200)]
wmrlib: Avoid code duplication
We can put common repeated code into a helper function, and
increase readability a bit.
Alexey I. Froloff [Tue, 24 Mar 2009 14:06:00 +0000 (24 17:06 +0300)]
Remove alloca(3)
And use malloc() instead.
See "Dropped useless use of alloca(3)" from
http://git.altlinux.org/people/raorn/packages/WindowMaker.git
Alexey I. Froloff [Sun, 29 Mar 2009 12:53:00 +0000 (29 16:53 +0400)]
Atomic save for session
This patch is part of "Atomic saves for history and session" from
http://git.altlinux.org/people/raorn/packages/WindowMaker.git
Alexey Voinov [Tue, 14 Aug 2007 11:15:37 +0000 (14 15:15 +0400)]
Add history to some dialog boxes
This patch adds history to some dialog boxes. To use it replace %a with
%A in menu file (like in "Run..." menu item). You can specify third
parameter to %A to use different histories for differen dialogs.
All history files is kept in ~/GNUstep/.AppInfo/WindowMaker/ and the number of
history lines controlled by DialogHistoryLines parameter (one for
all dialogs) defaults to 500 lines.
It also adds Tab completion.
Origin: ALT/Sisyphus Linux, Alexey Voinov <voins@altlinux.ru>
Sebastien Bauer [Thu, 3 Sep 2009 02:08:58 +0000 (3 04:08 +0200)]
Add option to allow starting DockApps with a single click
This patch is from the contrib directory. It adds an option to allow starting
DockApps with a single click. It's a handy option that adds only a few lines to
the code.
It is a good feature patch example because it includes modifications
to the WPrefs application so that the feature can be easily enabled or
disabled. The one-click ability allows wmaker to integrate more seemlessly with
programs like ROX-Filer which can be configured to use single or double click
actions.
The README in the contrib/ directory says,
author:
Sebastien Bauer <seb_bauer@bigfoot.com>
John Morrissey <jwm@horde.net>
updated for Window Maker 0.65.0 by:
Daniel Richard G. <skunk@graphics.lcs.mit.edu>
updated for Window Maker 0.80.2 by:
Martial Daumas <martial@nasgaia.org>
update for 0.80.2+ by:
steve lion <steve.lion@verizon.net> and vlaad
Carlos R. Mafra [Tue, 1 Sep 2009 01:22:57 +0000 (1 03:22 +0200)]
Clean up maximization and un-maximization logic
We should not try to un-maximize the windows from inside
the function wMaximizeWindow(), as that makes no sense.
If the window is already maximized then we don't call
wMaximizeWindow() anymore and call wUnmaximizeWindow()
instead, which will use the old geometry regardless
of which maximization is active (horizontal, vertical,
maximus, etc). And the old geometry now is also saved
when we enter wMaximizeWindow().
So when we call wMaximizeWindow() or wUnmaximizeWindow()
we really mean "maximize to the specified state" or
"go back to whatever old geometry coordinates we had before".
Carlos R. Mafra [Tue, 1 Sep 2009 23:37:47 +0000 (2 01:37 +0200)]
Maximus: Tiled Maximization
This patch introduces the "tiled maximization" feature, a.k.a. Maximus.
By pressing the keyboard shortcut associated with Maximus, the focused
window will be maximized to the greatest area satisfying the constraint
of not overlapping existing windows.
Daniel Déchelotte [Tue, 1 Sep 2009 22:05:46 +0000 (2 00:05 +0200)]
Fix for omnipresent AppIcon bug at startup
Bug overview: right after start up, omnipresent AppIcons (living in the Clip)
are displayed but non-functionnal.
How to reproduce it: place two AppIcons in the Clip, make the first one (A)
omnipresent and leave the second one (B) as is. Make the Clip "autocollapse".
Switch to the second workspace and restart wmaker. Wmaker starts in the first
workspace; the Clip is closed (its text color corresponds to the closed state,
AppIcon B is not shown). However, AppIcon A is displayed. Moreover, A does
not react when the Clip expands or collapses. Finally, a click on A makes it
disappear. Fortunately, changing to another workspace fixes the problem
definitively.
Explanation and correction: internally, wmaker maintains as many clips as
workspaces. When the user switches to another workspace, the omnipresent
AppIcons are moved to the new "current" clip. In the situation above (trying
to reproduce the bug), when wmaker restarts, the omnipresent AppIcons are
restored in the second workspace, whereas the first workspace is active. In
the previous code, a "hack" (calling XMapWindow()) unconditionally displayed
the omnipresent AppIcons. The proposed patch makes sure the omnipresent
AppIcons are moved to the first workspace on wmaker startup.
Tamas TEVESZ [Mon, 31 Aug 2009 18:50:30 +0000 (31 20:50 +0200)]
Clean up #ifdef mess
Use enum instead of #ifdef maze for enumerating keybindings
Daniel Déchelotte [Tue, 1 Sep 2009 07:22:37 +0000 (1 09:22 +0200)]
Gobble "spurious" EnterNotify events when moving an appIcon or a dock
This is a bug fix. Bug overview: if an AppIcon is moved rapidly over a Clip
set to auto-expand, the latter may erroneously auto-expand afterwards.
How to reproduce it: set a Clip to auto-collapse, and make sure it contains a
(random) AppIcon, so as to easily visualise its open/close state. Now move
rapidly an AppIcon over the Clip. Try to move it so fast that the cursor
sometimes is out of the AppIcon's tile. Then, replace the AppIcon out of the
Clip.
Explanation and correction: if, while the AppIcon was being moved, the mouse
cursor entered at least once in the Clip's tile, the latter is going to
receive an EnterNotify event (after the AppIcon is replaced) and thus expand
automatically after the relevant delay. The solution is to simply "gobble"
(i.e., ignore) all EnterNotify events when moving an AppIcon.
klaasvakie [Mon, 31 Aug 2009 21:33:36 +0000 (31 23:33 +0200)]
Fix half_scr_width calculation
Moved the half_scr_width calculation to after the
usableArea = wGetUsableAreaForHead(scr, head, &totalArea, True);
call. This fixes the problem where windows that get "half screen
maximized" cover the dock or clip.
Carlos R. Mafra [Sat, 29 Aug 2009 23:46:50 +0000 (30 01:46 +0200)]
Use half_scr_width instead of computing it each time
Let's use
half_scr_width = (usableArea.x2 - usableArea.x1)/2;
to shorten the expressions in the left/right half maximize
code.
Carlos R. Mafra [Sat, 29 Aug 2009 18:02:04 +0000 (29 20:02 +0200)]
Increase the readability of wUnshadeWindow() and wShadeWindow() a little bit
Instead of open coding the animation routines in the function bodies,
put them in a helper function called shade_animate(wwin, what), whose
second argument can be SHADE or UNSHADE.
Carlos R. Mafra [Sat, 29 Aug 2009 16:46:05 +0000 (29 18:46 +0200)]
Trivial coding style changes
Some trivial style changes I made while reading src/placement.c
Tamas TEVESZ [Fri, 26 Dec 2008 07:31:55 +0000 (26 08:31 +0100)]
k&r->ansi some stuff
ansify and "fix" function pointer declarations
Johann Haarhoff [Fri, 28 Aug 2009 19:31:26 +0000 (28 21:31 +0200)]
Left Half / Right Half Maximize
This adds Left Half / Right Half Maximize capability to WindowMaker.
It allows you to maximize a window to only the left or right half
of your screen.
It is useful on widescreen displays where one might to bring up
two different windows side-by-side.
Carlos R. Mafra [Fri, 28 Aug 2009 18:59:47 +0000 (28 20:59 +0200)]
Define TITLEBAR_HEIGHT in default configuration file
...and use it in src/placement.c
And while we are at it, clean up a bit the visual of wconfig.h.in
Carlos R. Mafra [Fri, 28 Aug 2009 14:44:54 +0000 (28 16:44 +0200)]
Make wmaker 0.11% smaller by avoiding code duplication
This patch cleans up an obvious code duplication case in the
different "placement" algorithms.
Avoid this needless repetition by using a helper function,
which in turn lets those functions a bit easier to read and
also makes wmaker 0.11% smaller :-)
[mafra@Pilar:wmaker.git]$ size src/.libs/wmaker.*
text data bss dec hex filename
619824 19160 8544 647528 9e168 src/.libs/wmaker.new
620552 19160 8544 648256 9e440 src/.libs/wmaker.old
Martin Dietze [Fri, 28 Aug 2009 16:52:26 +0000 (28 18:52 +0200)]
Nightly Build script can now deal with testing and unstable branches.
Gilbert Ashley [Wed, 26 Nov 2008 15:27:19 +0000 (26 16:27 +0100)]
Show app name in Kill Application dialog
The "Kill Application" dialog window doesn't always show the
application name when killing DockApps. It shows its wm_class
instead, which is not always the same as the app name.
This patch allows the Kill Application dialog window to show
the application name in the window -- as expressed by using the
basename of the path to the application.
[crmafra: Added wtokensplit() to get only the app name]
Vladimir Nadvornik [Tue, 17 Feb 2009 10:55:33 +0000 (17 11:55 +0100)]
Miscellaneous fixes from OpenSuse
These are some of the fixes sent to the wmaker-dev list by
Vladimir Nadvornik, with minor modifications to address Dan
Pascu's concerns.
Original-post: http://lists.windowmaker.info/dev/msg00293.html
Carlos R. Mafra [Tue, 25 Aug 2009 19:15:35 +0000 (25 21:15 +0200)]
Add config option to supress focus requests across workspaces
In commit
d6c134f420bfa1cd6b6a9474d01548933b559901 ("Do not switch
workspace to follow new windows in others") the default behavior
was changed, and workspace switching to follow focus requests was
strictly forbidden.
Although that seems to be a sane thing to do by default, that raises
concerns about whether Window Maker could be more flexible in that
respect -- allowing the user to choose which applications are or
are not allowed to do that.
This patch adds such configuration, located in the "Advanced Options"
submenu of the top-level "Attributes" menu.
Martin Dietze [Wed, 26 Aug 2009 11:32:15 +0000 (26 13:32 +0200)]
Adapted nightly build script to coexist with new 'next' branch.
Martin Dietze [Wed, 26 Nov 2008 14:56:33 +0000 (26 15:56 +0100)]
Fix NULL pointer dereference
Some weird applications like Safari for Windows running on CXOffice
or some applications running on Wine were causing wmaker to crash.
So let's not rely on a window's `frame' property to be not NULL in
src/wmspec.c.
Original-post: http://lists.windowmaker.info/dev/msg00161.html
See-also: http://lists.windowmaker.info/dev/msg00222.html
Martin Dietze [Mon, 24 Aug 2009 19:40:47 +0000 (24 21:40 +0200)]
Do not switch workspace to follow new windows in others
New windows should only be focused if they are in the current workspace.
Not performing this check can lead to WM switching workspaces if a
window is opened which:
(a) is configured to appear in a particular workspace
and
(b) sends a _NET_ACTIVE_WINDOW message to give focus to
something, e.g. a sub window.
This behaviour was observed with firefox if a session with more
than one tab open was restored at startup because:
"If a Client wants to activate another window, it MUST send a
_NET_ACTIVE_WINDOW client message to the root window:"
Original-post: http://lists.windowmaker.info/dev/msg00442.html
[crmafra: Added comment]
Martin Dietze [Mon, 24 Aug 2009 08:20:05 +0000 (24 10:20 +0200)]
Add debianisation code and automatic build script
Martin Dietze [Mon, 24 Aug 2009 08:10:37 +0000 (24 10:10 +0200)]
Add two menu files from the Debian package
Martin Dietze [Mon, 24 Aug 2009 08:10:03 +0000 (24 10:10 +0200)]
Add GLOBAL_DEFAULTS_SUBDIR and fix a syntax error in wmlib/Makefile.am
Martin Dietze [Mon, 24 Aug 2009 08:09:26 +0000 (24 10:09 +0200)]
Up the version number for the GIT version to 0.93.0-pre
Tamas TEVESZ [Fri, 26 Dec 2008 07:38:18 +0000 (26 08:38 +0100)]
Fix format strings
Alexey Voinov [Wed, 14 May 2008 10:04:40 +0000 (14 14:04 +0400)]
swpanel: Consider also the release of FOCUSPREV
The switch panel was not being destroyed with the realease of
FOCUSPREV, only with FOCUSNEXT. Fix this.
One can reproduce this bug as follows.
In the "Keyboard Shortcut Preferences" of WPrefs set "Focus next window"
to e.g. "Alt+Tab" and "Focus previous window" to "Ctrl+Tab".
The switchpanel is not destroyed if we release "Ctrl+Tab" but it
is upon releasing of "Alt+Tab".
Retrieved-from: http://git.altlinux.org/people/voins/packages/?p=WindowMaker.git;a=commit;h=
51c95a55c9310f499b1fdeca138106ca7bf74423
[crmafra: Commit log]
Carlos R. Mafra [Sun, 23 Aug 2009 16:25:59 +0000 (23 18:25 +0200)]
Remove LITE config option
Why?
1. The reason for its existence is to "Disable some stuff that are
duplicated in kde", and I don't think I will ever need that.
Furthermore, even the description in the configure script reads
"disable some stuff (dont use it)".
2. It makes the code uglier at some places, e.g.,
#ifdef LITE
{
#if 0
}
#endif
#else
if (!wRootMenuPerformShortcut(event)) {
#endif
which by the way is the ugliness which motivated this patch.
3. Does not even compile anymore. It fails with
CC dockedapp.o
CC event.o
event.c: In function 'executeButtonAction:
event.c:711: error: WScreen has no member named root_menu
event.c:712: error: WScreen has no member named root_menu
event.c:713: error: WScreen has no member named root_menu
event.c:715: error: WScreen has no member named root_menu
event.c:720: error: WScreen has no member named switch_menu
event.c:721: error: WScreen has no member named switch_menu
event.c:722: error: WScreen has no member named switch_menu
event.c:724: error: WScreen has no member named switch_menu
make[2]: *** [event.o] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
But instead of fixing this (it would be trivial), let's get
rid of the whole ugliness altogether.
Carlos R. Mafra [Sun, 23 Aug 2009 15:28:04 +0000 (23 17:28 +0200)]
Add spaces to gcc 'case' range extension
According to the gcc manual, that is safer.
Carlos R. Mafra [Sun, 23 Aug 2009 13:15:29 +0000 (23 15:15 +0200)]
Fix function prototype declaration
It is safer if the functions are declared with proper
prototype specifications.
This patch addresses some of the warnings with -Wstrict-prototype,
like this:
event.c:105: warning: function declaration isn't a prototype
Pedro Martelletto [Fri, 17 Aug 2007 17:43:25 +0000 (17 10:43 -0700)]
WPrefs: Fix crash due to wtokenfree() memory leak fix
After the fix to avoid a memory leak in wtokenfree(), WPrefs crashes
when opening the 'Applications Menu Definition' dialogue.
The problem is that WPrefs code relied on the fact that the first token
in the array would not be free'd by wtokenfree(), a misbehaviour which
is correctly addressed with this patch.
Retrieved-from: http://www.mail-archive.com/ports@openbsd.org/msg12731.html
[crmafra: small changes in the commit log from the webpage]
Tobias Stoeckmann [Sun, 18 Feb 2007 02:47:47 +0000 (18 03:47 +0100)]
WINGs: Fix memory leak in wtokenfree()
wtokenfree() does not free the first entry of an array.
If count is 1 then
while (--count)
will be
while (0)
and the inner body of that while-loop will not be entered.
Therefore a memory leak happens every time wtokenfree() is called.
Retrieved-from: http://paldium.homeunix.org/tobias/wmaker/patches/
[crmafra: This patch, altough correct, breaks WPrefs.app, which will be
fixed by the next patch. ]
Nicolas Bonifas [Sat, 22 Aug 2009 10:24:58 +0000 (22 12:24 +0200)]
swpanel: Start with the first window when all are minimized
When all windows are minimized, the switch panel cursor is
initially on the second window in the list. With this patch
it will be on the first window.
Carlos R. Mafra [Sat, 22 Aug 2009 01:03:14 +0000 (22 03:03 +0200)]
swpanel: Fix stacking issue with swpanel escape handling
Daniel Déchelotte reported one problem with the escape handling in
the switchpanel:
"Start with two windows: a fullscreen one, and a smaller window
that appears above the fullscreen one. With the mouse, focus the
bigger window. Start alt-tabbing, then press Escape. The bigger
window will then be focused (good) *and raised* (small problem)."
Fix this by adding a test for the escape key before calling
raiseWindow().
Carlos R. Mafra [Sat, 22 Aug 2009 00:55:45 +0000 (22 02:55 +0200)]
swpanel: Factor out if (swpanel) test
We can remove redundand tests in each "case:" inside the
switch if we do it in the beginning.
Carlos R. Mafra [Sat, 22 Aug 2009 00:46:17 +0000 (22 02:46 +0200)]
swpanel: Clean up "case ButtonRelease"
Get rid of 2 tabs indentation by removing a
not-strictly-necessary temporary variable.
Carlos R. Mafra [Sat, 22 Aug 2009 00:34:25 +0000 (22 02:34 +0200)]
swpanel: Clean up StartWindozeCycle() a bit more
We can put the test for 'newFocused' inside change_focus_and_raise()
to clean up the code a little bit.
Tobias Stoeckmann [Sun, 18 Feb 2007 13:48:33 +0000 (18 14:48 +0100)]
Fix multiple errors in findfile.c
Problems:
1.
During expansion of path, the resulting path can overflow the supplied
area of PATH_MAX+2 (buffer as well as buffer2). A tampered environment
variable can be used to modify program flow.
Proof:
[note: wmaker has been compiled with propolice]
$ export A="[tested with 4096x A]"
$ GNUSTEP_USER_ROOT="\$A\$A/\$A/\$A/" wmaker --for-real
*** stack smashing detected ***: wmaker terminated
Aborted
2.
Way too many functions handle a return value of NULL for wexpandpath
improperly, resulting in segfaults (and maybe other problems). To
prove the existance of these issues:
Proof:
$ GNUSTEP_USER_ROOT=~nouser wmaker --for-real
wmaker error: could not get password entry for user nouser: Success
Segmentation fault
Solution:
hard exit with error message about what is going on.
3.
The improper parsing of environment variables can lead to expansion
of path names that were not intended to be expanded.
(a) If a string like "$(var" is found, Window Maker tries to expand "var"
(environment variable) although the syntax is wrong.
Proof:
$ export PROOF=foo
$ GNUSTEP_USER_ROOT=/\$\(PROOF wmaker --for-real
wmaker warning: could not find user GNUstep directory (/foo/Defaults/WindowMaker).
(b) If the variable out of a) cannot be resolved, a closing bracket will be
added.
Proof:
$ unset PROOF
$ GNUSTEP_USER_ROOT=/\$\(PROOF wmaker --for-real
./wmaker warning: could not find user GNUstep directory ($(PROOF)/Defaults/WindowMaker).
Author: Tobias Stoeckmann
Retrieved-from: http://paldium.homeunix.org/tobias/wmaker/
Submitted-by: Gilbert Ashley <amigo@ibiblio.org>
Daniel Déchelotte [Sun, 5 Mar 2006 18:41:47 +0000 (5 19:41 +0100)]
Remove useless tests
There is no point in checking
if (dock_state)
if the function would have already returned with
the check if(!dock_state) right above.
Retrived from http://yo.dan.free.fr/wmaker.phtml.en
[crmafra: wrote the commit message]
Carlos R. Mafra [Fri, 21 Aug 2009 00:20:27 +0000 (21 02:20 +0200)]
Fix use of uninitialized variable
Gcc-4.3.2 warns:
texture.c: In function 'wTextureMakeFunction':
texture.c:393: warning: 'fallbackColor.pixel' is used uninitialized in this function
Based on a patch by Vladimir Nadvornik.
Vladimir Nadvornik [Fri, 21 Aug 2009 00:09:34 +0000 (21 02:09 +0200)]
Less strict font requirements
Fixes bug:
https://bugzilla.novell.com/show_bug.cgi?id=154758
Vladimir Nadvornik [Thu, 20 Aug 2009 23:49:24 +0000 (21 01:49 +0200)]
Fix findBestIcon()
This patch fixes the issue described here:
https://bugzilla.novell.com/show_bug.cgi?id=371974
Daniel Déchelotte [Sun, 5 Mar 2006 18:42:57 +0000 (5 19:42 +0100)]
Fix "smart" placement bug when there are shaded windows in other workspaces
Bug overview:
New windows are sometimes mis-placed when the "smart" algorithm is used.
How to reproduce it:
be sure (with WPrefs.app, for instance) to use the so-called "smart"
window placement algorithm. In an empty workspace, open a first window
(for instance, an xterm). The window should appear at the upper left corner.
Shade it (hide its contents below its title bar by double-clicking on it)
and select another empty workspace. Open another window. Instead of placing
it at the exact same place as the first window, wmaker places the new
window a little bit lower, or frankly to the right.
Explanation and correction:
when placing a new window, wmaker avoided all shaded windows, instead of
only avoiding the shaded windows on the active workspace.
Daniel Déchelotte [Tue, 18 Aug 2009 22:50:49 +0000 (19 00:50 +0200)]
Fix focus issues with the switch panel and auto-focus
1. Setup two windows in a workspace, one at the center and the
other at a corner. Move the mouse to the center of the screen, so
that the focus goes to the center window. Now, with the help of the
keyboard (with Alt-tab, typically), try and switch the focus to the
other window. In doing so, the switch panel shows up, gives the
focus to the other window and then disappears. However, its
disappearance make it seem to wmaker that the mouse has just
entered the center window, so wmaker gives the focus to that
window again.
2. It is a lit bit more involved. "Raise window when switching
focus with keyboard" needs to be set. In a given workspace, maximize
a first window A, then setup "above" window A two windows B and C
(one in the upper left corner and the other one in the lower right
corner, for example). Move the mouse so as to give the focus to
window B. Press the Alt key, hit the key tab once (window A moves
up to the "top"), then another time (window C is then selected).
Eventually relase the Alt key: window B is given the focus again.
Correction: it is a matter of ignoring some (EnterNotify) events
when the switch panel is active or has just been used.
Carlos R. Mafra [Thu, 20 Aug 2009 14:00:26 +0000 (20 16:00 +0200)]
Escape key handling in switchpanel
Pressing the escape key (ESC) while the switchpanel is active
cancels it and gives the focus back to the window which had it
before the switchpanel was invoked.
If all windows are minimized before the switchpanel was called,
they will continue to be if ESC is pressed.
In other words, pressing ESC is like going to the parallel universe
where you never entered the switchpanel in the first place.
Based on a patch by Nicolas Bonifas from 17.08.2009.
Carlos R. Mafra [Thu, 20 Aug 2009 13:38:12 +0000 (20 15:38 +0200)]
Use helper function in StartWindozeCycle()
This way we avoid code duplication in 6 places.
This changes the previous behavior of the first
instance because the helper function has an extra
CommitStacking(scr);
compared to the original code. But it should not
hurt to have it.
Carlos R. Mafra [Thu, 20 Aug 2009 03:30:39 +0000 (20 05:30 +0200)]
Clean up coding style in StartWindozeCycle()
No functional changes were made apart from
setting the various KeyCode variables at the
same time as defining them.
Carlos R. Mafra [Thu, 20 Aug 2009 02:07:15 +0000 (20 04:07 +0200)]
Clean up StartWindozeCycle()
We can get rid of one overall tab by moving the
if(swpanel)
test -- which was done everytime in each individual case --
to the beginning, therefore encompassing all cases.
Carlos R. Mafra [Wed, 19 Aug 2009 22:59:40 +0000 (20 00:59 +0200)]
Change to the linux kernel coding style
for arq in `git ls-files *.c`; do
echo $arq;
indent -linux -l115 $arq;
done
The different line break at 115 columns is because
I use a widescreen monitor :-)
Carlos R. Mafra [Wed, 19 Aug 2009 15:50:01 +0000 (19 17:50 +0200)]
Make drawIconProc() static
It is used only inside src/dialog.c
Carlos R. Mafra [Wed, 19 Aug 2009 20:03:43 +0000 (19 22:03 +0200)]
Clean up case switching in handleKeyPress()
GCC has an extension to deal with ranges within case statements.
Let's use it to make the code more readable and ~5% smaller,
[mafra@Pilar:wmaker.git]$ size src/event.o.*
text data bss dec hex filename
13087 0 1056 14143 373f src/event.o.new
13711 0 1056 14767 39af src/event.o.old
Carlos R. Mafra [Tue, 18 Aug 2009 14:28:43 +0000 (18 16:28 +0200)]
Remove unsigned type from 'mask'
gcc-4.3.2 warns:
defaults.c: In function 'getModMask':
defaults.c:2586: warning: comparison of unsigned expression < 0 is always false
The line in question is
if (mask < 0)
and 'mask' is the return of wXModifierFromKey() which is an 'int' and can
indeed return a negative value (see src/xmodifier.c), so let 'mask' be
an 'int' too.
Carlos R. Mafra [Tue, 18 Aug 2009 13:14:00 +0000 (18 15:14 +0200)]
Sanitize calling sites of wDefaultsCheckDomains()
There is no point in having parameter in wDefaultsCheckDomains() and
not using it, so let's simply remove the parameter altogether and
avoid silly-looking things like
wDefaultsCheckDomains("bla");
Carlos R. Mafra [Tue, 18 Aug 2009 13:03:43 +0000 (18 15:03 +0200)]
Make loop variable be unsigned int
gcc was complaining in a few places things like:
defaults.c:890: warning: comparison between signed and unsigned
so let's just make the loop counting variables be unsigned, as
the never get negative anyway.
I also spotted other two variables which can be unsigned too.
Carlos R. Mafra [Tue, 18 Aug 2009 12:54:15 +0000 (18 14:54 +0200)]
Fix variable shadowing
gcc-4.3.2 warns:
defaults.c:3136: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:309: warning: shadowed declaration is here
and in a few other places too. Fix this by renaming 'index' to 'widx'.
Carlos R. Mafra [Tue, 18 Aug 2009 02:33:39 +0000 (18 04:33 +0200)]
WMCreateFont: Add missing wfree()'s
I removed (forgot) them when in commit
ee28b0257ab5 ("Avoid returning
font=NULL in WMCreateFont()"). Add them back.
Carlos R. Mafra [Mon, 17 Aug 2009 22:56:09 +0000 (18 00:56 +0200)]
handleKeyPress: Fix shadowing of global 'index' variable
GCC warns:
event.c: In function 'handleDestroyNotify':
event.c:676: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:309: warning: shadowed declaration is here
event.c: In function 'handleKeyPress':
event.c:1435: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:309: warning: shadowed declaration is here
So let's rename "index" to "widx".
Note that there is a more serious shadowing in this same function,
event.c:1686: warning: declaration of 'wwin' shadows a previous local
but this is more complicated to solve.
Carlos R. Mafra [Mon, 17 Aug 2009 22:30:17 +0000 (18 00:30 +0200)]
inotifyHandleEvents: Reduce buffer size to avoid huge memory consumption
inotifyHandleEvents() was allocating a buffer of size
(sizeof(struct inotify_event) + FILENAME_MAX)*1024
where FILENAME_MAX is #defined to be 4096 in stdio_lim.h, therefore
it was more than 4 MB!
Reduce it by using 16 instead of FILENAME_MAX and 512 instead of 1024.
Now valgrind does not complain about things like
Invalid write of size 8
at 0x42002F: inotifyHandleEvents (event.c:323)
by 0x7FF00020F: ???
Address 0x7febfc148 is on thread 1's stack
I also made some small coding style changes.
Carlos R. Mafra [Mon, 17 Aug 2009 20:42:38 +0000 (17 22:42 +0200)]
real_main: Use setenv() instead of putenv() in remaining places
It simplifies the code a bit.
Carlos R. Mafra [Mon, 17 Aug 2009 20:03:28 +0000 (17 22:03 +0200)]
real_main: Use setenv() instead of putenv()
When investigating possible memory leaks with 'valgrind' I noticed
this leak report:
602 bytes in 13 blocks are definitely lost in loss record 77 of 128
at 0x4C2362E: malloc (vg_replace_malloc.c:207)
by 0x4576ED: wmalloc (memory.c:88)
by 0x45B4F7: wstrconcat (string.c:214)
by 0x426FC2: main (main.c:608)
which happens here,
str = wstrconcat("WMAKER_BIN_NAME=", argv[0]);
putenv(str);
There is a comment further below (in another context)
/* return of wstrconcat should not be free-ed! read putenv man page */
so this leak report is probably a false positive anyway. However,
https://www.securecoding.cert.org/confluence/display/seccode/POS34-C.+Do+not+call+putenv%28%29+with+a+pointer+to+an+automatic+variable+as+the+argument
has some nice discussion about putenv() and after reading it I decided to
use setenv() instead, making 'valgrind' happy along the way. It also
makes the code a bit simpler, avoiding a call to wstrconcat().
I also changed the name of another variable called 'str' to 'pos', just
in case.
Carlos R. Mafra [Mon, 17 Aug 2009 16:13:58 +0000 (17 18:13 +0200)]
Fix improper use of function sentinel
This patch addresses this warning of gcc:
wfontpanel.c: In function 'listFamilies':
wfontpanel.c:588: warning: missing sentinel in function call
Fix it by using the 'NULL' pointer instead of 0 (zero) as the
sentinel.
For more information, see
http://www.linuxonly.nl/docs/2/2_GCC_4_warnings_about_sentinels.html
in particular,
"On most systems, there is no difference between 0 and (char *)0.
On 64 bit systems, however, the integer 0 is 32 bits and the
pointer 0 is 64 bits. The compiler does not know whether it is
an integer or a pointer, and defaults for the integer. This will
not clear the upper 32 bits and the function will not stop
scanning its parameters."
Note that here in my 64-bit Mandriva I don't need to cast (char *)NULL.
Carlos R. Mafra [Mon, 17 Aug 2009 15:44:00 +0000 (17 17:44 +0200)]
WPrefs: Remove unused function updateThemeList()
Carlos R. Mafra [Mon, 17 Aug 2009 15:35:48 +0000 (17 17:35 +0200)]
Remove unused variables
GCC -Wall complains about them.
Carlos R. Mafra [Mon, 17 Aug 2009 14:49:22 +0000 (17 16:49 +0200)]
Make compilation even less verbose
Add "-s" flag to MAKEFLAGS if --disable-verbose-compile
is enabled.
Carlos R. Mafra [Sun, 16 Aug 2009 09:14:40 +0000 (16 11:14 +0200)]
Remove prototype of unused function StartLogShell
Tamas TEVESZ [Wed, 24 Dec 2008 13:10:33 +0000 (24 14:10 +0100)]
Fix buffer overflow in SendHelperMessage()
The following fixes a buffer overflow in SendHelperMessage() which i
started seeing recently on x64.
John H. Robinson, IV [Sat, 13 Dec 2008 22:44:59 +0000 (13 14:44 -0800)]
Remove unused StartLogShell function.
Based upon a patch by Tobias Stoeckmann
Small code size reduction,
text data bss dec hex filename
620412 19144 8544 648100 9e3a4 src/.libs/wmaker
621347 19152 8544 649043 9e753 src/.libs/wmaker.old
Tobias Stoeckmann [Sat, 15 Aug 2009 22:16:58 +0000 (16 00:16 +0200)]
Check for argc==0 when calling wtokensplit()
The WINGs-function wtokensplit does not set argv to NULL if no string has been
split - instead argc is set to 0.
You can only observe this issue if you compile Window Maker without any
optimization:
compile Window Maker with CFLAGS=""
run Window Maker and save a session
change session-file and replace a 'command xyz' line with 'command " "'
restart Window Maker
watch "Fatal error"-message
Retrieved-from: http://paldium.homeunix.org/tobias/wmaker/
Submitted-by: Gilbert Ashley <amigo@ibiblio.org>
Iain Patterson [Sat, 15 Aug 2009 22:04:39 +0000 (16 00:04 +0200)]
xinerama switchpanel corruption fix
This is a small patch to fix an issue with the switchpanel and a large number
of windows which happens only on a Xinerama setup.
When the number of open windows is so large that displaying all of them would
cause the switchpanel to be too wide for the screen, the panel is supposed to
shrink and scroll to accomodate them all.
In Window Maker 0.92.0 this works for single head displays but not for
Xinerama. The panel extends to the next head and gets garbled. This patch fixes
the issue by correctly constraining the panel to the head with the cursor.
Submitted-by: Gilbert Ashley <amigo@ibiblio.org>
David Benbennick [Sat, 15 Aug 2009 18:02:35 +0000 (15 20:02 +0200)]
Fix mixing pixels when maximizing borderless windows
A minor bug has been bothering me for a long time. When you maximize a
borderless window in Window Maker, the window ends up too narrow and too short
by two pixels.
Submitted-by: Gilbert Ashley <amigo@ibiblio.org>
Samir SAADA [Sun, 19 Apr 2009 21:23:46 +0000 (19 23:23 +0200)]
Fix workspace limit segfault
wmaker keeps the names of all workspaces together in
the string 'buf' with fixed length of 1024, therefore
allowing buffer overflows if the number of workspaces
is big enough.
For the default names "Workspace X" (from 1 to 9)
and "Workspace XX" (from 10 to 99) etc, the approximate
number of workspaces necessary to make the buffer
overflow occur is 80, because
(11*9) + (71*12) + 80 = 1031
The fix is to set the size of 'buf' as
the maximum number of workspaces times their maximum
name length.
The problem was reported by John H. Robinson in the wmaker-dev
list ( http://lists.windowmaker.info/dev/msg00214.html ):
"http://www.youtube.com/watch?v=fkNJZvKwmhE
Michael reported a problem with Window Maker where it crashes with a
SIGSGV when trying to create an 82nd workspace.
/usr/local/WindowMaker-0.92.1pre/bin/wmaker warning: Window Maker exited
due to a crash (signal 11) and will be restarted.
I was able to reproduce it by making 81 workspaces, then creating an 82nd."
[ crmafra: Wrote the changelog ]
Tamas TEVESZ [Sat, 27 Dec 2008 16:45:38 +0000 (27 17:45 +0100)]
avoid integer overflow
Actually, the whole thing is so chock full of signed vs unsigned
mixups and the assumption of all the world is 32-bit that i'm not sure
anymore that correcting them one by one is a good idea.
what would probably work best is that if someone deeply familiar with
the code (*looks in dan's general direction*) cleaned the data types
up, then legions of grunts like myself could start cleaning the rest
with relative confidence...
Tamas TEVESZ [Fri, 26 Dec 2008 07:35:14 +0000 (26 08:35 +0100)]
Sync comment with reality
Or rather, remove possibility for comment to diverge from reality
Samir SAADA [Fri, 29 May 2009 18:39:41 +0000 (29 20:39 +0200)]
Fix menu positioning bug
Here I tried to prevent the menu of windows to be displayed in the
other side of the screen if the window is half present in the screen
horizontally (ie x < 0)
a worse problem with menu is that it disappears when
the window is half present in the window vertically
ie y < 0, that makes it not usable.
Carlos R. Mafra [Sat, 8 Aug 2009 21:37:27 +0000 (8 23:37 +0200)]
Trivial cleanup
Carlos R. Mafra [Mon, 10 Nov 2008 00:35:57 +0000 (10 01:35 +0100)]
Fix gcc warnings
This patch fixes the following warnings (with gcc 4.2.3)
defaults.c:980: warning: unused variable 'replace'
main.c:504: warning: 'watchPath' may be used uninitialized in this function
main.c:504: note: 'watchPath' was declared here
startup.c:616: warning: implicit declaration of function 'XrmUniqueQuark'