use LayoutArrange and Uicb type into config.h ; move some functions from layout.c to client.c
This commit is contained in:
parent
d4758481dc
commit
f467fed598
102
client.c
102
client.c
|
@ -850,4 +850,106 @@ uicb_client_kill(int screen __attribute__ ((unused)), char *arg __attribute__ ((
|
|||
if(sel)
|
||||
client_kill(sel);
|
||||
}
|
||||
|
||||
void
|
||||
client_maximize(Client *c, int x, int y, int w, int h)
|
||||
{
|
||||
if((c->ismax = !c->ismax))
|
||||
{
|
||||
c->oldborder = c->border;
|
||||
c->border = 0;
|
||||
c->wasfloating = c->isfloating;
|
||||
c->isfloating = True;
|
||||
client_resize(c, x, y, w, h, False, True);
|
||||
}
|
||||
else if(c->wasfloating)
|
||||
client_resize(c, c->rx, c->ry, c->rw, c->rh, True, False);
|
||||
else
|
||||
c->isfloating = False;
|
||||
|
||||
c->border = c->oldborder;
|
||||
|
||||
arrange(c->screen);
|
||||
}
|
||||
|
||||
/** Toggle maximize for client
|
||||
* \param screen Screen ID
|
||||
* \param arg Unused
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_togglemax(int screen, char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = globalconf.focus->client;
|
||||
Area area = get_screen_area(screen,
|
||||
globalconf.screens[screen].statusbar,
|
||||
&globalconf.screens[screen].padding);
|
||||
if(sel)
|
||||
client_maximize(sel, area.x, area.y,
|
||||
area.width - 2 * globalconf.screens[screen].borderpx,
|
||||
area.height - 2 * globalconf.screens[screen].borderpx);
|
||||
}
|
||||
|
||||
/** Toggle vertical maximize for client
|
||||
* \param screen Screen ID
|
||||
* \param arg Unused
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_toggleverticalmax(int screen, char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = globalconf.focus->client;
|
||||
Area area = get_screen_area(screen,
|
||||
globalconf.screens[screen].statusbar,
|
||||
&globalconf.screens[screen].padding);
|
||||
|
||||
if(sel)
|
||||
client_maximize(sel, sel->x, area.y,
|
||||
sel->w,
|
||||
area.height - 2 * globalconf.screens[screen].borderpx);
|
||||
}
|
||||
|
||||
|
||||
/** Toggle horizontal maximize for client
|
||||
* \param screen Screen ID
|
||||
* \param arg Unused
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_togglehorizontalmax(int screen, char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = globalconf.focus->client;
|
||||
Area area = get_screen_area(screen,
|
||||
globalconf.screens[screen].statusbar,
|
||||
&globalconf.screens[screen].padding);
|
||||
|
||||
if(sel)
|
||||
client_maximize(sel, area.x, sel->y,
|
||||
area.height - 2 * globalconf.screens[screen].borderpx,
|
||||
sel->h);
|
||||
}
|
||||
|
||||
/** Zoom client
|
||||
* \param screen Screen ID
|
||||
* \param arg Unused
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_zoom(int screen, char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(globalconf.clients == sel)
|
||||
for(sel = sel->next; sel && !client_isvisible(sel, screen); sel = sel->next);
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
client_detach(sel);
|
||||
client_attach(sel);
|
||||
|
||||
focus(sel, True, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
5
client.h
5
client.h
|
@ -41,6 +41,7 @@ void client_updatesizehints(Client *);
|
|||
void client_updatetitle(Client *);
|
||||
void client_saveprops(Client *);
|
||||
void client_kill(Client *);
|
||||
void client_maximize(Client *c, int, int, int, int);
|
||||
|
||||
Uicb uicb_client_kill;
|
||||
Uicb uicb_client_moveresize;
|
||||
|
@ -48,6 +49,10 @@ Uicb uicb_client_settrans;
|
|||
Uicb uicb_setborder;
|
||||
Uicb uicb_client_swapnext;
|
||||
Uicb uicb_client_swapprev;
|
||||
Uicb uicb_client_togglemax;
|
||||
Uicb uicb_client_toggleverticalmax;
|
||||
Uicb uicb_client_togglehorizontalmax;
|
||||
Uicb uicb_client_zoom;
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
8
config.h
8
config.h
|
@ -26,6 +26,8 @@
|
|||
#include <X11/Xft/Xft.h>
|
||||
#include <regex.h>
|
||||
#include "draw.h"
|
||||
#include "uicb.h"
|
||||
#include "layout.h"
|
||||
|
||||
/** Bar possible position */
|
||||
enum
|
||||
|
@ -57,7 +59,7 @@ typedef struct Layout Layout;
|
|||
struct Layout
|
||||
{
|
||||
char *image;
|
||||
void (*arrange) (int);
|
||||
LayoutArrange *arrange;
|
||||
Layout *next;
|
||||
};
|
||||
|
||||
|
@ -66,7 +68,7 @@ struct Key
|
|||
{
|
||||
unsigned long mod;
|
||||
KeySym keysym;
|
||||
void (*func) (int, char *);
|
||||
Uicb *func;
|
||||
char *arg;
|
||||
Key *next;
|
||||
};
|
||||
|
@ -76,7 +78,7 @@ struct Button
|
|||
{
|
||||
unsigned long mod;
|
||||
unsigned int button;
|
||||
void (*func) (int, char *);
|
||||
Uicb *func;
|
||||
char *arg;
|
||||
Button *next;
|
||||
};
|
||||
|
|
1
draw.c
1
draw.c
|
@ -23,6 +23,7 @@
|
|||
#include <cairo-ft.h>
|
||||
#include <cairo-xlib.h>
|
||||
#include <math.h>
|
||||
#include "config.h"
|
||||
#include "layout.h"
|
||||
#include "util.h"
|
||||
#include "draw.h"
|
||||
|
|
101
layout.c
101
layout.c
|
@ -248,105 +248,4 @@ uicb_tag_setlayout(int screen, char *arg)
|
|||
saveawesomeprops(screen);
|
||||
}
|
||||
|
||||
void
|
||||
client_maximize(Client *c, int x, int y, int w, int h)
|
||||
{
|
||||
if((c->ismax = !c->ismax))
|
||||
{
|
||||
c->oldborder = c->border;
|
||||
c->border = 0;
|
||||
c->wasfloating = c->isfloating;
|
||||
c->isfloating = True;
|
||||
client_resize(c, x, y, w, h, False, True);
|
||||
}
|
||||
else if(c->wasfloating)
|
||||
client_resize(c, c->rx, c->ry, c->rw, c->rh, True, False);
|
||||
else
|
||||
c->isfloating = False;
|
||||
|
||||
c->border = c->oldborder;
|
||||
|
||||
arrange(c->screen);
|
||||
}
|
||||
|
||||
/** Toggle maximize for client
|
||||
* \param screen Screen ID
|
||||
* \param arg Unused
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_togglemax(int screen, char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = globalconf.focus->client;
|
||||
Area area = get_screen_area(screen,
|
||||
globalconf.screens[screen].statusbar,
|
||||
&globalconf.screens[screen].padding);
|
||||
if(sel)
|
||||
client_maximize(sel, area.x, area.y,
|
||||
area.width - 2 * globalconf.screens[screen].borderpx,
|
||||
area.height - 2 * globalconf.screens[screen].borderpx);
|
||||
}
|
||||
|
||||
/** Toggle vertical maximize for client
|
||||
* \param screen Screen ID
|
||||
* \param arg Unused
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_toggleverticalmax(int screen, char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = globalconf.focus->client;
|
||||
Area area = get_screen_area(screen,
|
||||
globalconf.screens[screen].statusbar,
|
||||
&globalconf.screens[screen].padding);
|
||||
|
||||
if(sel)
|
||||
client_maximize(sel, sel->x, area.y,
|
||||
sel->w,
|
||||
area.height - 2 * globalconf.screens[screen].borderpx);
|
||||
}
|
||||
|
||||
|
||||
/** Toggle horizontal maximize for client
|
||||
* \param screen Screen ID
|
||||
* \param arg Unused
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_togglehorizontalmax(int screen, char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = globalconf.focus->client;
|
||||
Area area = get_screen_area(screen,
|
||||
globalconf.screens[screen].statusbar,
|
||||
&globalconf.screens[screen].padding);
|
||||
|
||||
if(sel)
|
||||
client_maximize(sel, area.x, sel->y,
|
||||
area.height - 2 * globalconf.screens[screen].borderpx,
|
||||
sel->h);
|
||||
}
|
||||
|
||||
/** Zoom client
|
||||
* \param screen Screen ID
|
||||
* \param arg Unused
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_zoom(int screen, char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(globalconf.clients == sel)
|
||||
for(sel = sel->next; sel && !client_isvisible(sel, screen); sel = sel->next);
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
client_detach(sel);
|
||||
client_attach(sel);
|
||||
|
||||
focus(sel, True, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
6
layout.h
6
layout.h
|
@ -22,7 +22,6 @@
|
|||
#ifndef AWESOME_LAYOUT_H
|
||||
#define AWESOME_LAYOUT_H
|
||||
|
||||
#include "config.h"
|
||||
#include "uicb.h"
|
||||
|
||||
#define AWESOMEPROPS_ATOM(disp) XInternAtom(disp, "_AWESOME_PROPERTIES", False)
|
||||
|
@ -33,15 +32,10 @@ void arrange(int);
|
|||
void restack(int);
|
||||
void loadawesomeprops(int);
|
||||
void saveawesomeprops(int);
|
||||
void client_maximize(Client *c, int, int, int, int);
|
||||
|
||||
Uicb uicb_client_focusnext;
|
||||
Uicb uicb_client_focusprev;
|
||||
Uicb uicb_tag_setlayout;
|
||||
Uicb uicb_client_togglemax;
|
||||
Uicb uicb_client_toggleverticalmax;
|
||||
Uicb uicb_client_togglehorizontalmax;
|
||||
Uicb uicb_client_zoom;
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
Loading…
Reference in New Issue