- /* Find the monitor which contains the biggest part of the popup.
- * If the popup is completely off screen, limit it to the intersection
- * of all monitors and then try again. If it's still off screen, put it
- * on monitor 0. */
- RECT_SET(mon, x, y, w, h);
- m = screen_find_monitor(&mon);
+ /* If the popup belongs to a client (eg, the moveresize popup), get
+ * the monitor for that client, otherwise do other stuff */
+ if (self->client) {
+ m = client_monitor(self->client);
+ } else {
+ /* Find the monitor which contains the biggest part of the popup.
+ * If the popup is completely off screen, limit it to the intersection
+ * of all monitors and then try again. If it's still off screen, put it
+ * on monitor 0. */
+ RECT_SET(mon, x, y, w, h);
+ m = screen_find_monitor(&mon);
+ }