icon_update_pixmap default moved to bottom
commit29a526748553e11a1bcd7400e4cfc16c1f5351ed
authorRodolfo García Peñas (kix) <kix@kix.es>
Sun, 14 Apr 2013 21:13:27 +0000 (14 23:13 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Wed, 17 Apr 2013 09:23:10 +0000 (17 10:23 +0100)
tree70212011c9cdcb0544642f066b9275da698461c5
parent41da1b30dbfe09aef2658f4feac9021bde0d31a9
icon_update_pixmap default moved to bottom

The default case is moved to the bottom of the switch case.

The default case should be removed, because the icon has always
a right value, because the icon creation always uses a real value:

kix@debian:~/src/wmaker/wmaker-crm/src$ grep wAppIconCreateForDock *c
appicon.c:WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance, char *wm_class, int tile)
dock.c:         btn = wAppIconCreateForDock(scr, NULL, "Logo", "WMClip", TILE_CLIP);
dock.c:         btn = wAppIconCreateForDock(scr, NULL, "Logo", "WMDock", TILE_NORMAL);
dock.c:         btn = wAppIconCreateForDock(scr, NULL, name, "WMDrawer", TILE_DRAWER);
dock.c: aicon = wAppIconCreateForDock(scr, command, winstance, wclass, TILE_NORMAL);
(1)dock.c:                         aicon = wAppIconCreateForDock(dock->screen_ptr, NULL,
kix@debian:~/src/wmaker/wmaker-crm/src$
kix@debian:~/src/wmaker/wmaker-crm/src$ grep TILE_ *c | grep -v ICON_TILE_SIZE
***[2]appicon.c:              tile = TILE_CLIP;
dock.c:         btn = wAppIconCreateForDock(scr, NULL, "Logo", "WMClip", TILE_CLIP);
dock.c:         btn = wAppIconCreateForDock(scr, NULL, "Logo", "WMDock", TILE_NORMAL);
dock.c:         btn = wAppIconCreateForDock(scr, NULL, name, "WMDrawer", TILE_DRAWER);
dock.c: aicon = wAppIconCreateForDock(scr, command, winstance, wclass, TILE_NORMAL);
(2)dock.c:                                                       wm_instance, wm_class, TILE_NORMAL);
***[3]icon.c: icon->tile_type = TILE_NORMAL;
icon.c: case TILE_NORMAL:
icon.c: case TILE_CLIP:
icon.c: case TILE_DRAWER:
kix@debian:~/src/wmaker/wmaker-crm/src$ grep tile_type *c
icon.c: icon->tile_type = TILE_NORMAL;
***[1]icon.c: icon->tile_type = tile;
icon.c: switch (icon->tile_type) {
icon.c:         wwarning("Unknown tile type: %d.\n", icon->tile_type);
kix@debian:~/src/wmaker/wmaker-crm/src$

There are only three cases without value (asterisk in the line start) set
as preprocessor variable. (1) and (2) is the same call. These are the three cases:

Case [1]:

-------------8<--------------
WIcon *icon_create_for_dock(WScreen *scr, char *command, char *wm_instance, char *wm_class, int tile)
{
        WIcon *icon;

        icon = icon_create_core(scr, 0, 0);
        icon->tile_type = tile;
-------------8<--------------

Calls to icon_create_for_dock, is only call in appicon.c:

-------------8<--------------
kix@debian:~/src/wmaker/wmaker-crm/src$ grep icon_create_for_dock *c
appicon.c:      aicon->icon = icon_create_for_dock(scr, command, wm_instance, wm_class, tile);
icon.c:WIcon *icon_create_for_dock(WScreen *scr, char *command, char *wm_instance, char *wm_class, int tile)
kix@debian:~/src/wmaker/wmaker-crm/src$
-------------8<--------------

The call:

-------------8<--------------
WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance, char *wm_class, int tile)
{
[snip]
        if (strcmp(wm_class, "WMDock") == 0 && wPreferences.flags.clip_merged_in_dock)
                tile = TILE_CLIP;
        aicon->icon = icon_create_for_dock(scr, command, wm_instance, wm_class, tile);
-------------8<--------------

And the calls to wAppIconCreateForDock() are checked before.

The case [2] is just the line:

-------------8<--------------
WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance, char *wm_class, int tile)
{
[snip]
        if (strcmp(wm_class, "WMDock") == 0 && wPreferences.flags.clip_merged_in_dock)
***             tile = TILE_CLIP;
        aicon->icon = icon_create_for_dock(scr, command, wm_instance, wm_class, tile);
-------------8<--------------

Then, is sure too.

The case [3] is:

-------------8<--------------
WIcon *icon_create_for_wwindow(WWindow *wwin)
{
[snip]
        icon->tile_type = TILE_NORMAL;
-------------8<--------------

All windows have TILE_NORMAL.

Then, all cases are secure.
src/icon.c