Constrain the moveresize popup to the monitor which has the client
This commit is contained in:
parent
8be9cc92b6
commit
1b73a29646
3 changed files with 23 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue