Client/Layout: Add abovefc option and toggle uicb fonction. Requested by Arpinux.

This commit is contained in:
Martin Duquesnoy 2009-12-25 21:25:20 +01:00
parent f916b8e0cb
commit 5d0b922907
7 changed files with 73 additions and 10 deletions

View File

@ -51,7 +51,7 @@ set(wmfs_src
add_executable(wmfs ${wmfs_src})
# Set the version
set(VERSION "WMFS-200911")
set(VERSION "WMFS-200912")
# FLAGS
set(CFLAGS "-g -Wall -ansi")

View File

@ -193,6 +193,33 @@ uicb_client_swap_prev(uicb_t cmd)
return;
}
/** Set the client c above
*\param c Client pointer
*/
void
client_above(Client *c)
{
XRectangle geo = { 0 };
if(c->flags & AboveFlag)
return;
c->flags |= AboveFlag;
geo.height = sgeo[c->screen].height * 0.75;
geo.width = sgeo[c->screen].width * 0.75;
geo.x = (sgeo[c->screen].height - geo.height) / 2;
geo.y = (sgeo[c->screen].width - geo.width) / 2;
client_moveresize(c, geo, True);
client_raise(c);
tags[c->screen][c->tag].layout.func(c->screen);
return;
}
/** Set the focus to a client
* \param c Client pointer
*/
@ -207,15 +234,18 @@ client_focus(Client *c)
sel->colors.frame = conf.client.bordernormal;
sel->colors.fg = conf.titlebar.fg_normal;
sel->colors.resizecorner = conf.client.resizecorner_normal;
if(TBARH - BORDH && sel->titlebar->stipple)
sel->titlebar->stipple_color = conf.titlebar.stipple.colors.normal;
if(sel->flags & AboveFlag)
sel->flags &= ~AboveFlag;
frame_update(sel);
mouse_grabbuttons(sel, False);
}
sel = c;
if(c)
if((sel = c))
{
c->colors.frame = conf.client.borderfocus;
c->colors.fg = conf.titlebar.fg_focus;
@ -235,6 +265,10 @@ client_focus(Client *c)
client_raise(c);
}
if(tags[sel->screen][sel->tag].abovefc
&& !conf.focus_fmouse)
client_above(sel);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
}
else
@ -842,7 +876,7 @@ client_update_attributes(Client *c)
void
client_raise(Client *c)
{
if(!c || (c->flags & TileFlag))
if(!c || ((c->flags & TileFlag) && !(c->flags & AboveFlag)))
return;
XRaiseWindow(dpy, c->frame);
@ -883,6 +917,8 @@ void
client_unmanage(Client *c)
{
Client *c_next = NULL;
Bool b = False;
int i;
XGrabServer(dpy);
XSetErrorHandler(errorhandlerdummy);
@ -900,7 +936,11 @@ client_unmanage(Client *c)
ewmh_get_client_list();
/* Arrange */
if(c->tag == seltag[selscreen] && c->screen == selscreen)
for(i = 0; i < screen_count() && !b; ++i)
if(c->tag == seltag[i])
b = True;
if(b)
tags[c->screen][c->tag].layout.func(c->screen);
else
{

View File

@ -63,6 +63,7 @@ func_name_list_t tmp_func_list[] =
{"mouse_resize", uicb_mouse_resize },
{"client_raise", uicb_client_raise },
{"toggle_free", uicb_togglefree },
{"toggle_abovefc", uicb_toggle_abovefc },
{"screen_select", uicb_screen_select },
{"screen_next", uicb_screen_next },
{"screen_prev", uicb_screen_prev },
@ -369,7 +370,7 @@ conf_tag_section(char *src)
* MAXTAG (32) print an error and create only one.
*/
Tag default_tag = { "WMFS", NULL, 0, 1,
0.50, 1, False, False, IB_Top,
0.50, 1, False, False, False, IB_Top,
layout_name_to_struct(conf.layout, "tile_right", conf.nlayout, layout_list) };
cfg_set_sauv(src);
@ -413,6 +414,7 @@ conf_tag_section(char *src)
tags[k][conf.ntag[k]].mwfact = get_opt(cfgtmp, "0.65", "mwfact").fnum;
tags[k][conf.ntag[k]].nmaster = get_opt(cfgtmp, "1", "nmaster").num;
tags[k][conf.ntag[k]].resizehint = get_opt(cfgtmp, "false", "resizehint").bool;
tags[k][conf.ntag[k]].abovefc = get_opt(cfgtmp, "false", "abovefc").bool;
tags[k][conf.ntag[k]].layers = 1;
tmp = _strdup(get_opt(cfgtmp, "top", "infobar_position").str);

View File

@ -317,14 +317,15 @@ enternotify(XCrossingEvent *ev)
if(conf.focus_fmouse)
{
if((c = client_gb_win(ev->window))
|| (c = client_gb_frame(ev->window))
|| (c = client_gb_titlebar(ev->window))
|| (c = client_gb_button(ev->window, &n)))
|| (c = client_gb_frame(ev->window))
|| (c = client_gb_titlebar(ev->window))
|| (c = client_gb_button(ev->window, &n)))
client_focus(c);
else
client_focus(NULL);
}
return;
}

View File

@ -168,6 +168,7 @@ tiled_client(int screen, Client *c)
for(;c && ((c->flags & MaxFlag)
|| (c->flags & FreeFlag)
|| (c->flags & FSSFlag)
|| (c->flags & AboveFlag)
|| c->screen != screen
|| ishide(c, screen)); c = c->next);
@ -830,6 +831,21 @@ uicb_toggle_resizehint(uicb_t cmd)
return;
}
/** Toggle abovefc option
*\param cmd uicb_t type
*/
void
uicb_toggle_abovefc(uicb_t cmd)
{
screen_get_sel();
tags[selscreen][seltag[selscreen]].abovefc = !tags[selscreen][seltag[selscreen]].abovefc;
client_focus(sel);
return;
}
/** Set the layout
* \param cmd uicb_t type
*/

View File

@ -48,6 +48,7 @@
#define UnmapFlag (1 << 6)
#define HintFlag (1 << 7)
#define FSSFlag (1 << 8)
#define AboveFlag (1 << 9)
/* XEMBED messages */
#define XEMBED_MAPPED (1 << 0)
@ -248,6 +249,7 @@ typedef struct
int nmaster;
Bool resizehint;
Bool request_update;
Bool abovefc;
int barpos;
Layout layout;
} Tag;

View File

@ -141,6 +141,7 @@ void uicb_infobar_togglepos(uicb_t);
void client_attach(Client *c);
void client_configure(Client *c);
void client_detach(Client *c);
void client_above(Client *c);
void client_focus(Client *c);
Client* client_get_next(void);
Client* client_get_prev(void);
@ -302,6 +303,7 @@ void uicb_set_mwfact(uicb_t);
void uicb_set_nmaster(uicb_t);
void uicb_set_layout(uicb_t);
void uicb_toggle_resizehint(uicb_t);
void uicb_toggle_abovefc(uicb_t cmd);
void uicb_set_layer(uicb_t cmd);
void uicb_set_client_layer(uicb_t cmd);
void layout_set_client_master(Client *c);