+def _place_popup():
+ if POPUP_IN_WINDOW:
+ area = _client.frame.area()
+ else:
+ area = otk.Rect(otk.Point(0, 0), ob.openbox.screen(_screen).size())
+ size = _popwidget.minSize()
+ if POPUP_CENTERED:
+ x = area.position().x() + (area.size().width() - size.width()) / 2
+ y = area.position().y() + (area.size().height() - size.height()) / 2
+ else:
+ try: x, y = POPUP_COORDS
+ except: x = y = 0
+ if x < 0: x += area.right() - size.width() + 2
+ if y < 0: y += area.bottom() - size.height() + 2
+ x += area.position().x()
+ y += area.position().y()
+ _popwidget.moveresize(otk.Rect(x, y, size.width(), size.height()))
+