The file switchmenu.h includes the function prototypes for switchmenu.c.
The prototypes included were moved from funcs.h.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
The file startup.h includes the function prototypes for startup.c.
The prototypes included were moved from funcs.h.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
- remove extern declaration in source file, use header instead
- add inclusion of header defining the functions of the file to
get the compiler to cross-check them
- marked static the functions that should not be visible ouside
their file
When menus are read in the PropList format, they are loaded into a
temporary PropList object, which is parsed into the internal menu
structure, and the PropList object is no more used. There were two
cases where this temp object was not freed.
This patch adds the OPEN_PLMENU options which behaves similar to OPEN_MENU but
can be used to parse command generated proplists. This can be used e.g. in
conjunction with wmmenugen like:
(
"Generated PL Submenu",
OPEN_PLMENU,
"|| find /usr/share/applications -type f -name '*desktop' | xargs
wmmenugen -parser:xdg"
)
v2: code cleanup
The new shutdown.h file includes the shutdown modes and the functions
to shutdown Window Maker.
The function definitios were moved from funcs.h and the struct WShutdownMode
from WindowMaker.h.
Now, externs are not needed, only include shutdown.h
Now that the built-in parser has support for all the feature of CPP
being used by WindowMaker's default menu, we can remove the stuff
related to calling CPP:
- code for preparing and running CPP;
- compile-time option to de-activate the call to CPP;
- command-line option
A number of macros are pre-defined by WindowMaker for CPP in the
function 'MakeCPPArgs', they are now available in the internal
parser too. CPP also had some predefined macros, a subset of them
have been added.
The definition have been split in two parts:
- the macro that are dependant on WindowMaker parameters are
defined by WindowMaker (src/rootmenu.c)
- those that are independant, which can be defined by the parser
itself (WINGs/menuparser_macros.c)
The parser is prepared to handle '#' directives, starting with file
inclusion. The search path for the file are taken from what was
actually given to CPP. There is an arbitrary limit to the inclusion
nesting, which is actually not a design limitation but a security
to avoid infinite include loops.
The default function used so far provides informations not so useful
to user, like wmaker's source file, line number and function; it
also cannot provide the line number from the parsed file because cpp
messes this information.
With this dedicated function we try to provide useful things which
are being tracked by the parser internally, like valid line number
and the name of the file being read (which can be convenient in the
case of #include, for which we may also be able to provide the
inclusion tree!)
From caller point of view, the two function have been merged into a
single function in the API. This will be needed by the advanced
parser that will have to not separate the concept of a 'line' and
the concept of 'content' (due to empty/comment lines, multi-line
comments, long lines split with '\')
All the information related to the file being parsed are stored in
a single place. The content of this structure is not visible to
caller to avoid messing the content; the parsing will be handled as
methods to this object.
Please note that all functions visible as part of the parser's API
are using the CamelCaseNotation to be consistent with the rest of
the API; however all internal functions use the non_camel_case_syntax
to follow the coding style set by Carlos for the project.
Due to the tasks to take in charge, the internal parser will grow in
size to support basic CPP feature, so it is a good idea to start by
moving the current functions into a dedicated file.
The functions of main.c should be included in main.h, not in funcs.h.
This patch adds the main.h file and moves the function prototypes to
this file.
The not needed "include funcs.h" are removed.
readMenuPipe() was calling freeline() on stuff which might be uninitialised, causing
a crash if no valid input was read.
readMenuPipe() was trying to snprintf() on an uninitialised pointer. We now use a
fixed-length buffer like the other readMenu*() functions.
Various memory leaks in readMenu*() functions have been fixed. There
are still some lurking around but most have been removed.
The original report from Charles Philip Chan <cpchan@bell.net> on 22 May 2012 says
that:
"Window Maker crashes when I try to open a sub-menu auto-generated by using:
xdg_menu --format WindowMaker --charset UTF-8"
There was also a report from Amadeusz Sławiński <amade@asmblr.net> on 24 May 2012
stating that wmaker crashes using:
% cat test.sh
cat << EOF
Test MENU
stuff EXEC true
Test END
EOF
% grep test GNUstep/Defaults/WMRootMenu
("Generated Submenu", OPEN_MENU, "|| /home/amade/test.sh")
Error is:
wmaker(MonitorLoop(monitor.c:134)): warning: Window Maker exited due to a crash (signal 11) and will be restarted.
This diff fixes a huge amount of issues that could be triggered by using
the old-fashioned configuration files, i.e menu. They can be activated
by using a line like "/path/to/menu". On most systems, this file will be
parsed with cpp and the result sent through a pipe to WindowMaker.
Anyway, in the code path, memory leaks and buffer overruns await. I have
tried to fix these parts, but in the end it is more or less a rewrite,
whereas I used WINGs whenever possible.
Difference to previous implementation, beside of bugfixes:
- You are free to use single quotes and double quotes in configuration
- Linewrapping is allowed for other pipe'd data, too
- In general, line reading is unified throughout that file
Bugfixes:
- Avoid buffer overrun on lines which have line wrappings, that will happen
ALWAYS, because wtrimspace-usage was erroneously.
- Avoid memory leak, also happened through wtrimspace usage.
- Avoid buffer overrun in separateline if a line ending happens early.
- Actually handle ferror() instead of only feof(), that would result in
endless spinning
- A line wrapping at the end of a file is an error.
This reverts commit cbe2f4e61a.
The reason for the revert is the regression reported here:
http://marc.info/?l=openbsd-ports&m=133151145814675&w=2
I've been able to reliably reproduce the double-spawning of
xterms I've been seeing. The bad news is that it still happens
even with a fresh configuration directory.
To reproduce:
0) Create a keyboard shortcut if one does not already exist (I'm
using <ctrl>+u set to spawn an xterm)
1) Open WindowMaker's preferences.
2) Click on "Applications Menu Definition" (it's the icon
immediately to the left of the keyboard icon)
3) Click save, and then close.
4) Keyboard shortcuts will spawn two applications.
I use keyboard shortcuts to spawn xterms, browsers, and filemanagers.
All of them spawn twice after performing the above. To fix it,
<F12> or <right-click> -> Exit -> Restart.
If I repeat steps 1-3, three windows will spawn. Repeat again and
four windows will spawn etc. (I stopped after getting five to
spawn at once).
This patch removes the unneeded curly brackets in multiple files.
It also add some comments in the code. In usermenu.c removes some
variables not used.
Despite having the inotify mechanism compiled in my WM, everytime I
changed a keyboard shortcut definition in the WMRootMenu via WPrefs
I was required to open the WMRootMenu (eg with the F12 key) for the
change to take effect...annoying.
So explicitly reload the key bindings when a modification inside
~/GNUstep/Defaults/ is detected. As the inotify mechanism calls the
function wDefaultsCheckDomains() when that happens, let's add a call
to rebind_key_grabs() in there.
Now it works fine and changes are automatically in effect once WPrefs
writes the menu.
PS: rebindKeygrabs() renamed to rebind_key_grabs()...
There is code duplication with the cropline() function, so get rid
of it and use WINGs wtrimspace() instead.
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
There are were a few uses of 'strncpy' that could lead to a missing NUL,
resulting in possible garbage being displayed. As suggested by Tamas,
use 'wstrlcpy' instead
* Remove assigned but not used variables (GCC 4.6)
* Bump _XOPEN_SOURCE to 600, ridding of FreeBSD warnings (this probably need
to be tweaked on a per-implementation basis as problems arise)
wsyserrorwithcode - Not used, no point either.
wsyserror->werror - qualifying "error" with a "type" hardly makes
sense if there are not at least two "type"s. There are not. Safe trip.
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
When generating menus, lookup translations for menu entries in
specified textdomain. Often used by linux distributions.
Original-patch-by: Alexey Voinov <voins@altlinux.ru>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
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.
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 :-)
The handling of user defined shortcuts was not checking the length
of the shortcut before copying it to a fixed-length temporary buffer,
char buf[128];
strcpy(buf, shortcutDefinition);
and strcpy() is well known for not checking if overflows will occur.
In particular, wmaker was crashing here if a big 'shortcut' was defined
either through WPrefs or by directly editing the configuration files.
This is now avoided by using strncpy() instead.
And this patch also fixes a similar buffer overflow for big workspace
names too.
Furthermore, use MAX_SHORTCUT_LENGTH instead of raw number and define
it to be 32 instead of 128.
- Some .po file fixes (Mike FABIAN <mfabian@suse.de>)
- Fixed the problem with the root menu code changing the locale setting as
a side effect of loading a localized menu
- Fixed e memory leak in the code that reads a localized root menu
the incorrect window got focus instead of the apps's last focused window)
- Unshade application's shaded windows when Dbl-MiddleClick-ing its appicon.
(this is to be consistent with deminiaturizing application's miniwindows
which also happens in this case, since shading is a form of miniaturization)
- misc fixes
- Separated the font caches for normal fonts and fontsets in WINGs (they can
have the same names and collide in the cache giving unwanted results)
- Updated the years in the copyright notices