client: Fix default client position

This commit is contained in:
Martin Duquesnoy 2008-10-20 00:45:42 +02:00
parent bc24ac563b
commit ed495b9dff
7 changed files with 43 additions and 45 deletions

View File

@ -33,7 +33,7 @@
#include "wmfs.h"
int
clientpertag(int tag)
client_pertag(int tag)
{
Client *c;
int i = 0;
@ -84,7 +84,7 @@ client_switch(Bool b)
{
client_focus(c);
if(!c->tile)
raiseclient(c);
client_raise(c);
}
}
else
@ -99,7 +99,7 @@ client_switch(Bool b)
{
client_focus(c);
if(!c->tile)
raiseclient(c);
client_raise(c);
}
}
arrange();
@ -149,7 +149,7 @@ client_focus(Client *c)
if(conf.ttbarheight)
XSetWindowBorder(dpy, c->tbar->win, conf.colors.borderfocus);
if(conf.raisefocus)
raiseclient(c);
client_raise(c);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
updatetitlebar(c);
}
@ -164,7 +164,7 @@ client_focus(Client *c)
}
Client*
getclient(Window w)
client_get(Window w)
{
Client *c;
@ -192,9 +192,7 @@ client_hide(Client *c)
XUnmapWindow(dpy, c->win);
if(conf.ttbarheight)
XUnmapWindow(dpy, c->tbar->win);
setwinstate(c->win, IconicState);
c->hide = True;
return;
}
@ -212,7 +210,7 @@ ishide(Client *c)
}
void
uicb_killclient(uicb_t cmd)
uicb_client_kill(uicb_t cmd)
{
XEvent ev;
@ -231,7 +229,7 @@ uicb_killclient(uicb_t cmd)
}
void
mapclient(Client *c)
client_map(Client *c)
{
if(!c)
return;
@ -257,9 +255,9 @@ client_manage(Window w, XWindowAttributes *wa)
c = emalloc(1, sizeof(Client));
c->win = w;
c->geo.x = wa->x;
c->geo.y = wa->y + conf.ttbarheight + barheight;
c->geo.y = wa->y + sgeo.y + conf.ttbarheight; /* Default free placement */
c->geo.width = wa->width;
c->geo.height = wa->height - conf.ttbarheight;
c->geo.height = wa->height;
c->tag = seltag;
c->border = conf.borderheight;
@ -275,6 +273,7 @@ client_manage(Window w, XWindowAttributes *wa)
grabbuttons(c, False);
XSelectInput(dpy, w, EnterWindowMask | FocusChangeMask
| PropertyChangeMask | StructureNotifyMask);
client_size_hints(c);
updatetitlebar(c);
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
@ -284,11 +283,11 @@ client_manage(Window w, XWindowAttributes *wa)
if(!c->free)
c->free = (rettrans == Success) || c->hint;
else
raiseclient(c);
client_raise(c);
client_attach(c);
client_moveresize(c, c->geo, True);
mapclient(c);
XMoveResizeWindow(dpy, c->win, c->geo.x, c->geo.y, c->geo.width, c->geo.height);
client_map(c);
setwinstate(c->win, NormalState);
client_focus(c);
arrange();
@ -441,7 +440,7 @@ client_size_hints(Client *c)
}
void
raiseclient(Client *c)
client_raise(Client *c)
{
if(!c)
return;
@ -462,9 +461,7 @@ client_unhide(Client *c)
XMapWindow(dpy, c->win);
if(conf.ttbarheight)
XMapWindow(dpy, c->tbar->win);
setwinstate(c->win, NormalState);
c->hide = False;
return;
}
@ -493,7 +490,7 @@ client_unmanage(Client *c)
}
void
unmapclient(Client *c)
client_unmap(Client *c)
{
if(!c)
return;

View File

@ -37,7 +37,7 @@
func_name_list_t func_list[] =
{
{"spawn", uicb_spawn },
{"killclient", uicb_killclient },
{"killclient", uicb_client_kill },
{"client_prev", uicb_client_prev },
{"client_next", uicb_client_next },
{"togglemax", uicb_togglemax },
@ -165,7 +165,7 @@ init_conf(void)
static cfg_opt_t misc_opts[] =
{
CFG_STR("font", "sans-9", CFGF_NONE),
CFG_STR("font", "sans-9", CFGF_NONE),
CFG_STR("bar_position", "top", CFGF_NONE),
CFG_BOOL("raisefocus", cfg_false, CFGF_NONE),
CFG_BOOL("raiseswitch", cfg_true, CFGF_NONE),

View File

@ -68,8 +68,8 @@ draw_taglist(Drawable dr)
for(i = 0; i < conf.ntag; ++i)
{
/* Make the tags string */
ITOA(p, clientpertag(i+1));
sprintf(buf[i], "%s<%s>", tags[i+1].name, (clientpertag(i+1)) ? p : "");
ITOA(p, client_pertag(i+1));
sprintf(buf[i], "%s<%s>", tags[i+1].name, (client_pertag(i+1)) ? p : "");
/* Draw the string */
draw_text(dr, taglen[i], fonth,

View File

@ -51,7 +51,7 @@ buttonpress(XEvent ev)
{
if((c = client_gettbar(ev.xbutton.window)))
{
raiseclient(c);
client_raise(c);
/* BUTTON 1 */
{
if(ev.xbutton.button == Button1)
@ -82,9 +82,9 @@ buttonpress(XEvent ev)
/* CLIENT */
/* ****** */
{
if((c = getclient(ev.xbutton.window)))
if((c = client_get(ev.xbutton.window)))
{
raiseclient(c);
client_raise(c);
/* BUTTON 1 */
{
if(ev.xbutton.button == Button1)
@ -227,7 +227,7 @@ configurerequest(XEvent ev)
Client *c;
XWindowChanges wc;
XRectangle geo;
if((c = getclient(ev.xconfigurerequest.window)))
if((c = client_get(ev.xconfigurerequest.window)))
if(c->tile || c->lmax)
return;
geo.x = wc.x = ev.xconfigurerequest.x;
@ -239,7 +239,7 @@ configurerequest(XEvent ev)
wc.stack_mode = ev.xconfigurerequest.detail;
XConfigureWindow(dpy, ev.xconfigurerequest.window,
ev.xconfigurerequest.value_mask, &wc);
if((c = getclient(ev.xconfigurerequest.window)))
if((c = client_get(ev.xconfigurerequest.window)))
if(wc.y < mw && wc.x < mh)
client_moveresize(c, geo, True);
@ -253,7 +253,7 @@ destroynotify(XEvent ev)
{
Client *c;
if((c = getclient(ev.xdestroywindow.window)))
if((c = client_get(ev.xdestroywindow.window)))
client_unmanage(c);
return;
@ -268,7 +268,7 @@ enternotify(XEvent ev)
if(ev.xcrossing.mode != NotifyNormal
|| ev.xcrossing.detail == NotifyInferior)
return;
if((c = getclient(ev.xcrossing.window))
if((c = client_get(ev.xcrossing.window))
|| (c = client_gettbar(ev.xcrossing.window)))
client_focus(c);
else
@ -385,7 +385,7 @@ maprequest(XEvent ev)
return;
if(at.override_redirect)
return;
if(!getclient(ev.xmaprequest.window))
if(!client_get(ev.xmaprequest.window))
{
client_focus(NULL);
client_manage(ev.xmaprequest.window, &at);
@ -462,14 +462,14 @@ propertynotify(XEvent ev)
if(event.xproperty.state == PropertyDelete)
return;
if((c = getclient(event.xproperty.window)))
if((c = client_get(event.xproperty.window)))
{
switch(event.xproperty.atom)
{
default: break;
case XA_WM_TRANSIENT_FOR:
XGetTransientForHint(dpy, c->win, &trans);
if((c->tile || c->max) && (c->hint = (getclient(trans) != NULL)))
if((c->tile || c->max) && (c->hint = (client_get(trans) != NULL)))
arrange();
break;
case XA_WM_NORMAL_HINTS:
@ -490,9 +490,9 @@ unmapnotify(XEvent ev)
{
Client *c;
if((c = getclient(ev.xunmap.window)))
if(!c->hide && ev.xunmap.send_event
&& getwinstate(c->win) == NormalState)
if((c = client_get(ev.xunmap.window)))
if(ev.xunmap.send_event
&& getwinstate(c->win) == NormalState)
client_unmanage(c);
return;
@ -514,7 +514,7 @@ getevent(void)
case MapRequest: maprequest(event); break;
case MappingNotify: mapnotify(event); break;
case PropertyNotify: propertynotify(event); break;
case UnmapNotify: unmapnotify(event); break;
// case UnmapNotify: unmapnotify(event); break;
}
return;

View File

@ -67,7 +67,8 @@ freelayout(void)
{
if(c->tile || c->lmax)
{
geo.x = c->ogeo.x; geo.y = c->ogeo.y;
geo.x = c->ogeo.x;
geo.y = c->ogeo.y;
geo.width = c->ogeo.width;
geo.height = c->ogeo.height;
client_moveresize(c, geo, True);
@ -299,7 +300,7 @@ uicb_togglemax(uicb_t cmd)
geo.height = sgeo.height - (conf.borderheight * 2);
client_moveresize(sel, geo, False);
raiseclient(sel);
client_raise(sel);
sel->max = True;
}
else if(sel->max)

View File

@ -87,7 +87,7 @@ struct Client
int border;
/* Client Layout Information */
Bool max, tile, free;
Bool hint, hide, lmax;
Bool hint, lmax;
/* Struct in chains */
Client *next;
Client *prev;

View File

@ -82,26 +82,26 @@ void draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color);
ushort textw(const char *text);
/* client.c */
int clientpertag(int tag);
int client_pertag(int tag);
void client_attach(Client *c);
void client_detach(Client *c);
void client_switch(Bool c);
void client_focus(Client *c);
Client *getclient(Window w);
Client *client_get(Window w);
Client *client_gettbar(Window w);
void client_hide(Client *c);
Bool ishide(Client *c);
void mapclient(Client *c);
void client_map(Client *c);
void client_manage(Window w, XWindowAttributes *wa);
void client_moveresize(Client *c, XRectangle geo, bool r);
void client_size_hints(Client *c);
void raiseclient(Client *c);
void client_raise(Client *c);
void client_unhide(Client *c);
void client_unmanage(Client *c);
void unmapclient(Client *c);
void client_unmap(Client *c);
void uicb_client_prev(uicb_t);
void uicb_client_next(uicb_t);
void uicb_killclient(uicb_t);
void uicb_client_kill(uicb_t);
/* config.c */
void init_conf(void);