+ /* set the default icon onto the window
+ in theory, this could be a race, but if a window doesn't set an icon
+ or removes it entirely, it's not very likely it is going to set one
+ right away afterwards */
+ if (self->nicons == 0) {
+ RrPixel32 *icon = ob_rr_theme->def_win_icon;
+ gulong *data;
+
+ data = g_new(gulong, 48*48+2);
+ data[0] = data[1] = 48;
+ for (i = 0; i < 48*48; ++i)
+ data[i+2] = (((icon[i] >> RrDefaultAlphaOffset) & 0xff) << 24) +
+ (((icon[i] >> RrDefaultRedOffset) & 0xff) << 16) +
+ (((icon[i] >> RrDefaultGreenOffset) & 0xff) << 8) +
+ (((icon[i] >> RrDefaultBlueOffset) & 0xff) << 0);
+ PROP_SETA32(self->window, net_wm_icon, cardinal, data, 48*48+2);
+ g_free(data);
+ } else if (self->frame)
+ /* don't draw the icon empty if we're just setting one now anyways,
+ we'll get the property change any second */
+ frame_adjust_icon(self->frame);
+}
+
+void client_update_user_time(ObClient *self)
+{
+ guint32 time;
+
+ if (PROP_GET32(self->window, net_wm_user_time, cardinal, &time)) {
+ /* we set this every time, not just when it grows, because in practice
+ sometimes time goes backwards! (ntpdate.. yay....) so.. if it goes
+ backward we don't want all windows to stop focusing. we'll just
+ assume noone is setting times older than the last one, cuz that
+ would be pretty stupid anyways
+ */
+ self->user_time = time;
+
+ /*
+ ob_debug("window %s user time %u\n", self->title, time);
+ */
+ }
+}
+
+static void client_get_client_machine(ObClient *self)
+{
+ gchar *data = NULL;
+ gchar localhost[128];
+
+ g_free(self->client_machine);
+
+ if (PROP_GETS(self->window, wm_client_machine, locale, &data)) {
+ gethostname(localhost, 127);
+ localhost[127] = '\0';
+ if (strcmp(localhost, data))
+ self->client_machine = data;
+ }
+}
+
+static void client_change_wm_state(ObClient *self)
+{
+ gulong state[2];
+ glong old;
+
+ old = self->wmstate;
+
+ if (self->shaded || self->iconic || !self->frame->visible)
+ self->wmstate = IconicState;
+ else
+ self->wmstate = NormalState;
+
+ if (old != self->wmstate) {
+ PROP_MSG(self->window, kde_wm_change_state,
+ self->wmstate, 1, 0, 0);
+
+ state[0] = self->wmstate;
+ state[1] = None;
+ PROP_SETA32(self->window, wm_state, wm_state, state, 2);
+ }