Constrain the moveresize popup to the monitor which has the client
Mikael Magnusson mikachu@gmail.com
3 files changed,
23 insertions(+),
10 deletions(-)
M
openbox/moveresize.c
→
openbox/moveresize.c
@@ -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 @@ }
popup_position(popup, gravity, x, y); } + popup->client = c; popup_show(popup, text); g_free(text); }@@ -312,6 +315,7 @@ ungrab_keyboard();
ungrab_pointer(); popup_hide(popup); + popup->client = NULL; if (!moving) { #ifdef SYNC
M
openbox/popup.c
→
openbox/popup.c
@@ -250,16 +250,22 @@ y -= h;
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 @@ if (m == screen_num_monitors)
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 */
M
openbox/popup.h
→
openbox/popup.h
@@ -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 @@ guint delay_timer;
void (*draw_icon)(gint x, gint y, gint w, gint h, gpointer data); gpointer draw_icon_data; + + ObClient *client; }; struct _ObIconPopup