On 25/01/2013 11:53, BALATON Zoltan wrote:
> On Fri, 25 Jan 2013, Carlos R. Mafra wrote:
>> On Fri, 25 Jan 2013 at  1:06:58 +0100, Rodolfo García Peñas wrote:
>>> I changed the behavior for the winspector. Can you test it now?
>>>
>>> More testers are welcome. If the patch is ok, I will write the commit
>>> info.
>>
>> I'm a bit lost about which behavior is being fixed. What is the test
>> case to aim for?
>>
>> On the other hand, if Zoltan says it fixes his issues, I'll apply
>> without testing it myself :-)
> 
> I don't have time to test it now but I've described the problem, testing
> procedure and provided a test case in the thread starting at
> 
> http://lists.windowmaker.org/dev/msg04395.html
> 
> The test case is here:
> http://lists.windowmaker.org/dev/msg04396.html
> (Should show a white rectangle in the app icon which is the icon window.)
> 
> The procedure to test Ignore app icon is here:
> http://lists.windowmaker.org/dev/msg04452.html
> 
> Hope this helps.
> 
> Regards,
> BALATON Zoltan

Hi Carlos, Zoltan,

I am changing the icon behavior in winspector.c, these cases:

1. ignore flag + file set
2. no ignore flag + file set
3. ignore flag + no file set
4. no ignore flag + no file set

I didn't change the xfig related problem.

About the patch, we have 8 different cases, 4 for apply and 4 for save.

Apply:

1. ignore flag + file set
2. no ignore flag + file set
3. ignore flag + no file set
4. no ignore flag + no file set

If the "ignore client supplied icon flag" is not set, then the user wants to 
use the client (window/icon) provided image, so the file textbox don't matter. 
Then, we use the client icon and we don't use the file provided in the text 
box. Options 2 and 4 are done.

If the user set the flag, and set the icon name, perfect, the user provides the 
icon. Option 1 is done.

The problem is if the user try to set an icon (ignore flag is set) but the file 
textbox is not set (no icon provided). Now the code does:

1. Show a message box to the user with a warning. The warning show:

+                       snprintf(buf, len, _("Ignore client supplied icon is 
set, but icon filename textbox is empty. Using client supplied icon"));

2. Unset the "ignore flag" and use the client provided icon. Is like we change 
the case 3 to case 4:

Option 3 is done too.

This is the full code:

+               /* If always_user_icon flag is set, but the user icon is not set
+                * we use client supplied icon and we unset the flag */
+               if ((WFLAGP(wwin, always_user_icon) && (!file))) {
+                       /* Show the warning */
+                       char *buf;
+                       int len = 100;
+                       buf = wmalloc(len);
+                       snprintf(buf, len, _("Ignore client supplied icon is 
set, but icon filename textbox is empty. Using client supplied icon"));
+                       wMessageDialog(panel->frame->screen_ptr, _("Warning"), 
buf, _("OK"), NULL, NULL);
+                       wfree(buf);
+                       wfree(file);
+
+                       /* Change the flags */
+                       WSETUFLAG(wwin, always_user_icon, 0);
+                       WMSetButtonSelected(panel->alwChk, 0);
+               }

After these lines, we change the initial case 3 to the case 4, and then we can 
apply the cases 1,2,4:

+               /* After test the always_user_icon flag value before,
+                * the "else" block is used only if the flag is set and
+                * the icon text box has an icon path */
+               if (!WFLAGP(wwin, always_user_icon)) { *<----- Cases 1,3*
+                       /* Change App Icon image, using the icon provided by 
the client */
                        if (wapp->app_icon)
+                               wIconUpdate(wapp->app_icon->icon,
+                                           
get_rimage_icon_from_wm_hints(wapp->app_icon->icon));
+
+                       /* Change icon image if the app is minimized,
+                        * using the icon provided by the client */
+                       if (wwin->icon)
+                               wIconUpdate(wwin->icon, 
get_rimage_icon_from_wm_hints(wwin->icon));
                } else { *<----- Case 4 (and wrong 3*
                        /* Change App Icon image */
                        if (wapp->app_icon)
+                               wIconChangeImageFile(wapp->app_icon->icon, 
file);
 
                        /* Change icon image if the app is minimized */
                        if (wwin->icon)
+                               wIconChangeImageFile(wwin->icon, file);
                }

About the "save", we do the same in the 4 options:

Now all is easier. We save the flag "Yes" or "No" always and we save the user 
provided icon in the textbox.
Then, the user can see the last icon set in the textbox by the user always, if 
the icon is used (flag is set) or not.

+       /* Save the icon info */
+       /* The flag "Ignore client suplied icon is not selected" */
+       buf1 = wmalloc(4);
+       snprintf(buf1, 4, "%s", (WMGetButtonSelected(panel->alwChk) != 0) ? 
"Yes" : "No");
+       value1 = WMCreatePLString(buf1);
+       different |= insertAttribute(dict, winDic, AAlwaysUserIcon, value1, 
flags);
+       WMReleasePropList(value1);
+       wfree(buf1);
+
+       /* The icon filename (if exists) */
+       icon_file = WMGetTextFieldText(panel->fileText);
+       if ((icon_file) && (icon_file[0] != 0)) {
+               value = WMCreatePLString(icon_file);
+               different |= insertAttribute(dict, winDic, AIcon, value, flags);
+               different2 |= insertAttribute(dict, appDic, AIcon, value, 
flags);
+               WMReleasePropList(value);
+               wfree(icon_file);
        }

Cheers,
kix
-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to