+
+guint client_monitor(ObClient *self)
+{
+ guint i;
+
+ for (i = 0; i < screen_num_monitors; ++i) {
+ Rect *area = screen_physical_area_monitor(i);
+ if (RECT_INTERSECTS_RECT(*area, self->frame->area))
+ break;
+ }
+ if (i == screen_num_monitors) i = 0;
+ g_assert(i < screen_num_monitors);
+ return i;
+}
+
+ObClient *client_search_top_transient(ObClient *self)
+{
+ /* move up the transient chain as far as possible */
+ if (self->transient_for) {
+ if (self->transient_for != OB_TRAN_GROUP) {
+ return client_search_top_transient(self->transient_for);
+ } else {
+ GSList *it;
+
+ for (it = self->group->members; it; it = it->next) {
+ ObClient *c = it->data;
+
+ /* checking transient_for prevents infinate loops! */
+ if (c != self && !c->transient_for)
+ break;
+ }
+ if (it)
+ return it->data;
+ }
+ }
+
+ return self;
+}