From: "Rodolfo García Peñas (kix)" <k...@kix.es> 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).
In this patch, this function is not used. --- src/dock.c | 33 +++++++++++++++++++++++++++++++++ src/dock.h | 2 ++ 2 files changed, 35 insertions(+) diff --git a/src/dock.c b/src/dock.c index 3666f52..f39a29f 100644 --- a/src/dock.c +++ b/src/dock.c @@ -1801,6 +1801,39 @@ 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 { + if (sscanf(WMGetFromPLString(value), "%i,%i", &icon->x_pos, &icon->y_pos) != 2) + COMPLAIN("Position"); + + /* check position sanity */ + if (!onScreen(scr, icon->x_pos, icon->y_pos)) { + 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; diff --git a/src/dock.h b/src/dock.h index 2c6c4bc..bac7ab3 100644 --- a/src/dock.h +++ b/src/dock.h @@ -127,4 +127,6 @@ typedef enum int wClipMakeIconOmnipresent(WAppIcon *aicon, int omnipresent); +void set_appicon_position_from_dictionary(WAppIcon *icon, int type); + #endif -- 1.7.10.4 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.