> From: "Rodolfo García Peñas (kix)" <[email protected]>
> 
> This function reads the final position for a WAppIcon, and set it
> for the WAppIcon argument. The code of this function cames from
> the functions wClipRestoreState and wDockRestoreState (C&P).

It looks like the function really belongs to appicon.c, perhaps called
wAppIconRestorePosition(). As such, I would rather the second argument
be WMPropList* state, rather than having the function dig it from
scr->session_state.

> In this patch, this function is not used.

OK, so final decision on that patch is pending the final decision on the bigger 
question of rationalizing the startup + session restoration process. See you in 
a sec in the next patch.

-- Daniel

> Signed-off-by: Rodolfo García Peñas (kix) <[email protected]>
> ---
>  src/dock.c |   41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/src/dock.c b/src/dock.c
> index cb6af0b..529740a 100644
> --- a/src/dock.c
> +++ b/src/dock.c
> @@ -1515,6 +1515,47 @@ static WAppIcon *restore_icon_state(WScreen
> *scr, WMPropList *info, int type, in
>  
>  #define COMPLAIN(key) wwarning(_("bad value in dock state info:%s"),
>  key)
>  
> +void set_appicon_position_from_dictionary(WAppIcon *icon, int type)
> +{
> +     WMPropList *value, *state;
> +     WScreen *scr = icon->icon->core->screen_ptr;
> +
> +     if (type == WM_CLIP)
> +             state = WMGetFromPLDictionary(scr->session_state, dClip);
> +     else
> +             state = WMGetFromPLDictionary(scr->session_state, dDock);
> +
> +     WMRetainPropList(state);
> +
> +     /* restore position */
> +     value = WMGetFromPLDictionary(state, dPosition);
> +
> +     if (value) {
> +             if (!WMIsPLString(value)) {
> +                     COMPLAIN("Position");
> +             } else {
> +                     WMRect rect;
> +                     int flags;
> +
> +                     if (sscanf(WMGetFromPLString(value), "%i,%i", 
> &icon->x_pos,
> &icon->y_pos) != 2)
> +                             COMPLAIN("Position");
> +
> +                     /* check position sanity */
> +                     rect.pos.x = icon->x_pos;
> +                     rect.pos.y = icon->y_pos;
> +                     rect.size.width = rect.size.height = ICON_SIZE;
> +
> +                     wGetRectPlacementInfo(scr, rect, &flags);
> +                     if (flags & (XFLAG_DEAD | XFLAG_PARTIAL)) {
> +                             int x = icon->x_pos;
> +                             wScreenKeepInside(scr, &x, &icon->y_pos, 
> ICON_SIZE, ICON_SIZE);
> +                     }
> +             }
> +     }
> +
> +     WMReleasePropList(state);
> +}
> +
>  WAppIcon *wClipRestoreState(WScreen *scr, WMPropList *clip_state)
>  {
>       WAppIcon *icon;
> --
> 1.7.10.4
> 
> 
> --
> To unsubscribe, send mail to
> [email protected].
> 


--
To unsubscribe, send mail to [email protected].

Reply via email to