Remove disp arg to manage(), add comments to manage() and rename setclienttrans to window_settrans
This commit is contained in:
parent
dfcfa92994
commit
f379de70ce
|
@ -152,7 +152,7 @@ scan(awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
if(screen == 0)
|
if(screen == 0)
|
||||||
real_screen = get_screen_bycoord(awesomeconf->display, wa.x, wa.y);
|
real_screen = get_screen_bycoord(awesomeconf->display, wa.x, wa.y);
|
||||||
manage(awesomeconf->display, wins[i], &wa, &awesomeconf[real_screen]);
|
manage(wins[i], &wa, &awesomeconf[real_screen]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* now the transients */
|
/* now the transients */
|
||||||
|
@ -165,7 +165,7 @@ scan(awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
if(screen == 0)
|
if(screen == 0)
|
||||||
real_screen = get_screen_bycoord(awesomeconf->display, wa.x, wa.y);
|
real_screen = get_screen_bycoord(awesomeconf->display, wa.x, wa.y);
|
||||||
manage(awesomeconf->display, wins[i], &wa, &awesomeconf[real_screen]);
|
manage(wins[i], &wa, &awesomeconf[real_screen]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
104
client.c
104
client.c
|
@ -178,21 +178,21 @@ window_setstate(Display *disp, Window win, long state)
|
||||||
* \param opacity opacity percentage
|
* \param opacity opacity percentage
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
setclienttrans(Client *c, double opacity)
|
window_settrans(Display *disp, Window win, double opacity)
|
||||||
{
|
{
|
||||||
unsigned int real_opacity = 0xffffffff;
|
unsigned int real_opacity = 0xffffffff;
|
||||||
|
|
||||||
if(opacity >= 0 && opacity <= 100)
|
if(opacity >= 0 && opacity <= 100)
|
||||||
{
|
{
|
||||||
real_opacity = ((opacity / 100.0) * 0xffffffff);
|
real_opacity = ((opacity / 100.0) * 0xffffffff);
|
||||||
XChangeProperty(c->display, c->win,
|
XChangeProperty(disp, win,
|
||||||
XInternAtom(c->display, "_NET_WM_WINDOW_OPACITY", False),
|
XInternAtom(disp, "_NET_WM_WINDOW_OPACITY", False),
|
||||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &real_opacity, 1L);
|
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &real_opacity, 1L);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
XDeleteProperty(c->display, c->win, XInternAtom(c->display, "_NET_WM_WINDOW_OPACITY", False));
|
XDeleteProperty(disp, win, XInternAtom(disp, "_NET_WM_WINDOW_OPACITY", False));
|
||||||
|
|
||||||
XSync(c->display, False);
|
XSync(disp, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Swap two client in the linked list clients
|
/** Swap two client in the linked list clients
|
||||||
|
@ -319,7 +319,6 @@ client_detach(Client **head, Client *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Give focus to client, or to first client if c is NULL
|
/** Give focus to client, or to first client if c is NULL
|
||||||
* \param disp Display ref
|
|
||||||
* \param c client
|
* \param c client
|
||||||
* \param selscreen True if current screen is selected
|
* \param selscreen True if current screen is selected
|
||||||
* \param awesomeconf awesome config
|
* \param awesomeconf awesome config
|
||||||
|
@ -336,7 +335,7 @@ focus(Client *c, Bool selscreen, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
grabbuttons(*awesomeconf->client_sel, False, True, awesomeconf->modkey, awesomeconf->numlockmask);
|
grabbuttons(*awesomeconf->client_sel, False, True, awesomeconf->modkey, awesomeconf->numlockmask);
|
||||||
XSetWindowBorder(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->colors_normal[ColBorder].pixel);
|
XSetWindowBorder(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->colors_normal[ColBorder].pixel);
|
||||||
setclienttrans(*awesomeconf->client_sel, awesomeconf->opacity_unfocused);
|
window_settrans(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->opacity_unfocused);
|
||||||
}
|
}
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
|
@ -358,8 +357,8 @@ focus(Client *c, Bool selscreen, awesome_config *awesomeconf)
|
||||||
XSetInputFocus(awesomeconf->display, (*awesomeconf->client_sel)->win, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(awesomeconf->display, (*awesomeconf->client_sel)->win, RevertToPointerRoot, CurrentTime);
|
||||||
for(c = *awesomeconf->clients; c; c = c->next)
|
for(c = *awesomeconf->clients; c; c = c->next)
|
||||||
if(c != *awesomeconf->client_sel)
|
if(c != *awesomeconf->client_sel)
|
||||||
setclienttrans(c, awesomeconf->opacity_unfocused);
|
window_settrans(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->opacity_unfocused);
|
||||||
setclienttrans(*awesomeconf->client_sel, -1);
|
window_settrans(awesomeconf->display, (*awesomeconf->client_sel)->win, -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
XSetInputFocus(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), RevertToPointerRoot, CurrentTime);
|
||||||
|
@ -373,7 +372,7 @@ focus(Client *c, Bool selscreen, awesome_config *awesomeconf)
|
||||||
* \param ntags tags number
|
* \param ntags tags number
|
||||||
*/
|
*/
|
||||||
static Bool
|
static Bool
|
||||||
loadprops(Client * c, int ntags)
|
loadprops(Client *c, int ntags)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *prop;
|
char *prop;
|
||||||
|
@ -396,78 +395,115 @@ loadprops(Client * c, int ntags)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Manage a new client
|
/** Manage a new client
|
||||||
* \param disp Display ref
|
|
||||||
* \param w The window
|
* \param w The window
|
||||||
* \param wa Window attributes
|
* \param wa Window attributes
|
||||||
* \param awesomeconf awesome config
|
* \param awesomeconf awesome config
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
manage(Display *disp, Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Client *c, *t = NULL;
|
Client *c, *t = NULL;
|
||||||
Window trans;
|
Window trans;
|
||||||
Status rettrans;
|
Status rettrans;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
ScreenInfo *si = get_display_info(disp, awesomeconf->phys_screen, &awesomeconf->statusbar);
|
ScreenInfo *screen_info = get_screen_info(awesomeconf->display, awesomeconf->screen, NULL);
|
||||||
ScreenInfo *screen_info;
|
|
||||||
|
|
||||||
c = p_new(Client, 1);
|
c = p_new(Client, 1);
|
||||||
|
|
||||||
c->win = w;
|
c->win = w;
|
||||||
c->x = c->rw = wa->x;
|
c->x = c->rw = wa->x;
|
||||||
c->y = c->ry = wa->y;
|
c->y = c->ry = wa->y;
|
||||||
c->w = c->rw = wa->width;
|
c->w = c->rw = wa->width;
|
||||||
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->phys_screen = get_phys_screen(c->display, c->screen);
|
c->display = awesomeconf->display;
|
||||||
|
c->phys_screen = awesomeconf->phys_screen;
|
||||||
|
|
||||||
c->tab.isvisible = True;
|
c->tab.isvisible = True;
|
||||||
screen_info = get_screen_info(c->display, c->screen, NULL);
|
|
||||||
|
/* if window request fullscreen mode */
|
||||||
if(c->w == screen_info[c->screen].width && c->h == screen_info[c->screen].height)
|
if(c->w == screen_info[c->screen].width && c->h == screen_info[c->screen].height)
|
||||||
{
|
{
|
||||||
c->x = 0;
|
c->x = 0;
|
||||||
c->y = 0;
|
c->y = 0;
|
||||||
|
|
||||||
c->border = wa->border_width;
|
c->border = wa->border_width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(c->x + c->w + 2 * c->border > si->x_org + si->width)
|
ScreenInfo *display_info = get_display_info(c->display, c->phys_screen, &awesomeconf->statusbar);
|
||||||
c->x = c->rx = si->x_org + si->width - c->w - 2 * c->border;
|
|
||||||
if(c->y + c->h + 2 * c->border > si->y_org + si->height)
|
if(c->x + c->w + 2 * c->border > display_info->x_org + display_info->width)
|
||||||
c->y = c->ry = si->y_org + si->height - c->h - 2 * c->border;
|
c->x = c->rx = display_info->x_org + display_info->width - c->w - 2 * c->border;
|
||||||
if(c->x < si->x_org)
|
if(c->y + c->h + 2 * c->border > display_info->y_org + display_info->height)
|
||||||
c->x = c->rx = si->x_org;
|
c->y = c->ry = display_info->y_org + display_info->height - c->h - 2 * c->border;
|
||||||
if(c->y < si->y_org)
|
if(c->x < display_info->x_org)
|
||||||
c->y = c->ry = si->y_org;
|
c->x = c->rx = display_info->x_org;
|
||||||
|
if(c->y < display_info->y_org)
|
||||||
|
c->y = c->ry = display_info->y_org;
|
||||||
|
|
||||||
c->border = awesomeconf->borderpx;
|
c->border = awesomeconf->borderpx;
|
||||||
|
|
||||||
|
p_delete(&display_info);
|
||||||
}
|
}
|
||||||
p_delete(&si);
|
p_delete(&screen_info);
|
||||||
|
|
||||||
|
/* set borders */
|
||||||
wc.border_width = c->border;
|
wc.border_width = c->border;
|
||||||
XConfigureWindow(disp, w, CWBorderWidth, &wc);
|
XConfigureWindow(c->display, w, CWBorderWidth, &wc);
|
||||||
XSetWindowBorder(disp, w, awesomeconf->colors_normal[ColBorder].pixel);
|
XSetWindowBorder(c->display, w, awesomeconf->colors_normal[ColBorder].pixel);
|
||||||
|
|
||||||
/* propagates border_width, if size doesn't change */
|
/* propagates border_width, if size doesn't change */
|
||||||
window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);
|
window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);
|
||||||
|
|
||||||
|
/* update sizehint */
|
||||||
updatesizehints(c);
|
updatesizehints(c);
|
||||||
XSelectInput(disp, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
|
||||||
|
XSelectInput(c->display, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
||||||
|
|
||||||
|
/* handle xshape */
|
||||||
if(awesomeconf->have_shape)
|
if(awesomeconf->have_shape)
|
||||||
{
|
{
|
||||||
XShapeSelectInput(disp, w, ShapeNotifyMask);
|
XShapeSelectInput(c->display, w, ShapeNotifyMask);
|
||||||
set_shape(c);
|
set_shape(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* grab buttons */
|
||||||
|
|
||||||
grabbuttons(c, False, True, awesomeconf->modkey, awesomeconf->numlockmask);
|
grabbuttons(c, False, True, awesomeconf->modkey, awesomeconf->numlockmask);
|
||||||
|
|
||||||
|
/* update window title */
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
|
|
||||||
|
/* move client to screen: this will set screen and create tags array */
|
||||||
move_client_to_screen(c, awesomeconf, False);
|
move_client_to_screen(c, awesomeconf, False);
|
||||||
if((rettrans = XGetTransientForHint(disp, w, &trans) == Success)
|
|
||||||
|
/* check for transient and set tags like its parent */
|
||||||
|
if((rettrans = XGetTransientForHint(c->display, w, &trans) == Success)
|
||||||
&& (t = get_client_bywin(*awesomeconf->clients, trans)))
|
&& (t = get_client_bywin(*awesomeconf->clients, trans)))
|
||||||
for(i = 0; i < awesomeconf->ntags; i++)
|
for(i = 0; i < awesomeconf->ntags; i++)
|
||||||
c->tags[i] = t->tags[i];
|
c->tags[i] = t->tags[i];
|
||||||
|
|
||||||
|
/* loadprops or apply rules if no props */
|
||||||
if(!loadprops(c, awesomeconf->ntags))
|
if(!loadprops(c, awesomeconf->ntags))
|
||||||
applyrules(c, awesomeconf);
|
applyrules(c, awesomeconf);
|
||||||
|
|
||||||
|
/* should be floating if transsient or fixed) */
|
||||||
if(!c->isfloating)
|
if(!c->isfloating)
|
||||||
c->isfloating = (rettrans == Success) || c->isfixed;
|
c->isfloating = (rettrans == Success) || c->isfixed;
|
||||||
|
|
||||||
|
/* save new props */
|
||||||
saveprops(c, awesomeconf->ntags);
|
saveprops(c, awesomeconf->ntags);
|
||||||
|
|
||||||
|
/* attach to the stack */
|
||||||
client_attach(awesomeconf->clients, c);
|
client_attach(awesomeconf->clients, c);
|
||||||
XMoveResizeWindow(disp, c->win, c->x, c->y, c->w, c->h); /* some windows require this */
|
|
||||||
|
/* some windows require this */
|
||||||
|
XMoveResizeWindow(c->display, c->win, c->x, c->y, c->w, c->h);
|
||||||
|
|
||||||
|
/* rearrange to display new window */
|
||||||
arrange(awesomeconf);
|
arrange(awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,9 +760,9 @@ uicb_settrans(awesome_config *awesomeconf __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
|
|
||||||
if(delta == 100.0 && !set_prop)
|
if(delta == 100.0 && !set_prop)
|
||||||
setclienttrans(*awesomeconf->client_sel, -1);
|
window_settrans((*awesomeconf->client_sel)->display, (*awesomeconf->client_sel)->win, -1);
|
||||||
else
|
else
|
||||||
setclienttrans(*awesomeconf->client_sel, delta);
|
window_settrans((*awesomeconf->client_sel)->display, (*awesomeconf->client_sel)->win, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
2
client.h
2
client.h
|
@ -35,7 +35,7 @@ void client_reattach_after(Client *, Client *);
|
||||||
void ban(Client *); /* bans c */
|
void ban(Client *); /* bans c */
|
||||||
void window_configure(Display *, Window, int, int, int, int, int);
|
void window_configure(Display *, Window, int, int, int, int, int);
|
||||||
void focus(Client *, Bool, awesome_config *);
|
void focus(Client *, Bool, awesome_config *);
|
||||||
void manage(Display *, Window, XWindowAttributes *, awesome_config *);
|
void manage(Window, XWindowAttributes *, awesome_config *);
|
||||||
void resize(Client *, int, int, int, int, awesome_config *, 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 *, long, awesome_config *); /* unmanage c */
|
void unmanage(Client *, long, awesome_config *); /* unmanage c */
|
||||||
|
|
2
event.c
2
event.c
|
@ -459,7 +459,7 @@ handle_event_maprequest(XEvent * e, awesome_config *awesomeconf)
|
||||||
screen = get_screen_bycoord(e->xany.display, x, y);
|
screen = get_screen_bycoord(e->xany.display, x, y);
|
||||||
|
|
||||||
}
|
}
|
||||||
manage(e->xany.display, ev->window, &wa, &awesomeconf[screen]);
|
manage(ev->window, &wa, &awesomeconf[screen]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue