The flag "supports_tiff" doesn't belong to the wScreen, because all
screens has (or not) the same value. If wmaker supports (or not) tiff
files is global to all wmaker, not to the screens.
The file event.h includes the function prototypes for event.c.
The prototypes included were moved from funcs.h.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
The dock will have the up-right and down-left arrows to change workspaces and
the clip will be disabled. That is, if option ClipMergedInDock is set to yes in
GNUstep/Defaults/WindowMaker.
[not thoroughly tested]
Drawers are horizontal docks, and they can themselves only live in the dock
To use them, right click on the dock or a docked appicon and select "Add
a drawer". Then move appicons into the drawer (drag them with the
mouse). You may change the icon of the drawer. By default, drawers
auto-expand and -collapse, and auto-raise/lower. This can be customized
in the same way as for the clip.
Set DisableDrawers to YES in G/D/WindowMaker if you do not want to see
the menu entry to add a drawer.
Just discovered this bug: the auto-attract icon functionality will not
work (to be precise, it crashes WM!) if the clip is disabled
(NoClip=YES). Will fix shortly, of course.
Behaves essentially the same, only a bit more consistently.
Known differences:
1. An AppIcon will now always end up undocked if moved while Mod1 is pressed.
2. Moving a docked AppIcon with Mod1 pressed (undocking it) used to auto-expand the clip,
as clip expansion happened first, while looking for a snapping position,
and the test on Mod1 being pressed happened only later
The function set_icon_image_from_database() set the icon from the
database, but wIconUpdate() update the icon using different methods
, like for example get the image from X11. So, is better move the
wIconUpdate() to the function who call set_icon_image_from_database(),
to avoid understanding problems.
This patch removes all the appicon stuff from the application creation
to the appicon creation. Now, the application only calls one function
(create_appicon_for_application()) and this function do all the work.
The function do the same code than the code before this patch, but the
only change is that the "if" test to check if the appicon was found in
the docks now is negated, removing the return and doing the appicon_save
inside the function.
Finally, the old makeAppIconFor is now create_appicon_for_application().
The new function set_icon_image_from_database() removes the dup code
from these functions:
icon.c:icon_create_for_dock()
icon.c:icon_create_for_wwindow()
appicon.c:removeAppIconFor()
The only different change is that in the functions icon_create_for_dock()
and icon_create_for_wwindow(), the icon->tile_type assignment is done
before set the icon image filename and icon image, but this variable
is not used in these functions (is used in wIconUpdate function) but in both
functions the icon->tile_type assignment is done before wIconUpdate(), like
the code previous to this patch, so there is no problem moving icon->tile_type.
This patch sets the correct icon after kill a docked application.
To reproduce the problem (as Carlos reported to me), follow these
steps:
1. With a docked application, not running, set the icon image.
2. Launch the docked application.
3. Kill the application, using for example the app dock menu.
The icon is lost. But if wmaker is restarted, the icon backs again.
The problem is because when the application is closed, the function
removeAppIconFor() calls wIconUpdate(), but this function doesn't
find the icon in the file system again. The icon is loaded from the
filesystem only when the application is created.
This patch creates the icon image again, then calls wIconUpdate() to
set the icon image or the default icon image if the icon image was
not found, then wPaint it.
These lines comes from the create_appicon_from_* functions, used
to set the icon image for docks and applications. Are copy/pasted.
The function wIconUpdate can receive a image to setup as icon image.
If image is NULL, then use the original method, using different procedures
to get the image.
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.
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.
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.
The new function 'unpaint_app_icon' checks its argument 'wapp' aginst NULL,
however it does dereference the pointer beforehand, which will end up in
a crash if the null-pointer case occurs.
This patch avoids the icon creation in winspector.c and adds the
ability of creating + paiting and unpainting instead of destroying the icon.
Now the icon is always created by wApplicationCreate and the icon
exists while the application is runnning. If the user doesn't want
an appicon the winspector.c will not remove the icon, it will only
not paint it on the screen. But the icon is still created.
Probably the most difficult part in this code is how to handle the
icons in the iconlist. We must include the icon in the iconlist when
it is painted, not when it is created. And it must be removed when it
is unpainted.
We can check if the icon is in the iconlist if icon->next AND icon->prev
are null, else it is on the applist. If it is included we must not
paint it again because the function PlaceIcon() will calculate a new
icon place in the screen including the icon!, then a hole is painted.
The contents for searching the icon in wAppIconCreateForDock()
are moved to icon_create_for_dock().
Now wAppIconCreateForDock() and wAppIconCreate() do the same work and
icon_create_for_dock() and icon_create_for_wwindow() do the same work too.
The procedure to create the icon is similar in both functions.
Now wAppIconCreateForDock, needs more arguments (command, instance and class).
These functiosn were renamed:
wIconCreateCore to icon_create_core
wIconCreateWithIconFile to icon_create_for_dock
wIconCreate to icon_create_for_wwindow
The variable "dicon" is now named "aicon", the same name that
the WAppIcon variable used in wAppIconCreate.
Some clean code more, like spaces in function arguments.
Remove the call to wIconUpdate() in wAppIconCreate() and place it in
makeAppIconFor() since wAppIconCreate() is only used in that function
and icon update or icon painting is not icon creation.
Now the function wAppIconCreate() only creates the app_icon.
The functions wDefaultGetIconFile(), get_default_icon_filename() and
get_generic_value() use the argument noDefault in order to avoid searching the
default icon. This double negation is difficult to read though. This patch
changes it to be True if the default icon should be included or false if not.
This patch changes the noDefault argument to default_icon, then the
True is now False and False is True.
The main change is at get_generic_value():
- /* Search the default icon name - See noDefault argument! */
- if (!value && !noDefault) {
+ /* Search the default icon name - See default_icon argument! */
+ if (!value && default_icon) {
Because the functions wDefaultGetIconFile() and get_default_icon_filename()
mainly forwards the noDefault argument to get_generic_value().
The function wDefaultGetImage() is splitted in two:
1. get_default_icon_filename(): This function returns the full
path of an icon. The function searches the icon in the database
using instance and class.
2. get_default_icon_rimage(): This function returns the RImage for
a given image path (full path). This function validates the icon
size, so the icon is fully usable.
The function get_default_icon_filename() now adds the .app icons in the
search (using wApplicationExtractDirPackIcon()). To do it, the command
should be included, because this function searches '"command".app' icons.
Setting the command to NULL, this case is not used.
To do it we need the function wApplicationExtractDirPackIcon() defined
at appicon.c, so we need set the function as non-static and provide their
prototype in appicon.h.
This patch also includes an extra pointer check at wDefaultGetStartWorkspace
to make sure that WDWindowAttributes exists.
New functions
static void add_to_appicon_list()
static void remove_from_appicon_list()
to add or remove appicons from the app_icon_list, making the code easier
to follow.
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.
We want to avoid having to consider the position of an appicon whose
application has no_appicon set. The appicon is not "painted" so it
does not appear on the screen. But if the appicon is still added to
the list of application icons, the wArrangeIcons() function gets
confused and ends up creating holes in the icon positions which
correspond to the no_appicon apps.
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
Having two similarly named functions for doing the same thing is confusing.
In order to account for the extra check done by the late wAppIconSave(),
add an argument "dock".
Now there's only save_appicon().
And as pointed out by Rodolfo kix García, the save_appicon_core() function
can be removed too.
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
Function names are important and should not do more than their
names imply. In this case, create_appicon_from_dock() should only
try to get an icon from the dock (or clip).
If the icon is not there, do not try to make an icon from scratch.
You were told to create it from the dock!
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
The icon painting is moved to the function makeAppIconFor()
including the check for no_appicon.
wAppIconCreate is now static because is only used in makeAppIconFor()
The function extractIcon is removed, and its behaviour is moved to
save_app_icon, because this function is always called.
To do that, save_app_icon doesn't need to check if the icon is saved (it's
done at wIconStore). The icon now is saved always (if it doesn't exist),
like extractIcon() used to do.
When the application is created, the WAppIcon now is created always,
but it is only painted if the flag is not set.
The icon initialization to NULL can be done now at app_icon_create_from_docks
because it is always called.
The function app_icon_create_from_docks is moved to appicon.c, because
it is a function to create application icons.
The static function findDockIconFor is moved too because it is only used
at app_icon_create_from_docks().