+void client_update_icon_geometry(ObClient *self)
+{
+ guint num;
+ guint32 *data;
+
+ RECT_SET(self->icon_geometry, 0, 0, 0, 0);
+
+ if (PROP_GETA32(self->window, net_wm_icon_geometry, cardinal, &data, &num)
+ && num == 4)
+ {
+ /* don't let them set it with an area < 0 */
+ RECT_SET(self->icon_geometry, data[0], data[1],
+ MAX(data[2],0), MAX(data[3],0));
+ }
+}
+
+static void client_get_session_ids(ObClient *self)
+{
+ guint32 leader;
+ gboolean got;
+ gchar *s;
+ gchar **ss;
+
+ if (!PROP_GET32(self->window, wm_client_leader, window, &leader))
+ leader = None;
+
+ /* get the SM_CLIENT_ID */
+ got = FALSE;
+ if (leader)
+ got = PROP_GETS(leader, sm_client_id, locale, &self->sm_client_id);
+ if (!got)
+ PROP_GETS(self->window, sm_client_id, locale, &self->sm_client_id);
+
+ /* get the WM_CLASS (name and class). make them "" if they are not
+ provided */
+ got = FALSE;
+ if (leader)
+ got = PROP_GETSS(leader, wm_class, locale, &ss);
+ if (!got)
+ got = PROP_GETSS(self->window, wm_class, locale, &ss);
+
+ if (got) {
+ if (ss[0]) {
+ self->name = g_strdup(ss[0]);
+ if (ss[1])
+ self->class = g_strdup(ss[1]);
+ }
+ g_strfreev(ss);
+ }
+
+ if (self->name == NULL) self->name = g_strdup("");
+ if (self->class == NULL) self->class = g_strdup("");
+
+ /* get the WM_WINDOW_ROLE. make it "" if it is not provided */
+ got = FALSE;
+ if (leader)
+ got = PROP_GETS(leader, wm_window_role, locale, &s);
+ if (!got)
+ got = PROP_GETS(self->window, wm_window_role, locale, &s);
+
+ if (got)
+ self->role = s;
+ else
+ self->role = g_strdup("");
+
+ /* get the WM_COMMAND */
+ got = FALSE;
+
+ if (leader)
+ got = PROP_GETSS(leader, wm_command, locale, &ss);
+ if (!got)
+ got = PROP_GETSS(self->window, wm_command, locale, &ss);
+
+ if (got) {
+ /* merge/mash them all together */
+ gchar *merge = NULL;
+ gint i;
+
+ for (i = 0; ss[i]; ++i) {
+ gchar *tmp = merge;
+ if (merge)
+ merge = g_strconcat(merge, ss[i], NULL);
+ else
+ merge = g_strconcat(ss[i], NULL);
+ g_free(tmp);
+ }
+ g_strfreev(ss);
+
+ self->wm_command = merge;
+ }
+
+ /* get the WM_CLIENT_MACHINE */
+ got = FALSE;
+ if (leader)
+ got = PROP_GETS(leader, wm_client_machine, locale, &s);
+ if (!got)
+ got = PROP_GETS(self->window, wm_client_machine, locale, &s);
+
+ if (got) {
+ gchar localhost[128];
+
+ gethostname(localhost, 127);
+ localhost[127] = '\0';
+ if (strcmp(localhost, s) != 0)
+ self->client_machine = s;
+ }
+}
+