static gboolean place_transient_splash(ObClient *client, Rect *area, gint *x, gint *y, Size frame_size) { if (client->type == OB_CLIENT_TYPE_DIALOG) { GSList *it; gboolean first = TRUE; gint l, r, t, b; ob_debug("placing dialog"); for (it = client->parents; it; it = g_slist_next(it)) { ObClient *m = it->data; if (!m->iconic) { if (first) { l = RECT_LEFT(m->frame->area); t = RECT_TOP(m->frame->area); r = RECT_RIGHT(m->frame->area); b = RECT_BOTTOM(m->frame->area); first = FALSE; } else { l = MIN(l, RECT_LEFT(m->frame->area)); t = MIN(t, RECT_TOP(m->frame->area)); r = MAX(r, RECT_RIGHT(m->frame->area)); b = MAX(b, RECT_BOTTOM(m->frame->area)); } } if (!first) { *x = ((r + 1 - l) - frame_size.width) / 2 + l; *y = ((b + 1 - t) - frame_size.height) / 2 + t; return TRUE; } } } if (client->type == OB_CLIENT_TYPE_DIALOG || client->type == OB_CLIENT_TYPE_SPLASH) { ob_debug("placing dialog or splash"); *x = (area->width - frame_size.width) / 2 + area->x; *y = (area->height - frame_size.height) / 2 + area->y; return TRUE; } return FALSE; }
static void do_edge_warp(gint x, gint y) { guint i; ObDirection dir; if (!config_mouse_screenedgetime) return; dir = -1; for (i = 0; i < screen_num_monitors; ++i) { const Rect *a = screen_physical_area_monitor(i); if (!RECT_CONTAINS(*a, x, y)) continue; if (x == RECT_LEFT(*a)) dir = OB_DIRECTION_WEST; if (x == RECT_RIGHT(*a)) dir = OB_DIRECTION_EAST; if (y == RECT_TOP(*a)) dir = OB_DIRECTION_NORTH; if (y == RECT_BOTTOM(*a)) dir = OB_DIRECTION_SOUTH; /* try check for xinerama boundaries */ if ((x + 1 == RECT_LEFT(*a) || x - 1 == RECT_RIGHT(*a)) && (dir == OB_DIRECTION_WEST || dir == OB_DIRECTION_EAST)) { dir = -1; } if ((y + 1 == RECT_TOP(*a) || y - 1 == RECT_BOTTOM(*a)) && (dir == OB_DIRECTION_NORTH || dir == OB_DIRECTION_SOUTH)) { dir = -1; } } if (dir != edge_warp_dir) { cancel_edge_warp(); if (dir != (ObDirection)-1) { edge_warp_odd = TRUE; /* switch on the first timeout */ edge_warp_timer = g_timeout_add(config_mouse_screenedgetime, edge_warp_delay_func, NULL); } edge_warp_dir = dir; } }
static void popup_coords(ObClient *c, const gchar *format, gint a, gint b) { gchar *text; text = g_strdup_printf(format, a, b); if (config_resize_popup_pos == OB_RESIZE_POS_TOP) popup_position(popup, SouthGravity, c->frame->area.x + c->frame->area.width/2, c->frame->area.y - ob_rr_theme->fbwidth); else if (config_resize_popup_pos == OB_RESIZE_POS_CENTER) popup_position(popup, CenterGravity, c->frame->area.x + c->frame->area.width / 2, c->frame->area.y + c->frame->area.height / 2); else /* Fixed */ { const Rect *area = screen_physical_area_active(); gint gravity, x, y; x = config_resize_popup_fixed.x.pos; if (config_resize_popup_fixed.x.center) x = area->x + area->width/2; else if (config_resize_popup_fixed.x.opposite) x = RECT_RIGHT(*area) - x; else x = area->x + x; y = config_resize_popup_fixed.y.pos; if (config_resize_popup_fixed.y.center) y = area->y + area->height/2; else if (config_resize_popup_fixed.y.opposite) y = RECT_RIGHT(*area) - y; else y = area->y + y; if (config_resize_popup_fixed.x.center) { if (config_resize_popup_fixed.y.center) gravity = CenterGravity; else if (config_resize_popup_fixed.y.opposite) gravity = SouthGravity; else gravity = NorthGravity; } else if (config_resize_popup_fixed.x.opposite) { if (config_resize_popup_fixed.y.center) gravity = EastGravity; else if (config_resize_popup_fixed.y.opposite) gravity = SouthEastGravity; else gravity = NorthEastGravity; } else { if (config_resize_popup_fixed.y.center) gravity = WestGravity; else if (config_resize_popup_fixed.y.opposite) gravity = SouthWestGravity; else gravity = NorthWestGravity; } popup_position(popup, gravity, x, y); } popup_show(popup, text); g_free(text); }