Allow client move among screens in free mode
This commit is contained in:
parent
31df2361a7
commit
0f3bc2ed0d
33
src/client.c
33
src/client.c
@ -1086,6 +1086,32 @@ client_moveresize(struct client *c, struct geo *g)
|
|||||||
c->wgeo.y = c->tbarw;
|
c->wgeo.y = c->tbarw;
|
||||||
c->geo.w = c->rgeo.w = c->wgeo.w + c->border + c->border;
|
c->geo.w = c->rgeo.w = c->wgeo.w + c->border + c->border;
|
||||||
c->geo.h = c->rgeo.h = c->wgeo.h + c->tbarw + c->border;
|
c->geo.h = c->rgeo.h = c->wgeo.h + c->tbarw + c->border;
|
||||||
|
|
||||||
|
c->rgeo.x += c->screen->ugeo.x;
|
||||||
|
c->rgeo.y += c->screen->ugeo.y;
|
||||||
|
|
||||||
|
if(!INAREA(c->rgeo.x, c->rgeo.y, c->screen->ugeo))
|
||||||
|
{
|
||||||
|
/* New screen (moved by mouse) */
|
||||||
|
if(c->flags & CLIENT_MOUSE)
|
||||||
|
{
|
||||||
|
c->flags |= CLIENT_IGNORE_LAYOUT;
|
||||||
|
c->screen = screen_gb_geo(c->rgeo.x, c->rgeo.y);
|
||||||
|
tag_client(c->screen->seltag, c);
|
||||||
|
|
||||||
|
c->geo.x = c->rgeo.x - c->screen->ugeo.x;
|
||||||
|
c->geo.y = c->rgeo.y - c->screen->ugeo.y;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* Out of the screen case */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c->geo.x = (c->screen->ugeo.w >> 1) - (c->geo.w >> 1);
|
||||||
|
c->geo.y = (c->screen->ugeo.h >> 1) - (c->geo.h >> 1);
|
||||||
|
c->rgeo.x = c->screen->ugeo.x + c->geo.x;
|
||||||
|
c->rgeo.y = c->screen->ugeo.y + c->geo.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Adjust window regarding required size for frame (tiling) */
|
/* Adjust window regarding required size for frame (tiling) */
|
||||||
else
|
else
|
||||||
@ -1094,11 +1120,10 @@ client_moveresize(struct client *c, struct geo *g)
|
|||||||
|
|
||||||
if(!(c->flags & CLIENT_DID_WINSIZE))
|
if(!(c->flags & CLIENT_DID_WINSIZE))
|
||||||
client_winsize(c, g);
|
client_winsize(c, g);
|
||||||
}
|
|
||||||
|
|
||||||
/* Real geo regarding full root size */
|
c->rgeo.x += c->screen->ugeo.x;
|
||||||
c->rgeo.x += c->screen->ugeo.x;
|
c->rgeo.y += c->screen->ugeo.y;
|
||||||
c->rgeo.y += c->screen->ugeo.y;
|
}
|
||||||
|
|
||||||
XMoveResizeWindow(W->dpy, c->frame,
|
XMoveResizeWindow(W->dpy, c->frame,
|
||||||
c->rgeo.x, c->rgeo.y,
|
c->rgeo.x, c->rgeo.y,
|
||||||
|
|||||||
13
src/draw.h
13
src/draw.h
@ -83,19 +83,6 @@ draw_reversed_rect(Drawable dr, struct client *c, bool t)
|
|||||||
g->h - (i << 1));
|
g->h - (i << 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
|
||||||
draw_reversed_cross(Drawable dr, struct geo *g)
|
|
||||||
{
|
|
||||||
int x = g->x + W->screen->ugeo.x;
|
|
||||||
int y = g->y + W->screen->ugeo.y;
|
|
||||||
|
|
||||||
XDrawLine(W->dpy, dr, W->rgc,
|
|
||||||
x, y, x + g->w, y + g->h);
|
|
||||||
|
|
||||||
XDrawLine(W->dpy, dr, W->rgc,
|
|
||||||
x + g->w, y, x, y + g->h);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned short
|
static inline unsigned short
|
||||||
draw_textw(struct theme *t, const char *str)
|
draw_textw(struct theme *t, const char *str)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -42,6 +42,8 @@ mouse_resize(struct client *c)
|
|||||||
ix = ox;
|
ix = ox;
|
||||||
iy = oy;
|
iy = oy;
|
||||||
|
|
||||||
|
c->flags |= CLIENT_MOUSE;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
XMaskEvent(W->dpy, MouseMask | SubstructureRedirectMask, &ev);
|
XMaskEvent(W->dpy, MouseMask | SubstructureRedirectMask, &ev);
|
||||||
@ -110,6 +112,8 @@ mouse_resize(struct client *c)
|
|||||||
layout_save_set(c->tag);
|
layout_save_set(c->tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c->flags &= ~CLIENT_MOUSE;
|
||||||
|
|
||||||
XUngrabServer(W->dpy);
|
XUngrabServer(W->dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,6 +156,8 @@ mouse_move(struct client *c, void (*func)(struct client*, struct client*))
|
|||||||
|
|
||||||
_REV_SBORDER(c);
|
_REV_SBORDER(c);
|
||||||
|
|
||||||
|
c->flags |= CLIENT_MOUSE;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
XMaskEvent(W->dpy, MouseMask | SubstructureRedirectMask, &ev);
|
XMaskEvent(W->dpy, MouseMask | SubstructureRedirectMask, &ev);
|
||||||
@ -205,6 +211,8 @@ mouse_move(struct client *c, void (*func)(struct client*, struct client*))
|
|||||||
if(!func)
|
if(!func)
|
||||||
client_moveresize(c, &c->geo);
|
client_moveresize(c, &c->geo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c->flags &= ~CLIENT_MOUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@ -118,7 +118,6 @@ tag_client(struct tag *t, struct client *c)
|
|||||||
|
|
||||||
if(t != c->screen->seltag || c->flags & CLIENT_TABBED)
|
if(t != c->screen->seltag || c->flags & CLIENT_TABBED)
|
||||||
client_unmap(c);
|
client_unmap(c);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@ -198,6 +198,7 @@ struct client
|
|||||||
#define CLIENT_FULLSCREEN 0x800
|
#define CLIENT_FULLSCREEN 0x800
|
||||||
#define CLIENT_FREE 0x1000
|
#define CLIENT_FREE 0x1000
|
||||||
#define CLIENT_TILED 0x2000
|
#define CLIENT_TILED 0x2000
|
||||||
|
#define CLIENT_MOUSE 0x4000
|
||||||
Flags flags;
|
Flags flags;
|
||||||
Window win, frame, tmp;
|
Window win, frame, tmp;
|
||||||
SLIST_ENTRY(client) next; /* Global list */
|
SLIST_ENTRY(client) next; /* Global list */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user