introduce move_client_to_screen to move a client in a new screen and tag it with good tags
This commit is contained in:
parent
ab738c9cab
commit
8112ec2cca
10
client.c
10
client.c
|
@ -403,7 +403,7 @@ manage(Display *disp, DC *drawcontext, Window w, XWindowAttributes *wa, awesome_
|
||||||
ScreenInfo *si = get_display_info(disp, awesomeconf->screen, &awesomeconf->statusbar);
|
ScreenInfo *si = get_display_info(disp, awesomeconf->screen, &awesomeconf->statusbar);
|
||||||
|
|
||||||
c = p_new(Client, 1);
|
c = p_new(Client, 1);
|
||||||
c->tags = p_new(Bool, awesomeconf->ntags);
|
move_client_to_screen(c, awesomeconf);
|
||||||
c->win = w;
|
c->win = w;
|
||||||
c->ftview = True;
|
c->ftview = True;
|
||||||
c->x = c->rw = wa->x;
|
c->x = c->rw = wa->x;
|
||||||
|
@ -412,7 +412,6 @@ manage(Display *disp, DC *drawcontext, Window w, XWindowAttributes *wa, awesome_
|
||||||
c->h = c->rh = wa->height;
|
c->h = c->rh = wa->height;
|
||||||
c->oldborder = wa->border_width;
|
c->oldborder = wa->border_width;
|
||||||
c->display = disp;
|
c->display = disp;
|
||||||
c->screen = awesomeconf->screen;
|
|
||||||
if(c->w == si->width && c->h == si->height)
|
if(c->w == si->width && c->h == si->height)
|
||||||
{
|
{
|
||||||
c->x = 0;
|
c->x = 0;
|
||||||
|
@ -463,7 +462,7 @@ manage(Display *disp, DC *drawcontext, Window w, XWindowAttributes *wa, awesome_
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
resize(Client * c, int x, int y, int w, int h, Bool sizehints)
|
resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf, Bool sizehints)
|
||||||
{
|
{
|
||||||
double dx, dy, max, min, ratio;
|
double dx, dy, max, min, ratio;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
@ -536,7 +535,10 @@ resize(Client * c, int x, int y, int w, int h, Bool sizehints)
|
||||||
configure(c);
|
configure(c);
|
||||||
XSync(c->display, False);
|
XSync(c->display, False);
|
||||||
if(XineramaIsActive(c->display))
|
if(XineramaIsActive(c->display))
|
||||||
|
{
|
||||||
c->screen = get_screen_bycoord(c->display, c->x, c->y);
|
c->screen = get_screen_bycoord(c->display, c->x, c->y);
|
||||||
|
move_client_to_screen(c, &awesomeconf[c->screen - awesomeconf->screen]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,7 +570,7 @@ uicb_moveresize(Display *disp __attribute__ ((unused)),
|
||||||
oh = sel->h;
|
oh = sel->h;
|
||||||
|
|
||||||
Bool xqp = XQueryPointer(sel->display, RootWindow(sel->display, sel->screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
Bool xqp = XQueryPointer(sel->display, RootWindow(sel->display, sel->screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||||
resize(sel, nx, ny, nw, nh, True);
|
resize(sel, nx, ny, nw, nh, awesomeconf, True);
|
||||||
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
|
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
|
||||||
{
|
{
|
||||||
nmx = mx-ox+sel->w-ow-1 < 0 ? 0 : mx-ox+sel->w-ow-1;
|
nmx = mx-ox+sel->w-ow-1 < 0 ? 0 : mx-ox+sel->w-ow-1;
|
||||||
|
|
2
client.h
2
client.h
|
@ -66,7 +66,7 @@ void configure(Client *); /* send synthetic configure event */
|
||||||
void detach(Client *); /* detaches c from global client list */
|
void detach(Client *); /* detaches c from global client list */
|
||||||
void focus(Display *, DC *, Client *, Bool, awesome_config *); /* focus c if visible && !NULL, or focus top visible */
|
void focus(Display *, DC *, Client *, Bool, awesome_config *); /* focus c if visible && !NULL, or focus top visible */
|
||||||
void manage(Display *, DC *, Window, XWindowAttributes *, awesome_config *);
|
void manage(Display *, DC *, Window, XWindowAttributes *, awesome_config *);
|
||||||
void resize(Client *, int, int, int, int, Bool); /* resize with given coordinates c */
|
void resize(Client *, int, int, int, int, awesome_config *, Bool); /* resize with given coordinates c */
|
||||||
void unban(Client *); /* unbans c */
|
void unban(Client *); /* unbans c */
|
||||||
void unmanage(Client *, DC *, long, awesome_config *); /* unmanage c */
|
void unmanage(Client *, DC *, long, awesome_config *); /* unmanage c */
|
||||||
void updatesizehints(Client *); /* update the size hint variables of c */
|
void updatesizehints(Client *); /* update the size hint variables of c */
|
||||||
|
|
4
event.c
4
event.c
|
@ -98,7 +98,7 @@ movemouse(Client * c, awesome_config *awesomeconf)
|
||||||
ny = si->y_org;
|
ny = si->y_org;
|
||||||
else if(abs((si->y_org + si->height) - (ny + c->h + 2 * c->border)) < awesomeconf->snap)
|
else if(abs((si->y_org + si->height) - (ny + c->h + 2 * c->border)) < awesomeconf->snap)
|
||||||
ny = si->y_org + si->height - c->h - 2 * c->border;
|
ny = si->y_org + si->height - c->h - 2 * c->border;
|
||||||
resize(c, nx, ny, c->w, c->h, False);
|
resize(c, nx, ny, c->w, c->h, awesomeconf, False);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ resizemouse(Client * c, awesome_config *awesomeconf)
|
||||||
nw = 1;
|
nw = 1;
|
||||||
if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0)
|
if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0)
|
||||||
nh = 1;
|
nh = 1;
|
||||||
resize(c, c->x, c->y, nw, nh, True);
|
resize(c, c->x, c->y, nw, nh, awesomeconf, True);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
layout.c
4
layout.c
|
@ -208,10 +208,10 @@ maximize(int x, int y, int w, int h, DC *drawcontext, awesome_config *awesomecon
|
||||||
sel->ry = sel->y;
|
sel->ry = sel->y;
|
||||||
sel->rw = sel->w;
|
sel->rw = sel->w;
|
||||||
sel->rh = sel->h;
|
sel->rh = sel->h;
|
||||||
resize(sel, x, y, w, h, True);
|
resize(sel, x, y, w, h, awesomeconf, True);
|
||||||
}
|
}
|
||||||
else if(sel->wasfloating)
|
else if(sel->wasfloating)
|
||||||
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
|
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True);
|
||||||
else
|
else
|
||||||
sel->isfloating = False;
|
sel->isfloating = False;
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,10 @@ layout_floating(Display *disp __attribute__ ((unused)), awesome_config *awesomec
|
||||||
{
|
{
|
||||||
if(c->ftview)
|
if(c->ftview)
|
||||||
{
|
{
|
||||||
resize(c, c->rx, c->ry, c->rw, c->rh, True);
|
resize(c, c->rx, c->ry, c->rw, c->rh, awesomeconf, True);
|
||||||
c->ftview = False;
|
c->ftview = False;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
resize(c, c->x, c->y, c->w, c->h, True);
|
resize(c, c->x, c->y, c->w, c->h, awesomeconf, True);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,6 @@ layout_max(Display *disp, awesome_config *awesomeconf)
|
||||||
if(IS_TILED(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags))
|
if(IS_TILED(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags))
|
||||||
resize(c, si[awesomeconf->screen].x_org, si[awesomeconf->screen].y_org,
|
resize(c, si[awesomeconf->screen].x_org, si[awesomeconf->screen].y_org,
|
||||||
si[awesomeconf->screen].width - 2 * c->border,
|
si[awesomeconf->screen].width - 2 * c->border,
|
||||||
si[awesomeconf->screen].height - 2 * c->border, awesomeconf->resize_hints);
|
si[awesomeconf->screen].height - 2 * c->border, awesomeconf, awesomeconf->resize_hints);
|
||||||
XFree(si);
|
XFree(si);
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ _tile(Display *disp, awesome_config *awesomeconf, const Bool right)
|
||||||
{ /* master */
|
{ /* master */
|
||||||
ny = way + i * mh;
|
ny = way + i * mh;
|
||||||
nx = wax + (right ? 0 : waw - mw);
|
nx = wax + (right ? 0 : waw - mw);
|
||||||
resize(c, nx, ny, mw - 2 * c->border, mh - 2 * c->border, awesomeconf->resize_hints);
|
resize(c, nx, ny, mw - 2 * c->border, mh - 2 * c->border, awesomeconf, awesomeconf->resize_hints);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* tile window */
|
{ /* tile window */
|
||||||
|
@ -157,7 +157,7 @@ _tile(Display *disp, awesome_config *awesomeconf, const Bool right)
|
||||||
ny = way + ((i - awesomeconf->nmaster) % win_by_col) * (nh + 2 * c->border);
|
ny = way + ((i - awesomeconf->nmaster) % win_by_col) * (nh + 2 * c->border);
|
||||||
|
|
||||||
nx = wax + current_col * nw + (right ? mw : 0);
|
nx = wax + current_col * nw + (right ? mw : 0);
|
||||||
resize(c, nx, ny, nw, nh, awesomeconf->resize_hints);
|
resize(c, nx, ny, nw, nh, awesomeconf, awesomeconf->resize_hints);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
13
screen.c
13
screen.c
|
@ -138,6 +138,17 @@ get_screen_count(Display *disp)
|
||||||
return screen_number;
|
return screen_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
move_client_to_screen(Client *c, awesome_config *acf_new)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
c->screen = acf_new->screen;
|
||||||
|
p_realloc(&c->tags, acf_new->ntags);
|
||||||
|
for(i = 0; i < acf_new->ntags; i++)
|
||||||
|
c->tags[i] = acf_new->tags[i].selected;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
move_mouse_pointer_to_screen(Display *disp, int screen)
|
move_mouse_pointer_to_screen(Display *disp, int screen)
|
||||||
{
|
{
|
||||||
|
@ -208,7 +219,7 @@ uicb_movetoscreen(Display *disp,
|
||||||
else
|
else
|
||||||
screen = sel->screen + 1 >= get_screen_count(disp) ? 0 : sel->screen + 1;
|
screen = sel->screen + 1 >= get_screen_count(disp) ? 0 : sel->screen + 1;
|
||||||
|
|
||||||
sel->screen = screen;
|
move_client_to_screen(sel, &awesomeconf[screen - awesomeconf->screen]);
|
||||||
move_mouse_pointer_to_screen(disp, screen);
|
move_mouse_pointer_to_screen(disp, screen);
|
||||||
arrange(disp, drawcontext, awesomeconf);
|
arrange(disp, drawcontext, awesomeconf);
|
||||||
arrange(disp, &drawcontext[screen - awesomeconf->screen], &awesomeconf[screen - awesomeconf->screen]);
|
arrange(disp, &drawcontext[screen - awesomeconf->screen], &awesomeconf[screen - awesomeconf->screen]);
|
||||||
|
|
3
screen.h
3
screen.h
|
@ -22,7 +22,7 @@
|
||||||
#ifndef AWESOME_SCREEN_H
|
#ifndef AWESOME_SCREEN_H
|
||||||
#define AWESOME_SCREEN_H
|
#define AWESOME_SCREEN_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "client.h"
|
||||||
|
|
||||||
#include <X11/extensions/Xinerama.h>
|
#include <X11/extensions/Xinerama.h>
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ ScreenInfo * get_screen_info(Display *, int, Statusbar *, int *);
|
||||||
ScreenInfo * get_display_info(Display *, int, Statusbar *);
|
ScreenInfo * get_display_info(Display *, int, Statusbar *);
|
||||||
int get_screen_bycoord(Display *, int, int);
|
int get_screen_bycoord(Display *, int, int);
|
||||||
int get_screen_count(Display *);
|
int get_screen_count(Display *);
|
||||||
|
void move_client_to_screen(Client *, awesome_config *);
|
||||||
UICB_PROTO(uicb_focusnextscreen);
|
UICB_PROTO(uicb_focusnextscreen);
|
||||||
UICB_PROTO(uicb_focusprevscreen);
|
UICB_PROTO(uicb_focusprevscreen);
|
||||||
UICB_PROTO(uicb_movetoscreen);
|
UICB_PROTO(uicb_movetoscreen);
|
||||||
|
|
2
tag.c
2
tag.c
|
@ -192,7 +192,7 @@ uicb_togglefloating(Display *disp,
|
||||||
sel->isfloating = !sel->isfloating;
|
sel->isfloating = !sel->isfloating;
|
||||||
if(sel->isfloating)
|
if(sel->isfloating)
|
||||||
/*restore last known float dimensions*/
|
/*restore last known float dimensions*/
|
||||||
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
|
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*save last known float dimensions*/
|
/*save last known float dimensions*/
|
||||||
|
|
Loading…
Reference in New Issue