As reported by Rodolfo, there are some cases when working with icons
where a crash can occur, which is related to trying to re-release
some memory that have been already freed previously.
This patch adds a reset-to-NULL of the corresponding pointers so that
on next usage wmaker will know there's no more memory associated with
these pointers.
On 12.11.2012 Paul Seelig reported:
- open an application positioning an app icon on the bottom
- right click this app icon to show the context menu
- wonder yourself why there are two lines saying "Hide"
- first Hide entry does not do anything, second does
The reason for this curious behavior is the following.
The "Launch" entry was added in 8352c9ef60 ("Allow relaunch with shortcut key")
as the first one in the appicon menu, but this first position was hard-coded
in another part of wmaker's code in order to decide the menu entry text based
on the application's 'hidden' state in openApplicationMenu():
if (wapp->flags.hidden)
menu->entries[1]->text = _("Unhide");
else
menu->entries[1]->text = _("Hide");
But the "Launch" entry is before these "Hide/Unhide" entries and now the assumption
about entries[1] containing the relevant string for this hide/unhide decision is
no longer valid.
The simpler "fix" is to move the "Launch" entry below these "Hide/Unhide" games.
Move bounce options from expert prefs to its own box on ergonomic
prefs to have them at one place which makes them somewhat more clear.
The options previously occupying this place have been moved to other
pages where they better belong.
This patch only add some tabs the window.h (only window struct area).
The main change is that moves this block to switchpanel.c, because
is only used there:
((w)->wm_gnustep_attr->flags & GSWindowLevelAttr) && \
((w)->wm_gnustep_attr->window_level == WMMainMenuWindowLevel || \
(w)->wm_gnustep_attr->window_level == WMSubmenuWindowLevel))
The patch also include two comments in the window's image:
- WIcon icon is only used when the window is minimized, else is NULL
- RImage has the window image, used in switchpanel,...
The WIcon variable force_paint can be removed, because now is possible
update the icon directly in the function wAppIconPaint.
Now wAppIconPaint creates the RImage file if needed, and then paint it.
The function get_default_image_path has the WScreen argument that
is not used, so can be removed.
The function could be static, but perhaps is interesting leave it
as public.
The function get_default_icon_filename(), now get_icon_filename(),
was working in a bad way. Before this patch, the function always
searched the default icon in the second search:
- file_name = wDefaultGetIconFile(winstance, wclass, True);
+ file_name = wDefaultGetIconFile(winstance, wclass, False);
For this reason, the argument default_icon didn't work.
This patch change it. Now, if the default_icon is false, the function
can return NULL, then other functions can do the correct work. For
example, now wDefaultGetImage() doesn't need do nothing, because the
default_icon is set to True. get_icon_filename() checks if the
icon exists in the disk before returning it (except for default icon
in get_default_image_path(scr).
The line "icon_editing = 0" is the first line in the "if" sentence
and the first (and only) sentence in the "else" block, so can be
moved outside the if-else (and the empty else block can be removed).
Bug report from nikty:
"Window Maker does remember the size of windows, but for maximized windows it does not keep the position.
When a maximized window appears it is shifted to the right for a few pixels (firefox, thunar) or both to the right and to the bottom (openoffice, vlc, virtualbox)."
We weren't accounting for the window border when calculating whether the window would position correctly.
To reproduce:
* Launch some application which remembers its position. I used
Thunar as suggested in the bug report.
* Maximize!
* Kill the application.
* Launch it again.
* Maximize! The expected behaviour is that nothing would happen
because the window should have started right where it was before.
Observed behaviour is that it moves a few pixels.
After the patch we can verify that the maximize operation is
idempotent with regards to geometry.
Tested with and without Xinerama, with and without a panel strutting
one edge.
Bug report: http://www.kix.es/mantis/view.php?id=4
The function wIconSetHighlited() is now faster because it doesn't
re-create the icon before setting the Highlited status. Now it only
draws the icon pixmap.
The new function update_icon_pixmap() updates the pixmap for a icon task.
Now, wIconCreate() creates the image and sets the icon->file and
icon->file_image variables and update_icon_pixmap() updates the icon->pixmap.
This is interesting because we can update the pixmaps without creating the
image again.
The function wIconUpdate now create the rimage for the icon, using
different functions. When the icon is created, then the pixmap is
generated using this rimage.
The function get_pixmap_icon_from_icon_win(), before this patch,
creates the pixmap icon for dockapps (docks with a mini application
inside). The function did three steps:
1. Create the (r)image
2. Create the pixmap using the image
3. Put the application inside the image
Now these three steps are three functions:
step 1: static void get_rimage_icon_from_icon_win(WIcon *icon);
step 2: static void get_pixmap_icon_from_icon_win(WIcon *icon);
step 3: static void set_dockapp_in_icon(WIcon *icon);
These functions contains the same code, that before the changes.
The original function get_pixmap_icon_from_icon_win() includes the
calls to the new functions get_rimage_icon_from_icon_win() and
set_dockapp_in_icon()
There is a bug in wmaker with icon files set in config files, but
that doesn't exist in the disk. For example, if the config files have:
etc/WindowMaker/WMWindowAttributes:
xcalc = {AlwaysUserIcon = Yes;Icon = "HP-16C-48.xpm";};
share/WindowMaker/IconSets/Default.iconset:
xcalc = {AlwaysUserIcon = Yes;Icon = "HP-16C-48.xpm";};
But the icon "HP-16C-48.xpm" doesn't exist in the disk, wmaker does:
1. Load the config file in memory, in a database
2. When the application is launched, wmaker tries to find their icon in
the database (using wDefaultGetIconFile), the icon is found: HP-16C-48.xpm
3. When WindowMaker try to find the full path for the icon, using FindImage(),
WindowMaker cannot find the icon, and returns NULL.
Even, if the user set the default_icon boolean variable to True, wmaker
finds in the database the wrong icon.
This patch checks that the icon exists both in the database AND in the disk. If the
icon doesn't exist in the disk and the default_icon variable is set to True,
then windowmaker loads the default icon using the function get_default_image()
because this function searches the default icon directly.
The function get_default_image() is moved from icon.c to wdefaults.c because
it is now used in both places. This function is now splitted, to find the file
(get_default_image_path) path and the file image (get_default_image)
The function get_pixmap_icon_from_icon_win() is now rewritten.
This function now creates the icon using the function get_window_image_from_x11(),
using itself as Window and updates the icon using icon_update_pixmap().
At this point the Pixmap is only the icon background. Now we must put inside the
dockapp, in the correct position. Then the funcion get the dock application size,
(the max size is wPreferences.icon_size, because get_window_image_from_x11() checks
the valid size), checks if the icon has title and then reparents the dockapp to put
it inside the icon.
This patch includes a lot of comments to better understand the code.
The function get_wwindow_image_from_x11() is renamed to get_window_image_from_x11()
and does the same work, but now its argument is a Window struct instead of a
WWindow.
This change is better because it allows objects with Windows (but without
WWindows) to call this function.
The function now is not static to allow its use in other parts of the code.
A new functions get_pixmap_icon_from_x11 and get_rimage_icon_from_x11
are included in icon.h
1. get_pixmap_icon_from_x11, set the rimage at icon->file_image
The code sets net_icon_image in icon->file_image
2. The get_rimage_icon_from_x11 function, only converts
the icon->file_image in icon->pixmap
The function get_pixmap_icon_from_wm_hints() is splitted in two
functions now:
1. get_rimage_icon_from_wm_hints, set the rimage at icon->image
The code comes from the function get_pixmap_icon_from_default_icon()
2. The get_pixmap_icon_from_wm_hints() function, but now only converts
the icon->file_image in icon->pixmap
The function get_pixmap_icon_from_user_icon() is splitted in two
functions now:
1. get_rimage_icon_from_user_icon, set the rimage at icon->image
The code comes from the function get_pixmap_icon_from_default_icon()
2. The get_pixmap_icon_from_user_icon() function, but now only converts
the icon->file_image in icon->pixmap
The function get_pixmap_icon_from_default_icon() is splitted in two
functions now:
1. get_rimage_icon_from_default_icon, set the rimage at icon->image
The code comes from the function get_pixmap_icon_from_default_icon()
2. The get_pixmap_icon_from_default_icon(), but now only converts
the icon->file_image in icon->pixmap
The function get_pixmap_icon_from_wm_hints() is now rewritten using
the functions get_wwindow_image_from_wmhints() and icon_update_pixmap().
Now, the function creates a new RImage using get_wwindow_image_from_wmhints()
and then updates the Pixmap using the function icon_update_pixmap().
The CachedPixmap folder is added to the icon list. This is because
if one icon is created, but the user change it and set other icon, the first
icon cannot be selected anymore using the settings window. The user
needs modify the configuration files by hand.
Some extra paths are added to the debian default config file.
This patch changes the behavior of wIconChangeImageFile.
Before apply this patch the behavior was:
The image (file_image) is set to NULL, then the function tried to find
a new image. If the new image was not found, the variable file_image contains
NULL when the function returns, and the return code was 1.
With this patch the image is changed only if a new image is found.
The function wIconChangeImageFile mustn't update the icon if
no file is set.
This is a bug. To reproduce it:
1. Right click on dock icon. Select "Settings"
2. Erase the Icon Image contents (set empty)
3. Click "OK" -> Exit, no changes... no?
4. Right click on the same dock icon. Select "Settings"
5. Erase the Icon Image contents (set empty)
6. Click "OK" -> Crash
If wmaker don't crash, watch the file ~/GNUstep/Defaults/WMWindowAttributes,
the default icon ("*" has trash in the name). Probably something is not fine
at wIconUpdate.
Respect _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL from all windows, not
just WWindows. This will allow us to respect struts from app icons
and dock icons.
Brief comment on what wAppIconFor() and wWindowFor() do, as it
may not be immediately obvious.
Given a raw X11 Window they will find the AppIcon (or WWindow,
respectively) associated with that window. Thus they can map an
X11 object to a Window Maker internal object.
Create wAppIconFor() and wAppIconTouchesHead() to match wWindowFor()
and wWindowTouchesHead(). These functions will allow us to locate the
window and head associated with a particular app icon or dock icon.
Window Maker already supports the _NET_WM_STRUT property as described
in the EWMH spec. We respect client-provided struts and avoid placing
or maximizing windows over those areas. An example is that we don't
try to place or maximize windows where they would be obscured by an
always-on-top gnome-panel.
_NET_WM_STRUT is now deprecated and redefined as a special case of
_NET_WM_STRUT_PARTIAL, which allows variable strut widths. A panel at
the bottom of the screen, for example, does not have to reserve the
whole width as a strut if it does not fill 100% of the screen width.
By default the XFCE bottom panel does not extend the whole width of
the screen, for instance.
Our method for restricting parts of the screen from placement doesn't
have a way to account for struts which are not 100% tall or 100% wide,
so until now we have ignored partial struts. In the case of the XFCE
panel mentioned above, the result is that a window may maximize
underneath the panel and be obscured.
As a partial hackaround we now query windows for _NET_WM_STRUT_PARTIAL
but throw away the start and end co-ordinates, assuming instead that
the struts are full-width/full-height. This trades off a small amount
of wasted placement space to avoid the case where windows can be
partially obscured by panels, which can be particularly annoying if
the panel is at the top and the victim's titlebar becomes hidden.
This patch removes the extra commas in the configuration file
WindowMaker.
This bug was created in the commit 0e995bbf6e
but no debian packages were released.
The function remove_wwindowstate is now remove_wwindowstate. This was
proposed by Christophe and Carlos:
- - -
On 2012-10-09 01:09, Carlos R. Mafra wrote:
> On Tue, 9 Oct 2012 at 0:58:19 +0200, Christophe wrote:
> you name the function "remove_*", which makes think that it would
> remove the entry from the list, but the function does not do that, it
> just frees the memory, so it may have been better called "free_" (or
> maybe "release_")?
>
Good point, release_ makes more sense to me.
- - -
The function get_default_icon_rimage name is not correct, because
the function doesn't return the default icon rimage, returns the
rimage from a file name. So the correct function name should be
get_rimage_from_file.
The new helper function get_pixmap_icon_from_default_icon search
the default icon in the disk and return it.
Now get_pixmap_icon_from_user_icon() returns do the work about
search the user icon, and the work about default icon is splitted
in the function get_pixmap_icon_from_user_icon.
The function makeIcon is only used in icon_update_pixmap(), so
both functions can be joined. Now the function icon_update_pixmap()
includes the contents of makeIcon.
This patch replaces the Pixmap icons from screen.h with only one
RImage. This image is not processed yet, therefore could be used
for icons with title or without it (replacing def_ticon_pixmap and
def_icon_pixmap variables).
Now the code is better because the Pixmap is generated and saved in
the icon structure.
See that before this patch, the icon->pixmap was set to None!!
With this patch, the icon->pixmap is saved, using the common
method used in the other functions to create Pixmaps, the function
icon_update_pixmap().
The new function get_default_image creates a RImage with the default
icon. Now the function get_pixmap_icon_from_user_icon() is more clear
and show that, first try to get the user selected image, if not set,
then it gets the default icon.