1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00
Commit Graph

2925 Commits

Author SHA1 Message Date
Carlos R. Mafra
202b9eadc5 Random coding style cleanup in winspector.c 2012-06-02 20:14:47 +01:00
Rodolfo García Peñas (kix)
e8074ae1cd Remove code duplication by calling removeAppIconFor()
The function removeAppIconFor() does exactly the same thing as the code inside
wApplicationDestroy(), including the last call to wArrangeIcons(). So let's
simply remove the code and call the function instead.
2012-06-02 20:05:14 +01:00
Rodolfo García Peñas (kix)
fbab31b798 Coding style cleanup in application.c
Changes to application.c:

- Curly brackets
- Code commented
- Include not used
2012-06-01 22:01:02 +01:00
Rodolfo García Peñas (kix)
dd6a54bba5 Check one time if no_appicon is set
This patch checks if the no_appicon flag is set, then, the icon
is not created, therefore cannot be painted neither saved.

Some comments added to clarify the code.
2012-06-01 22:01:02 +01:00
Rodolfo García Peñas (kix)
bd3fb21441 Remove code duplication by calling paint_app_icon()
The code in application.c to create+paint the application icon is
included in appicon.c (function paint_app_icon).
2012-06-01 22:01:02 +01:00
Rodolfo García Peñas (kix)
2e7b039558 Split makeAppIconFor()
The function makeAppIconFor is splitted in two:

makeAppIconFor: Create the new icon if needed
paint_app_icon: Paint the icon
2012-06-01 22:01:02 +01:00
Rodolfo García Peñas (kix)
cab8bbc495 Move makeAppIconFor() and removeAppIconFor()
The functions makeAppIconFor and removeAppIconFor are moved from
winspector.c to appicon.c, and now are not static.

The reason to move these functions is because are used to create
and remove app_icons, therefore should be included in this file.

Finally, this functions will be updated and splitted in next patches.
2012-06-01 22:01:02 +01:00
Rodolfo García Peñas (kix)
01ea1fa8b4 New function app_icon_create_from_docks
The new function app_icon_create_from_docks do all the needed stuff to create
the application app_icon using a previous image in docks.

The contents of the app_icon_create_from_docks were moved from the
wApplicationCreate function. Now this function is more clear.
2012-06-01 22:01:02 +01:00
Rodolfo García Peñas (kix)
1c1697dc40 New function save_app_icon
New function to save the icon "save_app_icon". This function is
created in appicon.c, because is related to app_icons. The contents
are from application.c. No important modifications are included in
this function. Removed the includes not needed.
2012-06-01 22:01:02 +01:00
Rodolfo García Peñas (kix)
423b78811a Initialize app_icon to null
The app_icon initialization to null is common in the if and else blocks.
2012-06-01 22:01:02 +01:00
Christophe CURIS
e498a8bd79 Fixed possible off-by-one loops
Due to variable size definitions in the structure, the 'for' loops may
actually try to work on wrong data. Instead of using hard-coded value,
we now simply let the compiler give us the number of elements.

This may (or may not) fix a crash reported by Rodolfo kix Garcia.
2012-05-31 23:13:07 +01:00
Iain Patterson
d356baebea Bugs with readMenu*().
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.
2012-05-29 15:24:12 +01:00
Rodolfo García Peñas (kix)
3eb8c9d498 Added wmlib/libWMaker.la to .gitignore
The compiled library file wmlib/libWMaker.la is included
in the .gitignore file, to forget it in the git status command.
2012-05-28 12:32:02 +01:00
Rodolfo García Peñas (kix)
284d3b56fe debian: New version 0.95.3
This patch includes the changes to create the package for
debian.

Changes are included in changelog:

  * New upstream release 0.95.3
    * Removed debian/clean file. Upstream removes now the files.
  * Bumped to standard version 3.9.3
  * Important!: Removed symbol "W_DraggingInfo" in libwutil2 and
    libwings2, because the struct W_DraggingInfo is now declared
    as "typedef", therefore the struct is not included.
    This change is included in upstream, see line 126 of the file
    WINGs/WINGs/WINGsP.h
  * Patch 53_Debian_WMState.diff changed, because the WMState file
    in upstream is now different. Now, the dock launch WPrefs.
  * Removed /etc/X11/WindowMaker files.
    * Removed from debian/wmaker-common.dirs
    * Removed (duplicated) files in debian/wmaker-common.install
    * New path for menu.hook: /usr/share/WindowMaker
      * Changed in the menu-method files (wmaker and wmappearance.
    * Removed menu.posthook and menu.prehook.
  * Changed the menu behaviour. Applications/* contents moved to
    the root menu.
2012-05-28 12:31:54 +01:00
John H. Robinson, IV
968ebdedf2 Makefile: Add missing subdir
The test suite was added, but it wasn't included in the list of
directories to be included in the tarball, so ./configure fails:

config.status: error: cannot find input file: `test/Makefile.in'

The following patch adds the missing test suite.
2012-05-24 08:08:12 -03:00
Carlos R. Mafra
efcad8497e Window Maker 0.95.3 wmaker-0.95.3 2012-05-16 08:31:01 -03:00
Tobias Stoeckmann
97f68b5865 Fixed typos 2012-05-07 20:49:42 -03:00
Tobias Stoeckmann
883600748e Major overhaul of rootmenu's file handling.
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.
2012-05-07 20:49:15 -03:00
Tobias Stoeckmann
9e2d1b3ecf Don't fail with assert() in string functions if both strings are NULL.
wstrconcat and wstrappend already support situations in which first OR
second string are NULL, but not if BOTH are NULL.  Fixed that.
2012-05-07 20:47:22 -03:00
Tobias Stoeckmann
4a4775f076 Fixed memory leak in wWorkspaceRename.
The function wtrimspace returns a wmalloced memory region, therefore
it must be wfreed after usage again.

Please take note that this also happens with every single line
of menu files, which will get fixed in a separate commit.
2012-05-07 20:46:12 -03:00
Tobias Stoeckmann
33328d997e Avoid buffer overrun in parseMenuCommand.
In parseMenuCommand, title[300] might get filled with a string of length
300.  The string is copied with strcpy, therefore the size would have to be
301 or -- as I propose -- the fixed value 300 gets replaced with
"sizeof(title) - 1".  This shows also that the size 300 belongs to title
and it will already be replaced during compile-time into 299.
2012-05-07 20:45:13 -03:00
Tobias Stoeckmann
6bc550d91b Remove curly brackets
...as they were completely wrapped up by another pair of curly brackets.
2012-05-07 20:42:34 -03:00
Tobias Stoeckmann
cbff60297e Easier code path in appIconMouseDown 2012-05-07 20:41:18 -03:00
Tobias Stoeckmann
971f611bad wstrdup cannot fail, therefore no need to check for NULL. 2012-05-07 20:40:14 -03:00
Tobias Stoeckmann
70d8ad515b Easier error path in wDockTrackWindowLaunch.
There is no need to allocate command if the very next line might
fail independently from comand, freeing that memory again in error path.
2012-05-07 20:37:48 -03:00
Tobias Stoeckmann
b5df97db95 Removed unused "buffer" variables. 2012-05-07 20:36:58 -03:00
Tobias Stoeckmann
72546aab81 Get rid of NEW definition.
The NEW definition merely calls wmalloc now, therefore it is not needed
anymore.  Pointed out and requested by Carlos R. Mafra.
2012-05-07 20:36:10 -03:00
Tobias Stoeckmann
cc30444dda No need to call memset after wmalloc
memset is the last function call in wmalloc, just before it returns the
newly allocated memory.  Therefore it is not needed to call it again
after wmalloc call.  Although I would prefer to switch wmalloc to a
calloc-based wcalloc function, the compatibility of WINGs for old apps
should be kept.
2012-05-04 18:41:01 -03:00
Iain Patterson
aee0ad45f2 More intuitive maximization handling.
Avoid some pitfalls with window maximization and make it behave more
intuitively.  We now treat a window's vertical and horizontal
maximization as separate properties and only remember its original
geometry in a particular direction when it actually changes.  We also
deliberately do not remember a window's geometry when it changes from
one maximized state to another.  As a result windows can be more
reliably restored to their original size.

For example the "Maximize active window" hotkey followed by the
"Maximize active window vertically" hotkey will now result in the window
being maximized horizontally only, whereas previously the second hotkey
would have no effect because the window was already maximized
vertically.  In addition selecting the Unmaximize window menu in the
same example will now result in the window being restored to its
original size.  Previously the unmaximize attempt would have no effect
because the vertical maximization would have remembered the window's
"original" geometry when it was fully maximized.

Maximus is handled separately.  The "Maximus" hotkey will now toggle
Maximus mode regardless of the window's current maximization state.  For
example if two unmaximized windows are on screen and one is Maximusized
it will fill the space left by the second window, as before.  But if the
first window is maximized and the "Maximus" hotkey is pressed the window
will now fill the same space as if it were Maximusized from its original
size.  Previously the window would not change size from its fully
maximized state because the Maximus algorithm would consider
fully-maximized to be a valid Maximus size.
2012-05-04 18:39:21 -03:00
Tobias Stoeckmann
e6e3e1aa49 Avoid memory leak on error path in constructMenu. 2012-05-04 18:39:21 -03:00
Tobias Stoeckmann
753f44c4b7 Fixed memory leak in wHideAll. 2012-05-04 18:39:21 -03:00
Tobias Stoeckmann
2755b1e45d Use proper (w)free functions for (w)malloced data. 2012-05-04 18:39:21 -03:00
Tobias Stoeckmann
975d4becf1 Fixed some typos. 2012-05-04 18:39:21 -03:00
Carlos R. Mafra
95c68d2b10 Scare people away from --enable-xrandr
Xrandr support is currently very primitive and stupid, but people
do not seem to be aware of its problems and still enable it in distros.

Try to scare them to not do that.
2012-04-30 15:07:02 -03:00
Tobias Stoeckmann
1bcfb89cd1 Adjust OpenBSD-specific code to match OpenBSD-current
Also fix null pointer dereference by NOT calling strlen on a possible
null pointer.
2012-04-30 14:50:17 -03:00
Tobias Stoeckmann
e83eeb15cc Include assert.h to avoid linker issues if -DDEBUG was not supplied. 2012-04-30 14:48:20 -03:00
Tobias Stoeckmann
f25464c792 Avoid GNUism in Makefiles for *BSD support
Variable abs_srcdir will always point to proper source location.
With this patch, there is no need to call gmake on OpenBSD anymore.
2012-04-30 14:46:54 -03:00
Carlos R. Mafra
8311058a16 Revert "Inotify: Reload keyboard shortcut definitions when configuration changes"
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).
2012-04-30 14:36:43 -03:00
Carlos R. Mafra
4e2ee27bfa Fix wrong wfree() use
There is a bug which happens when one modifies the "Initial Workspace" in the
"Attributes..." menu. Upon saving the change wmaker segfaults.

Commit ad373ef0dd ("WindowMaker: New function wGetWorkspaceNumber")
used wfree() in variables which were not wmalloc'ed. Fix this.
2012-04-26 11:11:32 -03:00
Christophe CURIS
39fdb451ba Fixed wrong structure declaration
The declaration of the structure actually also created an unused variable. This
variable was not used anywhere, and lead to symbol defined in multiple objects.
These symbol are silently merged by GCC, thus no problem was reported.

The issue was raised by Yves de Champlain when trying to compile with LLVM/clang
which is a bit stricter there.
2012-04-21 09:33:27 -03:00
Rodolfo García Peñas (kix)
244b63e6b5 WindowMaker: New get_texture_image function
The new function get_texture_image includes the common code of
wTextureMakePixmap() and wTextureMakeTGradient()
2012-04-20 20:36:07 -03:00
Rodolfo García Peñas (kix)
1b0ed30b9b WindowMaker: Header files clean code
Changes:
  - Spaces replaced by tabs in the structs
  - Removed unused variables:
    - has_titlebar, never used
  - Functions sort by return type
2012-04-16 09:33:39 -03:00
Rodolfo García Peñas (kix)
0db76b822d wIconStore(): do not save the icon if it exists
The function wIconStore() doesn't write a new file overwriting the
previous icon if the icon file exists.
2012-04-16 09:32:24 -03:00
Rodolfo García Peñas (kix)
21fb6db616 WindowMaker: New function wIconCreateCore()
The new function wIconCreateCore do the common work to create a WIcon.

This code was before in wIconCreateWithIconFile() and wIconCreateWithIconFile().
2012-04-15 23:15:47 -03:00
Rodolfo García Peñas (kix)
219315aa58 WindowMaker: Check iconPath variable only if needed
The variable iconPath should only checked inside the if block,
because outside is never initialized.
2012-04-15 23:15:47 -03:00
Rodolfo García Peñas (kix)
ad373ef0dd WindowMaker: New function wGetWorkspaceNumber
The new function wGetWorkspaceNumber returns the workspace number
for a given workspace name.

The code of this function is already used in session.c and wdefaults.c
and now is moved to workspace.c

In wSessionRestoreLastWorkspace the char value is checked before
calling the function, because without string, the function don't do
nothing.
2012-04-15 23:15:20 -03:00
Rodolfo García Peñas (kix)
761fd37e51 WindowMaker: Clean curly brackets
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.
2012-04-15 23:15:20 -03:00
Rodolfo García Peñas (kix)
afe2e5d9d6 WindowMaker: appicon.h clean code
Changes to appicon.h:

- Spaces replaced by tabs in the struct
- Removed unused variables:
  - client_machine, never assigned
  - gnustep_app, never used
- Functions sort by return type

Then, in dock.c, the block with client_machine is never true,
then can be removed. The host variable then is never used.
2012-04-15 23:15:20 -03:00
Iain Patterson
b3afad67ff Use noreturn attribute in Exit() declaration.
Use the gcc-specific noreturn attribute to advise the compiler that
Exit() doesn't return.  This is safe because we already use preprocessor
rules to hide __attribute__ from other compilers.

Suggested independently by Christophe Curis and Brad Jorsch.
2012-04-11 23:56:31 +01:00
Iain Patterson
bca60318ca Compiler diet.
Don't feed the compiler.  RelaunchWindow() is declared to return Bool so
Bool it shall proudly return.
2012-04-11 23:55:58 +01:00