]> Dogcows Code - chaz/openbox/commitdiff
Constrain the moveresize popup to the monitor which has the client
authorMikael Magnusson <mikachu@gmail.com>
Tue, 23 Apr 2013 20:29:58 +0000 (22:29 +0200)
committerMikael Magnusson <mikachu@gmail.com>
Fri, 7 Jun 2013 06:40:52 +0000 (08:40 +0200)
openbox/moveresize.c
openbox/popup.c
openbox/popup.h

index 2d0dc3ac02a575bd447b2ff16d1581222e30eea2..333a1bea5ff3563f35d45ddc7358dc0015a57d11 100644 (file)
@@ -83,6 +83,8 @@ static void client_dest(ObClient *client, gpointer data)
 {
     if (moveresize_client == client)
         moveresize_end(TRUE);
+    if (popup && client == popup->client)
+        popup->client = NULL;
 }
 
 void moveresize_startup(gboolean reconfig)
@@ -167,6 +169,7 @@ static void popup_coords(ObClient *c, const gchar *format, gint a, gint b)
 
         popup_position(popup, gravity, x, y);
     }
+    popup->client = c;
     popup_show(popup, text);
     g_free(text);
 }
@@ -312,6 +315,7 @@ void moveresize_end(gboolean cancel)
     ungrab_pointer();
 
     popup_hide(popup);
+    popup->client = NULL;
 
     if (!moving) {
 #ifdef SYNC
index 2a83d7b8ed652832026526334cda9bc0455e36a4..5ecf2fa50843eb38b2a73a7bdeafa29ea7d42076 100644 (file)
@@ -250,16 +250,22 @@ void popup_delay_show(ObPopup *self, gulong msec, gchar *text)
         break;
     }
 
-    /* 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);
+    }
     area = screen_physical_area_monitor(m);
 
-    x=MAX(MIN(x, area->x+area->width-w),area->x);
-    y=MAX(MIN(y, area->y+area->height-h),area->y);
+    x = MAX(MIN(x, area->x+area->width-w), area->x);
+    y = MAX(MIN(y, area->y+area->height-h), area->y);
 
     if (m == screen_num_monitors) {
         RECT_SET(mon, x, y, w, h);
@@ -268,8 +274,8 @@ void popup_delay_show(ObPopup *self, gulong msec, gchar *text)
             m = 0;
         area = screen_physical_area_monitor(m);
 
-        x=MAX(MIN(x, area->x+area->width-w),area->x);
-        y=MAX(MIN(y, area->y+area->height-h),area->y);
+        x = MAX(MIN(x, area->x+area->width-w), area->x);
+        y = MAX(MIN(y, area->y+area->height-h), area->y);
     }
 
     /* set the windows/appearances up */
index 6de9d184cdaf08109debda8989a2ca07a786b292..6d6ba6ab482e65d57721ea1be9fafdbf3d0697c3 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef __popup_h
 #define __popup_h
 
+#include "client.h"
 #include "window.h"
 #include "obrender/render.h"
 #include <glib.h>
@@ -57,6 +58,8 @@ struct _ObPopup
 
     void (*draw_icon)(gint x, gint y, gint w, gint h, gpointer data);
     gpointer draw_icon_data;
+
+    ObClient *client;
 };
 
 struct _ObIconPopup
This page took 0.026085 seconds and 4 git commands to generate.