+
+ event_end_ignore_all_enters(ignore_start);
+ } else if (self->delay_mapped) {
+ g_source_remove(self->delay_timer);
+ self->delay_timer = 0;
+ self->delay_mapped = FALSE;
+ }
+}
+
+static void icon_popup_draw_icon(gint x, gint y, gint w, gint h, gpointer data)
+{
+ ObIconPopup *self = data;
+
+ self->a_icon->surface.parent = self->popup->a_bg;
+ self->a_icon->surface.parentx = x;
+ self->a_icon->surface.parenty = y;
+ XMoveResizeWindow(obt_display, self->icon, x, y, w, h);
+ RrPaint(self->a_icon, self->icon, w, h);
+}
+
+ObIconPopup *icon_popup_new(void)
+{
+ ObIconPopup *self;
+
+ self = g_slice_new0(ObIconPopup);
+ self->popup = popup_new();
+ self->a_icon = RrAppearanceCopy(ob_rr_theme->a_clear_tex);
+ self->icon = XCreateWindow(obt_display, self->popup->bg,
+ 0, 0, 1, 1, 0,
+ RrDepth(ob_rr_inst), InputOutput,
+ RrVisual(ob_rr_inst), 0, NULL);
+ XMapWindow(obt_display, self->icon);
+
+ self->popup->hasicon = TRUE;
+ self->popup->draw_icon = icon_popup_draw_icon;
+ self->popup->draw_icon_data = self;
+
+ return self;
+}
+
+void icon_popup_free(ObIconPopup *self)
+{
+ if (self) {
+ XDestroyWindow(obt_display, self->icon);
+ RrAppearanceFree(self->a_icon);
+ popup_free(self->popup);
+ g_slice_free(ObIconPopup, self);
+ }
+}
+
+void icon_popup_delay_show(ObIconPopup *self, gulong msec,
+ gchar *text, RrImage *icon)
+{
+ if (icon) {
+ RrAppearanceClearTextures(self->a_icon);
+ self->a_icon->texture[0].type = RR_TEXTURE_IMAGE;
+ self->a_icon->texture[0].data.image.alpha = 0xff;
+ self->a_icon->texture[0].data.image.image = icon;
+ } else {
+ RrAppearanceClearTextures(self->a_icon);
+ self->a_icon->texture[0].type = RR_TEXTURE_NONE;
+ }
+
+ popup_delay_show(self->popup, msec, text);
+}
+
+void icon_popup_icon_size_multiplier(ObIconPopup *self, guint wm, guint hm)
+{
+ /* cap them at 1 */
+ self->popup->iconwm = MAX(1, wm);
+ self->popup->iconhm = MAX(1, hm);
+}
+
+static void pager_popup_draw_icon(gint px, gint py, gint w, gint h,
+ gpointer data)
+{
+ ObPagerPopup *self = data;
+ gint x, y;
+ guint rown, n;
+ guint horz_inc;
+ guint vert_inc;
+ guint r, c;
+ gint eachw, eachh;
+ const guint cols = screen_desktop_layout.columns;
+ const guint rows = screen_desktop_layout.rows;
+ const gint linewidth = ob_rr_theme->obwidth;
+
+ eachw = (w - ((cols + 1) * linewidth)) / cols;
+ eachh = (h - ((rows + 1) * linewidth)) / rows;
+ /* make them squares */
+ eachw = eachh = MIN(eachw, eachh);
+
+ /* center */
+ px += (w - (cols * (eachw + linewidth) + linewidth)) / 2;
+ py += (h - (rows * (eachh + linewidth) + linewidth)) / 2;
+
+ if (eachw <= 0 || eachh <= 0)
+ return;
+
+ switch (screen_desktop_layout.orientation) {
+ case OB_ORIENTATION_HORZ:
+ switch (screen_desktop_layout.start_corner) {
+ case OB_CORNER_TOPLEFT:
+ n = 0;
+ horz_inc = 1;
+ vert_inc = cols;
+ break;
+ case OB_CORNER_TOPRIGHT:
+ n = cols - 1;
+ horz_inc = -1;
+ vert_inc = cols;
+ break;
+ case OB_CORNER_BOTTOMRIGHT:
+ n = rows * cols - 1;
+ horz_inc = -1;
+ vert_inc = -screen_desktop_layout.columns;
+ break;
+ case OB_CORNER_BOTTOMLEFT:
+ n = (rows - 1) * cols;
+ horz_inc = 1;
+ vert_inc = -cols;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+ break;
+ case OB_ORIENTATION_VERT:
+ switch (screen_desktop_layout.start_corner) {
+ case OB_CORNER_TOPLEFT:
+ n = 0;
+ horz_inc = rows;
+ vert_inc = 1;
+ break;
+ case OB_CORNER_TOPRIGHT:
+ n = rows * (cols - 1);
+ horz_inc = -rows;
+ vert_inc = 1;
+ break;
+ case OB_CORNER_BOTTOMRIGHT:
+ n = rows * cols - 1;
+ horz_inc = -rows;
+ vert_inc = -1;
+ break;
+ case OB_CORNER_BOTTOMLEFT:
+ n = rows - 1;
+ horz_inc = rows;
+ vert_inc = -1;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+ break;
+ default:
+ g_assert_not_reached();