Massive, massive interface refactoring.
The big change here is that we now keep our configuration structure in a global variable called globalconf. This radically simplifies many interfaces, since passing awesomeconf everywhere is no longer necessary. There are also more subtle interface effects - now we can reliably identify a screen from just a screen ID, rather than an awesomeconf, screenid tuple. Overall, this patch makes most of the interfaces in awesome much nicer to use - enjoy! Yes, this is a huge patch, but since a lot of the refactoring was done systematically using vim macros, splitting this up would have been very hard.
This commit is contained in:
parent
ec80635cbc
commit
2f74c079aa
152
awesome.c
152
awesome.c
|
@ -52,6 +52,8 @@
|
|||
static int (*xerrorxlib) (Display *, XErrorEvent *);
|
||||
static Bool running = True;
|
||||
|
||||
awesome_config globalconf;
|
||||
|
||||
static inline void
|
||||
cleanup_buttons(Button *buttons)
|
||||
{
|
||||
|
@ -65,24 +67,24 @@ cleanup_buttons(Button *buttons)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
cleanup_screen(awesome_config *awesomeconf, int screen)
|
||||
static void
|
||||
cleanup_screen(int screen)
|
||||
{
|
||||
Layout *l, *ln;
|
||||
Tag *t, *tn;
|
||||
|
||||
XftFontClose(awesomeconf->display, awesomeconf->screens[screen].font);
|
||||
XUngrabKey(awesomeconf->display, AnyKey, AnyModifier, RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)));
|
||||
XDestroyWindow(awesomeconf->display, awesomeconf->screens[screen].statusbar.window);
|
||||
XftFontClose(globalconf.display, globalconf.screens[screen].font);
|
||||
XUngrabKey(globalconf.display, AnyKey, AnyModifier, RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)));
|
||||
XDestroyWindow(globalconf.display, globalconf.screens[screen].statusbar.window);
|
||||
|
||||
for(t = awesomeconf->screens[screen].tags; t; t = tn)
|
||||
for(t = globalconf.screens[screen].tags; t; t = tn)
|
||||
{
|
||||
tn = t->next;
|
||||
p_delete(&t->name);
|
||||
p_delete(&t);
|
||||
}
|
||||
|
||||
for(l = awesomeconf->screens[screen].layouts; l; l = ln)
|
||||
for(l = globalconf.screens[screen].layouts; l; l = ln)
|
||||
{
|
||||
ln = l->next;
|
||||
p_delete(&l->symbol);
|
||||
|
@ -94,23 +96,23 @@ cleanup_screen(awesome_config *awesomeconf, int screen)
|
|||
* \param awesomeconf awesome config
|
||||
*/
|
||||
static void
|
||||
cleanup(awesome_config *awesomeconf)
|
||||
cleanup()
|
||||
{
|
||||
int screen;
|
||||
Rule *r, *rn;
|
||||
Key *k, *kn;
|
||||
|
||||
while(awesomeconf->clients)
|
||||
while(globalconf.clients)
|
||||
{
|
||||
client_unban(awesomeconf->clients);
|
||||
client_unmanage(awesomeconf->clients, NormalState, awesomeconf);
|
||||
client_unban(globalconf.clients);
|
||||
client_unmanage(globalconf.clients, NormalState);
|
||||
}
|
||||
|
||||
XFreeCursor(awesomeconf->display, awesomeconf->cursor[CurNormal]);
|
||||
XFreeCursor(awesomeconf->display, awesomeconf->cursor[CurResize]);
|
||||
XFreeCursor(awesomeconf->display, awesomeconf->cursor[CurMove]);
|
||||
XFreeCursor(globalconf.display, globalconf.cursor[CurNormal]);
|
||||
XFreeCursor(globalconf.display, globalconf.cursor[CurResize]);
|
||||
XFreeCursor(globalconf.display, globalconf.cursor[CurMove]);
|
||||
|
||||
for(r = awesomeconf->rules; r; r = rn)
|
||||
for(r = globalconf.rules; r; r = rn)
|
||||
{
|
||||
rn = r->next;
|
||||
p_delete(&r->prop);
|
||||
|
@ -120,72 +122,70 @@ cleanup(awesome_config *awesomeconf)
|
|||
p_delete(&r);
|
||||
}
|
||||
|
||||
for(k = awesomeconf->keys; k; k = kn)
|
||||
for(k = globalconf.keys; k; k = kn)
|
||||
{
|
||||
kn = k->next;
|
||||
p_delete(&k->arg);
|
||||
p_delete(&k);
|
||||
}
|
||||
|
||||
cleanup_buttons(awesomeconf->buttons.tag);
|
||||
cleanup_buttons(awesomeconf->buttons.title);
|
||||
cleanup_buttons(awesomeconf->buttons.layout);
|
||||
cleanup_buttons(awesomeconf->buttons.root);
|
||||
cleanup_buttons(awesomeconf->buttons.client);
|
||||
cleanup_buttons(globalconf.buttons.tag);
|
||||
cleanup_buttons(globalconf.buttons.title);
|
||||
cleanup_buttons(globalconf.buttons.layout);
|
||||
cleanup_buttons(globalconf.buttons.root);
|
||||
cleanup_buttons(globalconf.buttons.client);
|
||||
|
||||
p_delete(&awesomeconf->configpath);
|
||||
p_delete(&globalconf.configpath);
|
||||
|
||||
for(screen = 0; screen < get_screen_count(awesomeconf->display); screen++)
|
||||
cleanup_screen(awesomeconf, screen);
|
||||
for(screen = 0; screen < get_screen_count(globalconf.display); screen++)
|
||||
cleanup_screen(screen);
|
||||
|
||||
XSetInputFocus(awesomeconf->display, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||
XSync(awesomeconf->display, False);
|
||||
XSetInputFocus(globalconf.display, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||
XSync(globalconf.display, False);
|
||||
|
||||
p_delete(&awesomeconf->clients);
|
||||
p_delete(&awesomeconf);
|
||||
p_delete(&globalconf.clients);
|
||||
}
|
||||
|
||||
/** Scan X to find windows to manage
|
||||
* \param screen Screen number
|
||||
* \param awesomeconf awesome config
|
||||
*/
|
||||
static void
|
||||
scan(awesome_config *awesomeconf)
|
||||
scan()
|
||||
{
|
||||
unsigned int i, num;
|
||||
int screen, real_screen;
|
||||
Window *wins = NULL, d1, d2;
|
||||
XWindowAttributes wa;
|
||||
|
||||
for(screen = 0; screen < ScreenCount(awesomeconf->display); screen++)
|
||||
for(screen = 0; screen < ScreenCount(globalconf.display); screen++)
|
||||
{
|
||||
if(XQueryTree(awesomeconf->display, RootWindow(awesomeconf->display, screen), &d1, &d2, &wins, &num))
|
||||
if(XQueryTree(globalconf.display, RootWindow(globalconf.display, screen), &d1, &d2, &wins, &num))
|
||||
{
|
||||
real_screen = screen;
|
||||
for(i = 0; i < num; i++)
|
||||
{
|
||||
if(!XGetWindowAttributes(awesomeconf->display, wins[i], &wa)
|
||||
if(!XGetWindowAttributes(globalconf.display, wins[i], &wa)
|
||||
|| wa.override_redirect
|
||||
|| XGetTransientForHint(awesomeconf->display, wins[i], &d1))
|
||||
|| XGetTransientForHint(globalconf.display, wins[i], &d1))
|
||||
continue;
|
||||
if(wa.map_state == IsViewable || window_getstate(awesomeconf->display, wins[i]) == IconicState)
|
||||
if(wa.map_state == IsViewable || window_getstate(globalconf.display, wins[i]) == IconicState)
|
||||
{
|
||||
if(screen == 0)
|
||||
real_screen = get_screen_bycoord(awesomeconf->display, wa.x, wa.y);
|
||||
client_manage(wins[i], &wa, awesomeconf, real_screen);
|
||||
real_screen = get_screen_bycoord(globalconf.display, wa.x, wa.y);
|
||||
client_manage(wins[i], &wa, real_screen);
|
||||
}
|
||||
}
|
||||
/* now the transients */
|
||||
for(i = 0; i < num; i++)
|
||||
{
|
||||
if(!XGetWindowAttributes(awesomeconf->display, wins[i], &wa))
|
||||
if(!XGetWindowAttributes(globalconf.display, wins[i], &wa))
|
||||
continue;
|
||||
if(XGetTransientForHint(awesomeconf->display, wins[i], &d1)
|
||||
&& (wa.map_state == IsViewable || window_getstate(awesomeconf->display, wins[i]) == IconicState))
|
||||
if(XGetTransientForHint(globalconf.display, wins[i], &d1)
|
||||
&& (wa.map_state == IsViewable || window_getstate(globalconf.display, wins[i]) == IconicState))
|
||||
{
|
||||
if(screen == 0)
|
||||
real_screen = get_screen_bycoord(awesomeconf->display, wa.x, wa.y);
|
||||
client_manage(wins[i], &wa, awesomeconf, real_screen);
|
||||
real_screen = get_screen_bycoord(globalconf.display, wa.x, wa.y);
|
||||
client_manage(wins[i], &wa, real_screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -195,40 +195,40 @@ scan(awesome_config *awesomeconf)
|
|||
}
|
||||
|
||||
/** Setup everything before running
|
||||
* \param awesomeconf awesome config ref
|
||||
* \param screen Screen number
|
||||
* \todo clean things...
|
||||
*/
|
||||
static void
|
||||
setup(awesome_config *awesomeconf, int screen)
|
||||
setup(int screen)
|
||||
{
|
||||
XSetWindowAttributes wa;
|
||||
|
||||
/* init cursors */
|
||||
awesomeconf->cursor[CurNormal] = XCreateFontCursor(awesomeconf->display, XC_left_ptr);
|
||||
awesomeconf->cursor[CurResize] = XCreateFontCursor(awesomeconf->display, XC_sizing);
|
||||
awesomeconf->cursor[CurMove] = XCreateFontCursor(awesomeconf->display, XC_fleur);
|
||||
globalconf.cursor[CurNormal] = XCreateFontCursor(globalconf.display, XC_left_ptr);
|
||||
globalconf.cursor[CurResize] = XCreateFontCursor(globalconf.display, XC_sizing);
|
||||
globalconf.cursor[CurMove] = XCreateFontCursor(globalconf.display, XC_fleur);
|
||||
|
||||
/* select for events */
|
||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||
wa.cursor = awesomeconf->cursor[CurNormal];
|
||||
wa.cursor = globalconf.cursor[CurNormal];
|
||||
|
||||
XChangeWindowAttributes(awesomeconf->display,
|
||||
RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)),
|
||||
XChangeWindowAttributes(globalconf.display,
|
||||
RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)),
|
||||
CWEventMask | CWCursor, &wa);
|
||||
|
||||
XSelectInput(awesomeconf->display, RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)), wa.event_mask);
|
||||
XSelectInput(globalconf.display, RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)), wa.event_mask);
|
||||
|
||||
grabkeys(awesomeconf, screen);
|
||||
grabkeys(screen);
|
||||
}
|
||||
|
||||
void
|
||||
setup_screen(awesome_config *awesomeconf, int screen)
|
||||
static void
|
||||
setup_screen(int screen)
|
||||
{
|
||||
setup(awesomeconf, screen);
|
||||
statusbar_init(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar,
|
||||
awesomeconf->cursor[CurNormal], awesomeconf->screens[screen].font,
|
||||
&awesomeconf->screens[screen].padding);
|
||||
setup(screen);
|
||||
statusbar_init(globalconf.display, screen, &globalconf.screens[screen].statusbar,
|
||||
globalconf.cursor[CurNormal], globalconf.screens[screen].font,
|
||||
&globalconf.screens[screen].padding);
|
||||
}
|
||||
|
||||
/** Startup Error handler to check if another window manager
|
||||
|
@ -243,14 +243,11 @@ xerrorstart(Display * disp __attribute__ ((unused)), XErrorEvent * ee __attribut
|
|||
}
|
||||
|
||||
/** Quit awesome
|
||||
* \param awesomeconf awesome config
|
||||
* \param arg nothing
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_quit(awesome_config *awesomeconf __attribute__((unused)),
|
||||
int screen __attribute__ ((unused)),
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_quit(int screen __attribute__ ((unused)), const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
running = False;
|
||||
}
|
||||
|
@ -282,7 +279,7 @@ xerror(Display * edpy, XErrorEvent * ee)
|
|||
* \param argv who knows
|
||||
* \return EXIT_SUCCESS I hope
|
||||
*/
|
||||
typedef void event_handler (XEvent *, awesome_config *);
|
||||
typedef void event_handler (XEvent *);
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -292,7 +289,6 @@ main(int argc, char *argv[])
|
|||
fd_set rd;
|
||||
XEvent ev;
|
||||
Display * dpy;
|
||||
awesome_config *awesomeconf;
|
||||
int shape_event, randr_event_base;
|
||||
int screen;
|
||||
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
||||
|
@ -337,19 +333,17 @@ main(int argc, char *argv[])
|
|||
xerrorxlib = XSetErrorHandler(xerror);
|
||||
XSync(dpy, False);
|
||||
|
||||
/* allocate stuff */
|
||||
awesomeconf = p_new(awesome_config, 1);
|
||||
awesomeconf->screens = p_new(VirtScreen, get_screen_count(dpy));
|
||||
focus_add_client(&awesomeconf->focus, NULL);
|
||||
globalconf.screens = p_new(VirtScreen, get_screen_count(dpy));
|
||||
focus_add_client(&globalconf.focus, NULL);
|
||||
/* store display */
|
||||
awesomeconf->display = dpy;
|
||||
parse_config(confpath, awesomeconf);
|
||||
globalconf.display = dpy;
|
||||
parse_config(confpath);
|
||||
|
||||
for(screen = 0; screen < get_screen_count(dpy); screen++)
|
||||
{
|
||||
/* set screen */
|
||||
setup_screen(awesomeconf, screen);
|
||||
statusbar_draw(awesomeconf, screen);
|
||||
setup_screen(screen);
|
||||
statusbar_draw(screen);
|
||||
}
|
||||
|
||||
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
|
||||
|
@ -358,7 +352,7 @@ main(int argc, char *argv[])
|
|||
/* do this only for real screen */
|
||||
for(screen = 0; screen < ScreenCount(dpy); screen++)
|
||||
{
|
||||
loadawesomeprops(awesomeconf, screen);
|
||||
loadawesomeprops(screen);
|
||||
XChangeProperty(dpy, RootWindow(dpy, screen), netatom[NetSupported],
|
||||
XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast);
|
||||
}
|
||||
|
@ -378,20 +372,20 @@ main(int argc, char *argv[])
|
|||
handler[UnmapNotify] = handle_event_unmapnotify;
|
||||
|
||||
/* check for shape extension */
|
||||
if((awesomeconf->have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
||||
if((globalconf.have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
||||
{
|
||||
p_realloc(&handler, shape_event + 1);
|
||||
handler[shape_event] = handle_event_shape;
|
||||
}
|
||||
|
||||
/* check for randr extension */
|
||||
if((awesomeconf->have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
||||
if((globalconf.have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
||||
{
|
||||
p_realloc(&handler, randr_event_base + RRScreenChangeNotify + 1);
|
||||
handler[randr_event_base + RRScreenChangeNotify] = handle_event_randr_screen_change_notify;
|
||||
}
|
||||
|
||||
scan(awesomeconf);
|
||||
scan();
|
||||
|
||||
XSync(dpy, False);
|
||||
|
||||
|
@ -438,14 +432,14 @@ main(int argc, char *argv[])
|
|||
if(r >= ssizeof(buf))
|
||||
break;
|
||||
buf[r] = '\0';
|
||||
parse_control(buf, awesomeconf);
|
||||
parse_control(buf);
|
||||
}
|
||||
|
||||
while(XPending(dpy))
|
||||
{
|
||||
XNextEvent(dpy, &ev);
|
||||
if(handler[ev.type])
|
||||
handler[ev.type](&ev, awesomeconf); /* call handler */
|
||||
handler[ev.type](&ev); /* call handler */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,7 +449,7 @@ main(int argc, char *argv[])
|
|||
perror("error unlinking UNIX domain socket");
|
||||
p_delete(&addr);
|
||||
|
||||
cleanup(awesomeconf);
|
||||
cleanup();
|
||||
XCloseDisplay(dpy);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
void cleanup_screen(awesome_config *, int);
|
||||
void setup_screen(awesome_config *, int);
|
||||
int xerror(Display *, XErrorEvent *);
|
||||
UICB_PROTO(uicb_quit);
|
||||
|
||||
|
|
237
client.c
237
client.c
|
@ -35,6 +35,9 @@
|
|||
#include "focus.h"
|
||||
#include "layouts/floating.h"
|
||||
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
/** Load windows properties, restoring client's tag
|
||||
* and floating state before awesome was restarted if any
|
||||
* \todo this may bug if number of tags is != than before
|
||||
|
@ -42,28 +45,28 @@
|
|||
* \param ntags tags number
|
||||
*/
|
||||
static Bool
|
||||
client_loadprops(Client * c, VirtScreen *scr)
|
||||
client_loadprops(Client * c, int screen)
|
||||
{
|
||||
int i, ntags = 0;
|
||||
Tag *tag;
|
||||
char *prop;
|
||||
Bool result = False;
|
||||
|
||||
for(tag = scr->tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
ntags++;
|
||||
|
||||
prop = p_new(char, ntags + 2);
|
||||
|
||||
if(xgettextprop(c->display, c->win, AWESOMEPROPS_ATOM(c->display), prop, ntags + 2))
|
||||
{
|
||||
for(i = 0, tag = scr->tags; tag && i < ntags && prop[i]; i++, tag = tag->next)
|
||||
for(i = 0, tag = globalconf.screens[screen].tags; tag && i < ntags && prop[i]; i++, tag = tag->next)
|
||||
if(prop[i] == '1')
|
||||
{
|
||||
tag_client(&scr->tclink, c, tag);
|
||||
tag_client(c, tag, screen);
|
||||
result = True;
|
||||
}
|
||||
else
|
||||
untag_client(&scr->tclink, c, tag);
|
||||
untag_client(c, tag, screen);
|
||||
|
||||
if(i <= ntags && prop[i])
|
||||
c->isfloating = prop[i] == '1';
|
||||
|
@ -160,16 +163,15 @@ client_ban(Client * c)
|
|||
}
|
||||
|
||||
/** Attach client to the beginning of the clients stack
|
||||
* \param head client list
|
||||
* \param c the client
|
||||
*/
|
||||
void
|
||||
client_attach(Client **head, Client *c)
|
||||
client_attach(Client *c)
|
||||
{
|
||||
if(*head)
|
||||
(*head)->prev = c;
|
||||
c->next = *head;
|
||||
*head = c;
|
||||
if(globalconf.clients)
|
||||
(globalconf.clients)->prev = c;
|
||||
c->next = globalconf.clients;
|
||||
globalconf.clients = c;
|
||||
}
|
||||
|
||||
/** Detach client from clients list
|
||||
|
@ -177,80 +179,76 @@ client_attach(Client **head, Client *c)
|
|||
* \param c client to detach
|
||||
*/
|
||||
void
|
||||
client_detach(Client **head, Client *c)
|
||||
client_detach(Client *c)
|
||||
{
|
||||
if(c->prev)
|
||||
c->prev->next = c->next;
|
||||
if(c->next)
|
||||
c->next->prev = c->prev;
|
||||
if(c == *head)
|
||||
*head = c->next;
|
||||
if(c == globalconf.clients)
|
||||
globalconf.clients = c->next;
|
||||
c->next = c->prev = NULL;
|
||||
}
|
||||
|
||||
/** Give focus to client, or to first client if c is NULL
|
||||
* \param c client
|
||||
* \param selscreen True if current screen is selected
|
||||
* \param awesomeconf awesome config
|
||||
*/
|
||||
void
|
||||
focus(Client *c, Bool selscreen, awesome_config *awesomeconf, int screen)
|
||||
focus(Client *c, Bool selscreen, int screen)
|
||||
{
|
||||
/* unfocus current selected client */
|
||||
if(awesomeconf->focus->client)
|
||||
if(globalconf.focus->client)
|
||||
{
|
||||
window_grabbuttons(awesomeconf->focus->client->display, awesomeconf->focus->client->phys_screen,
|
||||
awesomeconf->focus->client->win, False, True, awesomeconf->buttons.root,
|
||||
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||
XSetWindowBorder(awesomeconf->focus->client->display, awesomeconf->focus->client->win,
|
||||
awesomeconf->screens[screen].colors_normal[ColBorder].pixel);
|
||||
window_settrans(awesomeconf->focus->client->display, awesomeconf->focus->client->win,
|
||||
awesomeconf->screens[screen].opacity_unfocused);
|
||||
window_grabbuttons(globalconf.focus->client->display, globalconf.focus->client->phys_screen,
|
||||
globalconf.focus->client->win, False, True);
|
||||
XSetWindowBorder(globalconf.focus->client->display, globalconf.focus->client->win,
|
||||
globalconf.screens[screen].colors_normal[ColBorder].pixel);
|
||||
window_settrans(globalconf.focus->client->display, globalconf.focus->client->win,
|
||||
globalconf.screens[screen].opacity_unfocused);
|
||||
}
|
||||
|
||||
/* if c is NULL or invisible, take next client in the stack */
|
||||
if((!c && selscreen) || (c && !client_isvisible(c, &awesomeconf->screens[screen], screen)))
|
||||
for(c = awesomeconf->clients; c && !client_isvisible(c, &awesomeconf->screens[screen], screen); c = c->next);
|
||||
if((!c && selscreen) || (c && !client_isvisible(c, screen)))
|
||||
for(c = globalconf.clients; c && !client_isvisible(c, screen); c = c->next);
|
||||
|
||||
if(c)
|
||||
{
|
||||
XSetWindowBorder(awesomeconf->display, c->win, awesomeconf->screens[screen].colors_selected[ColBorder].pixel);
|
||||
XSetWindowBorder(globalconf.display, c->win, globalconf.screens[screen].colors_selected[ColBorder].pixel);
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||
True, True, awesomeconf->buttons.root,
|
||||
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||
True, True);
|
||||
}
|
||||
|
||||
if(!selscreen)
|
||||
return;
|
||||
|
||||
/* save old sel in focus history */
|
||||
focus_add_client(&awesomeconf->focus, c);
|
||||
focus_add_client(&globalconf.focus, c);
|
||||
|
||||
statusbar_draw(awesomeconf, screen);
|
||||
statusbar_draw(screen);
|
||||
|
||||
if(awesomeconf->focus->client)
|
||||
if(globalconf.focus->client)
|
||||
{
|
||||
XSetInputFocus(awesomeconf->focus->client->display,
|
||||
awesomeconf->focus->client->win, RevertToPointerRoot, CurrentTime);
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
if(c != awesomeconf->focus->client)
|
||||
window_settrans(awesomeconf->display, awesomeconf->focus->client->win,
|
||||
awesomeconf->screens[screen].opacity_unfocused);
|
||||
window_settrans(awesomeconf->display, awesomeconf->focus->client->win, -1);
|
||||
XSetInputFocus(globalconf.focus->client->display,
|
||||
globalconf.focus->client->win, RevertToPointerRoot, CurrentTime);
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if(c != globalconf.focus->client)
|
||||
window_settrans(globalconf.display, globalconf.focus->client->win,
|
||||
globalconf.screens[screen].opacity_unfocused);
|
||||
window_settrans(globalconf.display, globalconf.focus->client->win, -1);
|
||||
}
|
||||
else
|
||||
XSetInputFocus(awesomeconf->display,
|
||||
RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)),
|
||||
XSetInputFocus(globalconf.display,
|
||||
RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)),
|
||||
RevertToPointerRoot, CurrentTime);
|
||||
}
|
||||
|
||||
/** Manage a new client
|
||||
* \param w The window
|
||||
* \param wa Window attributes
|
||||
* \param awesomeconf awesome config
|
||||
*/
|
||||
void
|
||||
client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf, int screen)
|
||||
client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||
{
|
||||
Client *c, *t = NULL;
|
||||
Window trans;
|
||||
|
@ -268,20 +266,20 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf, int
|
|||
c->h = c->rh = wa->height;
|
||||
c->oldborder = wa->border_width;
|
||||
|
||||
c->display = awesomeconf->display;
|
||||
c->display = globalconf.display;
|
||||
c->screen = get_screen_bycoord(c->display, c->x, c->y);
|
||||
c->phys_screen = get_phys_screen(awesomeconf->display, c->screen);
|
||||
c->phys_screen = get_phys_screen(globalconf.display, c->screen);
|
||||
|
||||
move_client_to_screen(c, awesomeconf, screen, True);
|
||||
move_client_to_screen(c, screen, True);
|
||||
|
||||
/* update window title */
|
||||
client_updatetitle(c);
|
||||
|
||||
/* loadprops or apply rules if no props */
|
||||
if(!client_loadprops(c, &awesomeconf->screens[screen]))
|
||||
tag_client_with_rules(c, awesomeconf);
|
||||
if(!client_loadprops(c, screen))
|
||||
tag_client_with_rules(c);
|
||||
|
||||
screen_info = get_screen_info(awesomeconf->display, screen, NULL, NULL);
|
||||
screen_info = get_screen_info(globalconf.display, screen, NULL, NULL);
|
||||
|
||||
/* if window request fullscreen mode */
|
||||
if(c->w == screen_info[screen].width && c->h == screen_info[screen].height)
|
||||
|
@ -293,7 +291,7 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf, int
|
|||
}
|
||||
else
|
||||
{
|
||||
ScreenInfo *display_info = get_display_info(c->display, c->phys_screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
ScreenInfo *display_info = get_display_info(c->display, c->phys_screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||
|
||||
if(c->x + c->w + 2 * c->border > display_info->x_org + display_info->width)
|
||||
c->x = c->rx = display_info->x_org + display_info->width - c->w - 2 * c->border;
|
||||
|
@ -304,7 +302,7 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf, int
|
|||
if(c->y < display_info->y_org)
|
||||
c->y = c->ry = display_info->y_org;
|
||||
|
||||
c->border = awesomeconf->screens[screen].borderpx;
|
||||
c->border = globalconf.screens[screen].borderpx;
|
||||
|
||||
p_delete(&display_info);
|
||||
}
|
||||
|
@ -313,7 +311,7 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf, int
|
|||
/* set borders */
|
||||
wc.border_width = c->border;
|
||||
XConfigureWindow(c->display, w, CWBorderWidth, &wc);
|
||||
XSetWindowBorder(c->display, w, awesomeconf->screens[screen].colors_normal[ColBorder].pixel);
|
||||
XSetWindowBorder(c->display, w, globalconf.screens[screen].colors_normal[ColBorder].pixel);
|
||||
|
||||
/* propagates border_width, if size doesn't change */
|
||||
window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);
|
||||
|
@ -324,45 +322,43 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf, int
|
|||
XSelectInput(c->display, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
||||
|
||||
/* handle xshape */
|
||||
if(awesomeconf->have_shape)
|
||||
if(globalconf.have_shape)
|
||||
{
|
||||
XShapeSelectInput(c->display, w, ShapeNotifyMask);
|
||||
window_setshape(c->display, c->phys_screen, c->win);
|
||||
}
|
||||
|
||||
/* grab buttons */
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||
False, True, awesomeconf->buttons.root,
|
||||
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win, False, True);
|
||||
|
||||
/* check for transient and set tags like its parent */
|
||||
if((rettrans = XGetTransientForHint(c->display, w, &trans) == Success)
|
||||
&& (t = get_client_bywin(awesomeconf->clients, trans)))
|
||||
for(tag = awesomeconf->screens[c->screen].tags; tag; tag = tag->next)
|
||||
if(is_client_tagged(awesomeconf->screens[c->screen].tclink, t, tag))
|
||||
tag_client(&awesomeconf->screens[c->screen].tclink, c, tag);
|
||||
&& (t = get_client_bywin(globalconf.clients, trans)))
|
||||
for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next)
|
||||
if(is_client_tagged(t, tag, c->screen))
|
||||
tag_client(c, tag, c->screen);
|
||||
|
||||
/* should be floating if transsient or fixed) */
|
||||
if(!c->isfloating)
|
||||
c->isfloating = (rettrans == Success) || c->isfixed;
|
||||
|
||||
/* save new props */
|
||||
client_saveprops(c, &awesomeconf->screens[c->screen]);
|
||||
client_saveprops(c, c->screen);
|
||||
|
||||
/* attach to the stack */
|
||||
client_attach(&awesomeconf->clients, c);
|
||||
client_attach(c);
|
||||
|
||||
/* some windows require this */
|
||||
XMoveResizeWindow(c->display, c->win, c->x, c->y, c->w, c->h);
|
||||
|
||||
focus(c, True, awesomeconf, screen);
|
||||
focus(c, True, screen);
|
||||
|
||||
/* rearrange to display new window */
|
||||
arrange(awesomeconf, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
void
|
||||
client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf,
|
||||
client_resize(Client *c, int x, int y, int w, int h,
|
||||
Bool sizehints, Bool volatile_coords)
|
||||
{
|
||||
double dx, dy, max, min, ratio;
|
||||
|
@ -412,7 +408,7 @@ client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf
|
|||
if(w <= 0 || h <= 0)
|
||||
return;
|
||||
/* offscreen appearance fixes */
|
||||
si = get_display_info(c->display, c->phys_screen, NULL, &awesomeconf->screens[c->screen].padding);
|
||||
si = get_display_info(c->display, c->phys_screen, NULL, &globalconf.screens[c->screen].padding);
|
||||
if(x > si->width)
|
||||
x = si->width - w - 2 * c->border;
|
||||
if(y > si->height)
|
||||
|
@ -430,7 +426,7 @@ client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf
|
|||
c->h = wc.height = h;
|
||||
if(!volatile_coords
|
||||
&& (c->isfloating
|
||||
|| get_current_layout(awesomeconf->screens[c->screen])->arrange == layout_floating))
|
||||
|| get_current_layout(c->screen)->arrange == layout_floating))
|
||||
{
|
||||
c->rx = c->x;
|
||||
c->ry = c->y;
|
||||
|
@ -445,25 +441,25 @@ client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf
|
|||
{
|
||||
int new_screen = get_screen_bycoord(c->display, c->x, c->y);
|
||||
if(c->screen != new_screen)
|
||||
move_client_to_screen(c, awesomeconf, new_screen, False);
|
||||
move_client_to_screen(c, new_screen, False);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
client_saveprops(Client * c, VirtScreen *scr)
|
||||
client_saveprops(Client * c, int screen)
|
||||
{
|
||||
int i = 0, ntags = 0;
|
||||
char *prop;
|
||||
Tag *tag;
|
||||
|
||||
for(tag = scr->tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
ntags++;
|
||||
|
||||
prop = p_new(char, ntags + 2);
|
||||
|
||||
for(tag = scr->tags; tag; tag = tag->next, i++)
|
||||
prop[i] = is_client_tagged(scr->tclink, c, tag) ? '1' : '0';
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next, i++)
|
||||
prop[i] = is_client_tagged(c, tag, screen) ? '1' : '0';
|
||||
|
||||
if(i <= ntags)
|
||||
prop[i] = c->isfloating ? '1' : '0';
|
||||
|
@ -484,7 +480,7 @@ client_unban(Client *c)
|
|||
}
|
||||
|
||||
void
|
||||
client_unmanage(Client *c, long state, awesome_config *awesomeconf)
|
||||
client_unmanage(Client *c, long state)
|
||||
{
|
||||
XWindowChanges wc;
|
||||
Tag *tag;
|
||||
|
@ -493,19 +489,19 @@ client_unmanage(Client *c, long state, awesome_config *awesomeconf)
|
|||
/* The server grab construct avoids race conditions. */
|
||||
XGrabServer(c->display);
|
||||
XConfigureWindow(c->display, c->win, CWBorderWidth, &wc); /* restore border */
|
||||
client_detach(&awesomeconf->clients, c);
|
||||
if(awesomeconf->focus->client == c)
|
||||
focus(NULL, True, awesomeconf, c->screen);
|
||||
focus_delete_client(&awesomeconf->focus, c);
|
||||
for(tag = awesomeconf->screens[c->screen].tags; tag; tag = tag->next)
|
||||
untag_client(&awesomeconf->screens[c->screen].tclink, c, tag);
|
||||
client_detach(c);
|
||||
if(globalconf.focus->client == c)
|
||||
focus(NULL, True, c->screen);
|
||||
focus_delete_client(&globalconf.focus, c);
|
||||
for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next)
|
||||
untag_client(c, tag, c->screen);
|
||||
XUngrabButton(c->display, AnyButton, AnyModifier, c->win);
|
||||
window_setstate(c->display, c->win, state);
|
||||
XSync(c->display, False);
|
||||
XSetErrorHandler(xerror);
|
||||
XUngrabServer(c->display);
|
||||
if(state != NormalState)
|
||||
arrange(awesomeconf, c->screen);
|
||||
arrange(c->screen);
|
||||
p_delete(&c);
|
||||
}
|
||||
|
||||
|
@ -578,28 +574,25 @@ client_updatesizehints(Client *c)
|
|||
* \return True or False
|
||||
*/
|
||||
Bool
|
||||
client_isvisible(Client *c, VirtScreen *scr, int screen)
|
||||
client_isvisible(Client *c, int screen)
|
||||
{
|
||||
Tag *tag;
|
||||
|
||||
if(c->screen != screen)
|
||||
return False;
|
||||
|
||||
for(tag = scr->tags; tag; tag = tag->next)
|
||||
if(tag->selected && is_client_tagged(scr->tclink, c, tag))
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
if(tag->selected && is_client_tagged(c, tag, screen))
|
||||
return True;
|
||||
return False;
|
||||
}
|
||||
|
||||
/** Set selected client transparency
|
||||
* \param awesomeconf awesome config
|
||||
* \param arg unused arg
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_settrans(awesome_config *awesomeconf,
|
||||
int screen __attribute__ ((unused)),
|
||||
const char *arg)
|
||||
uicb_client_settrans(int screen __attribute__ ((unused)), const char *arg)
|
||||
{
|
||||
double delta = 100.0, current_opacity = 100.0;
|
||||
unsigned char *data;
|
||||
|
@ -608,12 +601,12 @@ uicb_client_settrans(awesome_config *awesomeconf,
|
|||
unsigned long n, left;
|
||||
unsigned int current_opacity_raw = 0;
|
||||
int set_prop = 0;
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
XGetWindowProperty(awesomeconf->display, sel->win,
|
||||
XGetWindowProperty(globalconf.display, sel->win,
|
||||
XInternAtom(sel->display, "_NET_WM_WINDOW_OPACITY", False),
|
||||
0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left,
|
||||
(unsigned char **) &data);
|
||||
|
@ -644,75 +637,66 @@ uicb_client_settrans(awesome_config *awesomeconf,
|
|||
|
||||
|
||||
/** Set border size
|
||||
* \param awesomeconf awesome config
|
||||
* \param arg X, +X or -X
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_setborder(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_setborder(int screen, const char *arg)
|
||||
{
|
||||
if(!arg)
|
||||
return;
|
||||
|
||||
if((awesomeconf->screens[screen].borderpx = (int) compute_new_value_from_arg(arg, (double) awesomeconf->screens[screen].borderpx)) < 0)
|
||||
awesomeconf->screens[screen].borderpx = 0;
|
||||
if((globalconf.screens[screen].borderpx = (int) compute_new_value_from_arg(arg, (double) globalconf.screens[screen].borderpx)) < 0)
|
||||
globalconf.screens[screen].borderpx = 0;
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_swapnext(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_client_swapnext(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *next, *sel = awesomeconf->focus->client;
|
||||
Client *next, *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
for(next = sel->next; next && !client_isvisible(next, &awesomeconf->screens[screen], screen); next = next->next);
|
||||
for(next = sel->next; next && !client_isvisible(next, screen); next = next->next);
|
||||
if(next)
|
||||
{
|
||||
client_swap(&awesomeconf->clients, sel, next);
|
||||
arrange(awesomeconf, screen);
|
||||
client_swap(&globalconf.clients, sel, next);
|
||||
arrange(screen);
|
||||
/* restore focus */
|
||||
focus(sel, True, awesomeconf, screen);
|
||||
focus(sel, True, screen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_swapprev(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_client_swapprev(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *prev, *sel = awesomeconf->focus->client;
|
||||
Client *prev, *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
for(prev = sel->prev; prev && !client_isvisible(prev, &awesomeconf->screens[screen], screen); prev = prev->prev);
|
||||
for(prev = sel->prev; prev && !client_isvisible(prev, screen); prev = prev->prev);
|
||||
if(prev)
|
||||
{
|
||||
client_swap(&awesomeconf->clients, prev, sel);
|
||||
arrange(awesomeconf, screen);
|
||||
client_swap(&globalconf.clients, prev, sel);
|
||||
arrange(screen);
|
||||
/* restore focus */
|
||||
focus(sel, True, awesomeconf, screen);
|
||||
focus(sel, True, screen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_moveresize(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_client_moveresize(int screen, const char *arg)
|
||||
{
|
||||
int nx, ny, nw, nh, ox, oy, ow, oh;
|
||||
char x[8], y[8], w[8], h[8];
|
||||
int mx, my, dx, dy, nmx, nmy;
|
||||
unsigned int dui;
|
||||
Window dummy;
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(get_current_layout(awesomeconf->screens[screen])->arrange != layout_floating)
|
||||
if(get_current_layout(screen)->arrange != layout_floating)
|
||||
if(!sel || !sel->isfloating || sel->isfixed || !arg)
|
||||
return;
|
||||
if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4)
|
||||
|
@ -727,28 +711,25 @@ uicb_client_moveresize(awesome_config *awesomeconf,
|
|||
ow = sel->w;
|
||||
oh = sel->h;
|
||||
|
||||
Bool xqp = XQueryPointer(awesomeconf->display, RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||
client_resize(sel, nx, ny, nw, nh, awesomeconf, True, False);
|
||||
Bool xqp = XQueryPointer(globalconf.display, RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||
client_resize(sel, nx, ny, nw, nh, True, False);
|
||||
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;
|
||||
nmy = my - oy + sel->h - oh - 1 < 0 ? 0 : my - oy + sel->h - oh - 1;
|
||||
XWarpPointer(awesomeconf->display, None, sel->win, 0, 0, 0, 0, nmx, nmy);
|
||||
XWarpPointer(globalconf.display, None, sel->win, 0, 0, 0, 0, nmx, nmy);
|
||||
}
|
||||
}
|
||||
|
||||
/** Kill selected client
|
||||
* \param awesomeconf awesome config
|
||||
* \param arg unused
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_kill(awesome_config *awesomeconf,
|
||||
int screen __attribute__ ((unused)),
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_client_kill(int screen __attribute__ ((unused)), const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
XEvent ev;
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
@ -756,13 +737,13 @@ uicb_client_kill(awesome_config *awesomeconf,
|
|||
{
|
||||
ev.type = ClientMessage;
|
||||
ev.xclient.window = sel->win;
|
||||
ev.xclient.message_type = XInternAtom(awesomeconf->display, "WM_PROTOCOLS", False);
|
||||
ev.xclient.message_type = XInternAtom(globalconf.display, "WM_PROTOCOLS", False);
|
||||
ev.xclient.format = 32;
|
||||
ev.xclient.data.l[0] = XInternAtom(awesomeconf->display, "WM_DELETE_WINDOW", False);
|
||||
ev.xclient.data.l[0] = XInternAtom(globalconf.display, "WM_DELETE_WINDOW", False);
|
||||
ev.xclient.data.l[1] = CurrentTime;
|
||||
XSendEvent(awesomeconf->display, sel->win, False, NoEventMask, &ev);
|
||||
XSendEvent(globalconf.display, sel->win, False, NoEventMask, &ev);
|
||||
}
|
||||
else
|
||||
XKillClient(awesomeconf->display, sel->win);
|
||||
XKillClient(globalconf.display, sel->win);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
16
client.h
16
client.h
|
@ -24,19 +24,19 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
Bool client_isvisible(Client *, VirtScreen *, int);
|
||||
Bool client_isvisible(Client *, int);
|
||||
Client * get_client_bywin(Client *, Window);
|
||||
void client_attach(Client **, Client *);
|
||||
void client_detach(Client **, Client *);
|
||||
void client_attach(Client *);
|
||||
void client_detach(Client *);
|
||||
void client_ban(Client *);
|
||||
void focus(Client *, Bool, awesome_config *, int);
|
||||
void client_manage(Window, XWindowAttributes *, awesome_config *, int);
|
||||
void client_resize(Client *, int, int, int, int, awesome_config *, Bool, Bool);
|
||||
void focus(Client *, Bool, int);
|
||||
void client_manage(Window, XWindowAttributes *, int);
|
||||
void client_resize(Client *, int, int, int, int, Bool, Bool);
|
||||
void client_unban(Client *);
|
||||
void client_unmanage(Client *, long, awesome_config *);
|
||||
void client_unmanage(Client *, long);
|
||||
void client_updatesizehints(Client *);
|
||||
void client_updatetitle(Client *);
|
||||
void client_saveprops(Client *, VirtScreen *);
|
||||
void client_saveprops(Client *, int);
|
||||
|
||||
UICB_PROTO(uicb_client_kill);
|
||||
UICB_PROTO(uicb_client_moveresize);
|
||||
|
|
6
common.h
6
common.h
|
@ -24,11 +24,11 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
/** Common prototype definition for ui_callbak functions */
|
||||
#define UICB_PROTO(name) void name(awesome_config *, int, const char *)
|
||||
/** Common prototype definition for ui_callback functions */
|
||||
#define UICB_PROTO(name) void name(int, const char *)
|
||||
|
||||
/** Common prototype definition for layouts function */
|
||||
#define LAYOUT_PROTO(name) void name(awesome_config *, int)
|
||||
#define LAYOUT_PROTO(name) void name(int)
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
60
config.c
60
config.c
|
@ -41,6 +41,8 @@
|
|||
|
||||
#define AWESOME_CONFIG_FILE ".awesomerc"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
static XColor initxcolor(Display *, int, const char *);
|
||||
static unsigned int get_numlockmask(Display *);
|
||||
|
||||
|
@ -247,7 +249,7 @@ static Key *section_keys(cfg_t *cfg_keys)
|
|||
* \param scr Screen number
|
||||
*/
|
||||
void
|
||||
parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
||||
parse_config(const char *confpatharg)
|
||||
{
|
||||
static cfg_opt_t general_opts[] =
|
||||
{
|
||||
|
@ -415,7 +417,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
a_strcat(confpath, confpath_len, AWESOME_CONFIG_FILE);
|
||||
}
|
||||
|
||||
awesomeconf->configpath = a_strdup(confpath);
|
||||
globalconf.configpath = a_strdup(confpath);
|
||||
|
||||
cfg = cfg_init(opts, CFGF_NONE);
|
||||
|
||||
|
@ -431,9 +433,9 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
cfg_error(cfg, "awesome: parsing configuration file %s failed.\n", confpath);
|
||||
|
||||
/* get the right screen section */
|
||||
for(screen = 0; screen < get_screen_count(awesomeconf->display); screen++)
|
||||
for(screen = 0; screen < get_screen_count(globalconf.display); screen++)
|
||||
{
|
||||
virtscreen = &awesomeconf->screens[screen];
|
||||
virtscreen = &globalconf.screens[screen];
|
||||
a_strcpy(virtscreen->statustext,
|
||||
sizeof(virtscreen->statustext),
|
||||
"awesome-" VERSION " (" RELEASE ")");
|
||||
|
@ -465,29 +467,29 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
virtscreen->opacity_unfocused = cfg_getint(cfg_general, "opacity_unfocused");
|
||||
virtscreen->focus_move_pointer = cfg_getbool(cfg_general, "focus_move_pointer");
|
||||
virtscreen->allow_lower_floats = cfg_getbool(cfg_general, "allow_lower_floats");
|
||||
virtscreen->font = XftFontOpenName(awesomeconf->display,
|
||||
get_phys_screen(awesomeconf->display, screen),
|
||||
virtscreen->font = XftFontOpenName(globalconf.display,
|
||||
get_phys_screen(globalconf.display, screen),
|
||||
cfg_getstr(cfg_general, "font"));
|
||||
if(!virtscreen->font)
|
||||
eprint("awesome: cannot init font\n");
|
||||
/* Colors */
|
||||
virtscreen->colors_normal[ColBorder] = initxcolor(awesomeconf->display,
|
||||
get_phys_screen(awesomeconf->display, screen),
|
||||
virtscreen->colors_normal[ColBorder] = initxcolor(globalconf.display,
|
||||
get_phys_screen(globalconf.display, screen),
|
||||
cfg_getstr(cfg_colors, "normal_border"));
|
||||
virtscreen->colors_normal[ColBG] = initxcolor(awesomeconf->display,
|
||||
get_phys_screen(awesomeconf->display, screen),
|
||||
virtscreen->colors_normal[ColBG] = initxcolor(globalconf.display,
|
||||
get_phys_screen(globalconf.display, screen),
|
||||
cfg_getstr(cfg_colors, "normal_bg"));
|
||||
virtscreen->colors_normal[ColFG] = initxcolor(awesomeconf->display,
|
||||
get_phys_screen(awesomeconf->display, screen),
|
||||
virtscreen->colors_normal[ColFG] = initxcolor(globalconf.display,
|
||||
get_phys_screen(globalconf.display, screen),
|
||||
cfg_getstr(cfg_colors, "normal_fg"));
|
||||
virtscreen->colors_selected[ColBorder] = initxcolor(awesomeconf->display,
|
||||
get_phys_screen(awesomeconf->display, screen),
|
||||
virtscreen->colors_selected[ColBorder] = initxcolor(globalconf.display,
|
||||
get_phys_screen(globalconf.display, screen),
|
||||
cfg_getstr(cfg_colors, "focus_border"));
|
||||
virtscreen->colors_selected[ColBG] = initxcolor(awesomeconf->display,
|
||||
get_phys_screen(awesomeconf->display, screen),
|
||||
virtscreen->colors_selected[ColBG] = initxcolor(globalconf.display,
|
||||
get_phys_screen(globalconf.display, screen),
|
||||
cfg_getstr(cfg_colors, "focus_bg"));
|
||||
virtscreen->colors_selected[ColFG] = initxcolor(awesomeconf->display,
|
||||
get_phys_screen(awesomeconf->display, screen),
|
||||
virtscreen->colors_selected[ColFG] = initxcolor(globalconf.display,
|
||||
get_phys_screen(globalconf.display, screen),
|
||||
cfg_getstr(cfg_colors, "focus_fg"));
|
||||
|
||||
/* Statusbar */
|
||||
|
@ -584,7 +586,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
/* Rules */
|
||||
if(cfg_size(cfg_rules, "rule"))
|
||||
{
|
||||
awesomeconf->rules = rule = p_new(Rule, 1);
|
||||
globalconf.rules = rule = p_new(Rule, 1);
|
||||
for(i = 0; i < cfg_size(cfg_rules, "rule"); i++)
|
||||
{
|
||||
cfgsectmp = cfg_getnsec(cfg_rules, "rule", i);
|
||||
|
@ -594,7 +596,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
rule->tags = NULL;
|
||||
rule->isfloating = cfg_getbool(cfgsectmp, "float");
|
||||
rule->screen = cfg_getint(cfgsectmp, "screen");
|
||||
if(rule->screen >= get_screen_count(awesomeconf->display))
|
||||
if(rule->screen >= get_screen_count(globalconf.display))
|
||||
rule->screen = 0;
|
||||
|
||||
if(i < cfg_size(cfg_rules, "rule") - 1)
|
||||
|
@ -604,30 +606,30 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
}
|
||||
}
|
||||
else
|
||||
awesomeconf->rules = NULL;
|
||||
globalconf.rules = NULL;
|
||||
|
||||
compileregs(awesomeconf->rules);
|
||||
compileregs(globalconf.rules);
|
||||
|
||||
|
||||
/* Mouse: tags click bindings */
|
||||
awesomeconf->buttons.tag = parse_mouse_bindings(cfg_mouse, "tag", False);
|
||||
globalconf.buttons.tag = parse_mouse_bindings(cfg_mouse, "tag", False);
|
||||
|
||||
/* Mouse: layout click bindings */
|
||||
awesomeconf->buttons.layout = parse_mouse_bindings(cfg_mouse, "layout", True);
|
||||
globalconf.buttons.layout = parse_mouse_bindings(cfg_mouse, "layout", True);
|
||||
|
||||
/* Mouse: title click bindings */
|
||||
awesomeconf->buttons.title = parse_mouse_bindings(cfg_mouse, "title", True);
|
||||
globalconf.buttons.title = parse_mouse_bindings(cfg_mouse, "title", True);
|
||||
|
||||
/* Mouse: root window click bindings */
|
||||
awesomeconf->buttons.root = parse_mouse_bindings(cfg_mouse, "root", True);
|
||||
globalconf.buttons.root = parse_mouse_bindings(cfg_mouse, "root", True);
|
||||
|
||||
/* Mouse: client windows click bindings */
|
||||
awesomeconf->buttons.client = parse_mouse_bindings(cfg_mouse, "client", True);
|
||||
globalconf.buttons.client = parse_mouse_bindings(cfg_mouse, "client", True);
|
||||
|
||||
/* Keys */
|
||||
awesomeconf->numlockmask = get_numlockmask(awesomeconf->display);
|
||||
globalconf.numlockmask = get_numlockmask(globalconf.display);
|
||||
|
||||
awesomeconf->keys = section_keys(cfg_keys);
|
||||
globalconf.keys = section_keys(cfg_keys);
|
||||
|
||||
if(defconfig)
|
||||
{
|
||||
|
|
12
config.h
12
config.h
|
@ -55,7 +55,7 @@ typedef struct Layout Layout;
|
|||
struct Layout
|
||||
{
|
||||
char *symbol;
|
||||
void (*arrange) (awesome_config *, int);
|
||||
void (*arrange) (int);
|
||||
Layout *next;
|
||||
};
|
||||
|
||||
|
@ -64,7 +64,7 @@ struct Key
|
|||
{
|
||||
unsigned long mod;
|
||||
KeySym keysym;
|
||||
void (*func) (awesome_config *, int, char *);
|
||||
void (*func) (int, char *);
|
||||
char *arg;
|
||||
Key *next;
|
||||
};
|
||||
|
@ -74,7 +74,7 @@ struct Button
|
|||
{
|
||||
unsigned long mod;
|
||||
unsigned int button;
|
||||
void (*func) (awesome_config *, int, char *);
|
||||
void (*func) (int, char *);
|
||||
char *arg;
|
||||
Button *next;
|
||||
};
|
||||
|
@ -224,9 +224,7 @@ typedef struct
|
|||
struct Widget
|
||||
{
|
||||
char *name;
|
||||
int (*draw)(DrawCtx *,
|
||||
awesome_config *,
|
||||
VirtScreen, int, int, int, int);
|
||||
int (*draw)(DrawCtx *, int, int, int, int);
|
||||
Statusbar *statusbar;
|
||||
int alignment;
|
||||
Widget *next;
|
||||
|
@ -269,7 +267,7 @@ struct awesome_config
|
|||
FocusList *focus;
|
||||
};
|
||||
|
||||
void parse_config(const char *, awesome_config *);
|
||||
void parse_config(const char *);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
190
event.c
190
event.c
|
@ -37,28 +37,30 @@
|
|||
#include "layouts/tile.h"
|
||||
#include "layouts/floating.h"
|
||||
|
||||
#define CLEANMASK(mask, acf) (mask & ~(acf->numlockmask | LockMask))
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
#define CLEANMASK(mask) (mask & ~(globalconf.numlockmask | LockMask))
|
||||
|
||||
static void
|
||||
handle_mouse_button_press(awesome_config *awesomeconf, int screen,
|
||||
unsigned int button, unsigned int state,
|
||||
handle_mouse_button_press(int screen, unsigned int button, unsigned int state,
|
||||
Button *buttons, char *arg)
|
||||
{
|
||||
Button *b;
|
||||
|
||||
for(b = buttons; b; b = b->next)
|
||||
if(button == b->button && CLEANMASK(state, awesomeconf) == b->mod && b->func)
|
||||
if(button == b->button && CLEANMASK(state) == b->mod && b->func)
|
||||
{
|
||||
if(arg)
|
||||
b->func(awesomeconf, screen, arg);
|
||||
b->func(screen, arg);
|
||||
else
|
||||
b->func(awesomeconf, screen, b->arg);
|
||||
b->func(screen, b->arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_buttonpress(XEvent * e)
|
||||
{
|
||||
int i, screen, x = 0, y = 0;
|
||||
unsigned int udummy;
|
||||
|
@ -69,52 +71,46 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
|||
XButtonPressedEvent *ev = &e->xbutton;
|
||||
|
||||
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
||||
if(awesomeconf->screens[screen].statusbar.window == ev->window)
|
||||
if(globalconf.screens[screen].statusbar.window == ev->window)
|
||||
{
|
||||
for(i = 1, tag = awesomeconf->screens[screen].tags; tag; tag = tag->next, i++)
|
||||
for(i = 1, tag = globalconf.screens[screen].tags; tag; tag = tag->next, i++)
|
||||
{
|
||||
x += textwidth_primitive(e->xany.display, awesomeconf->screens[screen].font, awesomeconf->screens[screen].tags[i].name);
|
||||
if(((awesomeconf->screens[screen].statusbar.position == BarTop
|
||||
|| awesomeconf->screens[screen].statusbar.position == BarBot)
|
||||
x += textwidth_primitive(e->xany.display, globalconf.screens[screen].font, globalconf.screens[screen].tags[i].name);
|
||||
if(((globalconf.screens[screen].statusbar.position == BarTop
|
||||
|| globalconf.screens[screen].statusbar.position == BarBot)
|
||||
&& ev->x < x)
|
||||
|| (awesomeconf->screens[screen].statusbar.position == BarRight && ev->y < x)
|
||||
|| (awesomeconf->screens[screen].statusbar.position == BarLeft && ev->y > awesomeconf->screens[screen].statusbar.width - x))
|
||||
|| (globalconf.screens[screen].statusbar.position == BarRight && ev->y < x)
|
||||
|| (globalconf.screens[screen].statusbar.position == BarLeft && ev->y > globalconf.screens[screen].statusbar.width - x))
|
||||
{
|
||||
snprintf(arg, sizeof(arg), "%d", i);
|
||||
handle_mouse_button_press(awesomeconf, screen, ev->button, ev->state,
|
||||
awesomeconf->buttons.tag, arg);
|
||||
handle_mouse_button_press(screen, ev->button, ev->state, globalconf.buttons.tag, arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
x += awesomeconf->screens[screen].statusbar.txtlayoutwidth;
|
||||
if(((awesomeconf->screens[screen].statusbar.position == BarTop
|
||||
|| awesomeconf->screens[screen].statusbar.position == BarBot)
|
||||
x += globalconf.screens[screen].statusbar.txtlayoutwidth;
|
||||
if(((globalconf.screens[screen].statusbar.position == BarTop
|
||||
|| globalconf.screens[screen].statusbar.position == BarBot)
|
||||
&& ev->x < x)
|
||||
|| (awesomeconf->screens[screen].statusbar.position == BarRight && ev->y < x)
|
||||
|| (awesomeconf->screens[screen].statusbar.position == BarLeft && ev->y > awesomeconf->screens[screen].statusbar.width - x))
|
||||
handle_mouse_button_press(awesomeconf, screen, ev->button, ev->state,
|
||||
awesomeconf->buttons.layout, NULL);
|
||||
|| (globalconf.screens[screen].statusbar.position == BarRight && ev->y < x)
|
||||
|| (globalconf.screens[screen].statusbar.position == BarLeft && ev->y > globalconf.screens[screen].statusbar.width - x))
|
||||
handle_mouse_button_press(screen, ev->button, ev->state, globalconf.buttons.layout, NULL);
|
||||
else
|
||||
handle_mouse_button_press(awesomeconf, screen, ev->button, ev->state,
|
||||
awesomeconf->buttons.title, NULL);
|
||||
handle_mouse_button_press(screen, ev->button, ev->state, globalconf.buttons.title, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window)))
|
||||
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
||||
{
|
||||
focus(c, ev->same_screen, awesomeconf, c->screen);
|
||||
if(CLEANMASK(ev->state, awesomeconf) == NoSymbol
|
||||
focus(c, ev->same_screen, c->screen);
|
||||
if(CLEANMASK(ev->state) == NoSymbol
|
||||
&& ev->button == Button1)
|
||||
{
|
||||
restack(awesomeconf, c->screen);
|
||||
restack(c->screen);
|
||||
XAllowEvents(c->display, ReplayPointer, CurrentTime);
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||
True, True, awesomeconf->buttons.root,
|
||||
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win, True, True);
|
||||
}
|
||||
else
|
||||
handle_mouse_button_press(awesomeconf, c->screen, ev->button, ev->state,
|
||||
awesomeconf->buttons.client, NULL);
|
||||
handle_mouse_button_press(c->screen, ev->button, ev->state, globalconf.buttons.client, NULL);
|
||||
}
|
||||
else
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
|
@ -122,27 +118,27 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
|||
&& XQueryPointer(e->xany.display, ev->window, &wdummy, &wdummy, &x, &y, &i, &i, &udummy))
|
||||
{
|
||||
screen = get_screen_bycoord(e->xany.display, x, y);
|
||||
handle_mouse_button_press(awesomeconf, screen, ev->button, ev->state,
|
||||
awesomeconf->buttons.root, NULL);
|
||||
handle_mouse_button_press(screen, ev->button, ev->state,
|
||||
globalconf.buttons.root, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_configurerequest(XEvent * e)
|
||||
{
|
||||
Client *c;
|
||||
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
||||
XWindowChanges wc;
|
||||
int old_screen;
|
||||
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window)))
|
||||
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
||||
{
|
||||
c->ismax = False;
|
||||
if(ev->value_mask & CWBorderWidth)
|
||||
c->border = ev->border_width;
|
||||
if(c->isfixed || c->isfloating
|
||||
|| get_current_layout(awesomeconf->screens[c->screen])->arrange == layout_floating)
|
||||
|| get_current_layout(c->screen)->arrange == layout_floating)
|
||||
{
|
||||
if(ev->value_mask & CWX)
|
||||
c->rx = c->x = ev->x;
|
||||
|
@ -159,13 +155,13 @@ handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf)
|
|||
c->screen = get_screen_bycoord(c->display, c->x, c->y);
|
||||
if(old_screen != c->screen)
|
||||
{
|
||||
move_client_to_screen(c, awesomeconf, c->screen, False);
|
||||
statusbar_draw(awesomeconf, old_screen);
|
||||
statusbar_draw(awesomeconf, c->screen);
|
||||
move_client_to_screen(c, c->screen, False);
|
||||
statusbar_draw(old_screen);
|
||||
statusbar_draw(c->screen);
|
||||
}
|
||||
tag_client_with_rules(c, awesomeconf);
|
||||
tag_client_with_rules(c);
|
||||
XMoveResizeWindow(e->xany.display, c->win, c->rx, c->ry, c->rw, c->rh);
|
||||
arrange(awesomeconf, c->screen);
|
||||
arrange(c->screen);
|
||||
}
|
||||
else
|
||||
window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);
|
||||
|
@ -185,7 +181,7 @@ handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf)
|
|||
}
|
||||
|
||||
void
|
||||
handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_configurenotify(XEvent * e)
|
||||
{
|
||||
XConfigureEvent *ev = &e->xconfigure;
|
||||
int screen;
|
||||
|
@ -200,32 +196,32 @@ handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf)
|
|||
DisplayHeight(e->xany.display, screen) = ev->height;
|
||||
|
||||
/* update statusbar */
|
||||
si = get_screen_info(e->xany.display, screen, NULL, &awesomeconf->screens[screen].padding);
|
||||
awesomeconf->screens[screen].statusbar.width = si[screen].width;
|
||||
si = get_screen_info(e->xany.display, screen, NULL, &globalconf.screens[screen].padding);
|
||||
globalconf.screens[screen].statusbar.width = si[screen].width;
|
||||
p_delete(&si);
|
||||
|
||||
XResizeWindow(e->xany.display,
|
||||
awesomeconf->screens[screen].statusbar.window,
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height);
|
||||
globalconf.screens[screen].statusbar.window,
|
||||
globalconf.screens[screen].statusbar.width,
|
||||
globalconf.screens[screen].statusbar.height);
|
||||
|
||||
statusbar_update_position(e->xany.display, awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
arrange(awesomeconf, screen);
|
||||
statusbar_update_position(e->xany.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||
arrange(screen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_destroynotify(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_destroynotify(XEvent * e)
|
||||
{
|
||||
Client *c;
|
||||
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
||||
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window)))
|
||||
client_unmanage(c, WithdrawnState, awesomeconf);
|
||||
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
||||
client_unmanage(c, WithdrawnState);
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_enternotify(XEvent * e)
|
||||
{
|
||||
Client *c;
|
||||
XCrossingEvent *ev = &e->xcrossing;
|
||||
|
@ -233,35 +229,33 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
|
|||
|
||||
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
||||
return;
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window)))
|
||||
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
||||
{
|
||||
focus(c, ev->same_screen, awesomeconf, c->screen);
|
||||
focus(c, ev->same_screen, c->screen);
|
||||
if (c->isfloating
|
||||
|| get_current_layout(awesomeconf->screens[c->screen])->arrange == layout_floating)
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||
True, False, awesomeconf->buttons.root,
|
||||
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||
|| get_current_layout(c->screen)->arrange == layout_floating)
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win, True, False);
|
||||
}
|
||||
else
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
if(ev->window == RootWindow(e->xany.display, screen))
|
||||
focus(NULL, True, awesomeconf, screen);
|
||||
focus(NULL, True, screen);
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_expose(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_expose(XEvent * e)
|
||||
{
|
||||
XExposeEvent *ev = &e->xexpose;
|
||||
int screen;
|
||||
|
||||
if(!ev->count)
|
||||
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
||||
if(awesomeconf->screens[screen].statusbar.window == ev->window)
|
||||
statusbar_draw(awesomeconf, screen);
|
||||
if(globalconf.screens[screen].statusbar.window == ev->window)
|
||||
statusbar_draw(screen);
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_keypress(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_keypress(XEvent * e)
|
||||
{
|
||||
int screen, x, y, d;
|
||||
unsigned int m;
|
||||
|
@ -285,28 +279,28 @@ handle_event_keypress(XEvent * e, awesome_config *awesomeconf)
|
|||
break;
|
||||
}
|
||||
|
||||
for(k = awesomeconf->keys; k; k = k->next)
|
||||
for(k = globalconf.keys; k; k = k->next)
|
||||
if(keysym == k->keysym && k->func
|
||||
&& CLEANMASK(k->mod, awesomeconf) == CLEANMASK(ev->state, awesomeconf))
|
||||
&& CLEANMASK(k->mod) == CLEANMASK(ev->state))
|
||||
{
|
||||
k->func(awesomeconf, screen, k->arg);
|
||||
k->func(screen, k->arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_leavenotify(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_leavenotify(XEvent * e)
|
||||
{
|
||||
XCrossingEvent *ev = &e->xcrossing;
|
||||
int screen;
|
||||
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
if((ev->window == RootWindow(e->xany.display, screen)) && !ev->same_screen)
|
||||
focus(NULL, ev->same_screen, awesomeconf, screen);
|
||||
focus(NULL, ev->same_screen, screen);
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_mappingnotify(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_mappingnotify(XEvent * e)
|
||||
{
|
||||
XMappingEvent *ev = &e->xmapping;
|
||||
int screen;
|
||||
|
@ -314,11 +308,11 @@ handle_event_mappingnotify(XEvent * e, awesome_config *awesomeconf)
|
|||
XRefreshKeyboardMapping(ev);
|
||||
if(ev->request == MappingKeyboard)
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
grabkeys(awesomeconf, get_phys_screen(awesomeconf->display, screen));
|
||||
grabkeys(get_phys_screen(globalconf.display, screen));
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_maprequest(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_maprequest(XEvent * e)
|
||||
{
|
||||
static XWindowAttributes wa;
|
||||
XMapRequestEvent *ev = &e->xmaprequest;
|
||||
|
@ -330,18 +324,18 @@ handle_event_maprequest(XEvent * e, awesome_config *awesomeconf)
|
|||
return;
|
||||
if(wa.override_redirect)
|
||||
return;
|
||||
if(!get_client_bywin(awesomeconf->clients, ev->window))
|
||||
if(!get_client_bywin(globalconf.clients, ev->window))
|
||||
{
|
||||
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
|
||||
if(screen == 0 && XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen),
|
||||
&dummy, &dummy, &x, &y, &d, &d, &m))
|
||||
screen = get_screen_bycoord(e->xany.display, x, y);
|
||||
client_manage(ev->window, &wa, awesomeconf, screen);
|
||||
client_manage(ev->window, &wa, screen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_propertynotify(XEvent * e)
|
||||
{
|
||||
Client *c;
|
||||
Window trans;
|
||||
|
@ -349,14 +343,14 @@ handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
|
|||
|
||||
if(ev->state == PropertyDelete)
|
||||
return; /* ignore */
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window)))
|
||||
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
||||
{
|
||||
switch (ev->atom)
|
||||
{
|
||||
case XA_WM_TRANSIENT_FOR:
|
||||
XGetTransientForHint(e->xany.display, c->win, &trans);
|
||||
if(!c->isfloating && (c->isfloating = (get_client_bywin(awesomeconf->clients, trans) != NULL)))
|
||||
arrange(awesomeconf, c->screen);
|
||||
if(!c->isfloating && (c->isfloating = (get_client_bywin(globalconf.clients, trans) != NULL)))
|
||||
arrange(c->screen);
|
||||
break;
|
||||
case XA_WM_NORMAL_HINTS:
|
||||
client_updatesizehints(c);
|
||||
|
@ -365,57 +359,55 @@ handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
|
|||
if(ev->atom == XA_WM_NAME || ev->atom == XInternAtom(c->display, "_NET_WM_NAME", False))
|
||||
{
|
||||
client_updatetitle(c);
|
||||
if(c == awesomeconf->focus->client)
|
||||
statusbar_draw(awesomeconf, c->screen);
|
||||
if(c == globalconf.focus->client)
|
||||
statusbar_draw(c->screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_unmapnotify(XEvent * e, awesome_config *awesomeconf)
|
||||
handle_event_unmapnotify(XEvent * e)
|
||||
{
|
||||
Client *c;
|
||||
XUnmapEvent *ev = &e->xunmap;
|
||||
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window))
|
||||
if((c = get_client_bywin(globalconf.clients, ev->window))
|
||||
&& ev->event == RootWindow(e->xany.display, c->phys_screen)
|
||||
&& ev->send_event && window_getstate(c->display, c->win) == NormalState)
|
||||
client_unmanage(c, WithdrawnState, awesomeconf);
|
||||
client_unmanage(c, WithdrawnState);
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_shape(XEvent * e,
|
||||
awesome_config *awesomeconf __attribute__ ((unused)))
|
||||
handle_event_shape(XEvent * e)
|
||||
{
|
||||
XShapeEvent *ev = (XShapeEvent *) e;
|
||||
Client *c = get_client_bywin(awesomeconf->clients, ev->window);
|
||||
Client *c = get_client_bywin(globalconf.clients, ev->window);
|
||||
|
||||
if(c)
|
||||
window_setshape(c->display, c->phys_screen, c->win);
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_randr_screen_change_notify(XEvent *e,
|
||||
awesome_config *awesomeconf __attribute__ ((unused)))
|
||||
handle_event_randr_screen_change_notify(XEvent *e)
|
||||
{
|
||||
XRRUpdateConfiguration(e);
|
||||
}
|
||||
|
||||
void
|
||||
grabkeys(awesome_config *awesomeconf, int phys_screen)
|
||||
grabkeys(int phys_screen)
|
||||
{
|
||||
Key *k;
|
||||
KeyCode code;
|
||||
|
||||
XUngrabKey(awesomeconf->display, AnyKey, AnyModifier, RootWindow(awesomeconf->display, phys_screen));
|
||||
for(k = awesomeconf->keys; k; k = k->next)
|
||||
XUngrabKey(globalconf.display, AnyKey, AnyModifier, RootWindow(globalconf.display, phys_screen));
|
||||
for(k = globalconf.keys; k; k = k->next)
|
||||
{
|
||||
if((code = XKeysymToKeycode(awesomeconf->display, k->keysym)) == NoSymbol)
|
||||
if((code = XKeysymToKeycode(globalconf.display, k->keysym)) == NoSymbol)
|
||||
continue;
|
||||
XGrabKey(awesomeconf->display, code, k->mod, RootWindow(awesomeconf->display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(awesomeconf->display, code, k->mod | LockMask, RootWindow(awesomeconf->display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(awesomeconf->display, code, k->mod | awesomeconf->numlockmask, RootWindow(awesomeconf->display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(awesomeconf->display, code, k->mod | awesomeconf->numlockmask | LockMask, RootWindow(awesomeconf->display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(globalconf.display, code, k->mod, RootWindow(globalconf.display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(globalconf.display, code, k->mod | LockMask, RootWindow(globalconf.display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(globalconf.display, code, k->mod | globalconf.numlockmask, RootWindow(globalconf.display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(globalconf.display, code, k->mod | globalconf.numlockmask | LockMask, RootWindow(globalconf.display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
}
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
30
event.h
30
event.h
|
@ -24,22 +24,22 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
void grabkeys(awesome_config *, int);
|
||||
void grabkeys(int);
|
||||
|
||||
void handle_event_buttonpress(XEvent *, awesome_config *);
|
||||
void handle_event_configurerequest(XEvent *, awesome_config *);
|
||||
void handle_event_configurenotify(XEvent *, awesome_config *);
|
||||
void handle_event_destroynotify(XEvent *, awesome_config *);
|
||||
void handle_event_enternotify(XEvent *, awesome_config *);
|
||||
void handle_event_expose(XEvent *, awesome_config *);
|
||||
void handle_event_keypress(XEvent *, awesome_config *);
|
||||
void handle_event_leavenotify(XEvent *, awesome_config *);
|
||||
void handle_event_mappingnotify(XEvent *, awesome_config *);
|
||||
void handle_event_maprequest(XEvent *, awesome_config *);
|
||||
void handle_event_propertynotify(XEvent *, awesome_config *);
|
||||
void handle_event_unmapnotify(XEvent *, awesome_config *);
|
||||
void handle_event_shape(XEvent *, awesome_config *);
|
||||
void handle_event_randr_screen_change_notify(XEvent *, awesome_config *);
|
||||
void handle_event_buttonpress(XEvent *);
|
||||
void handle_event_configurerequest(XEvent *);
|
||||
void handle_event_configurenotify(XEvent *);
|
||||
void handle_event_destroynotify(XEvent *);
|
||||
void handle_event_enternotify(XEvent *);
|
||||
void handle_event_expose(XEvent *);
|
||||
void handle_event_keypress(XEvent *);
|
||||
void handle_event_leavenotify(XEvent *);
|
||||
void handle_event_mappingnotify(XEvent *);
|
||||
void handle_event_maprequest(XEvent *);
|
||||
void handle_event_propertynotify(XEvent *);
|
||||
void handle_event_unmapnotify(XEvent *);
|
||||
void handle_event_shape(XEvent *);
|
||||
void handle_event_randr_screen_change_notify(XEvent *);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
20
focus.c
20
focus.c
|
@ -24,6 +24,8 @@
|
|||
#include "layout.h"
|
||||
#include "focus.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
static FocusList *
|
||||
focus_get_node_by_client(FocusList *head, Client *c)
|
||||
{
|
||||
|
@ -93,25 +95,23 @@ focus_delete_client(FocusList **head, Client *c)
|
|||
}
|
||||
|
||||
Client *
|
||||
focus_get_latest_client_for_tag(FocusList *head, TagClientLink *tc, Tag *t)
|
||||
focus_get_latest_client_for_tag(FocusList *head, int screen, Tag *t)
|
||||
{
|
||||
FocusList *fl;
|
||||
|
||||
for(fl = head; fl; fl = fl->prev)
|
||||
if(is_client_tagged(tc, fl->client, t))
|
||||
if(is_client_tagged(fl->client, t, screen))
|
||||
return fl->client;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
uicb_focus_history(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_focus_history(int screen, const char *arg)
|
||||
{
|
||||
int i;
|
||||
FocusList *fl = awesomeconf->focus;
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen]);
|
||||
FocusList *fl = globalconf.focus;
|
||||
Tag *curtag = get_current_tag(screen);
|
||||
|
||||
if(arg)
|
||||
{
|
||||
|
@ -120,12 +120,10 @@ uicb_focus_history(awesome_config *awesomeconf,
|
|||
if(i < 0)
|
||||
{
|
||||
for(; fl && i < 0; fl = fl->prev)
|
||||
if(is_client_tagged(awesomeconf->screens[screen].tclink,
|
||||
fl->client,
|
||||
curtag))
|
||||
if(is_client_tagged(fl->client, curtag, screen))
|
||||
i++;
|
||||
if(fl)
|
||||
focus(fl->client, True, awesomeconf, screen);
|
||||
focus(fl->client, True, screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2
focus.h
2
focus.h
|
@ -26,7 +26,7 @@
|
|||
|
||||
void focus_add_client(FocusList **, Client *);
|
||||
void focus_delete_client(FocusList **, Client *);
|
||||
Client * focus_get_latest_client_for_tag(FocusList *, TagClientLink *, Tag *);
|
||||
Client * focus_get_latest_client_for_tag(FocusList *, int, Tag *);
|
||||
|
||||
UICB_PROTO(uicb_focus_history);
|
||||
|
||||
|
|
194
layout.c
194
layout.c
|
@ -31,16 +31,18 @@
|
|||
#include "statusbar.h"
|
||||
#include "layouts/floating.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
/** Find the index of the first currently selected tag
|
||||
* \param screen the screen to search
|
||||
* \return tag
|
||||
*/
|
||||
Tag *
|
||||
get_current_tag(VirtScreen screen)
|
||||
get_current_tag(int screen)
|
||||
{
|
||||
Tag *tag;
|
||||
|
||||
for(tag = screen.tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
if(tag->selected)
|
||||
return tag;
|
||||
|
||||
|
@ -49,31 +51,30 @@ get_current_tag(VirtScreen screen)
|
|||
|
||||
/** Arrange windows following current selected layout
|
||||
* \param disp display ref
|
||||
* \param awesomeconf awesome config
|
||||
*/
|
||||
void
|
||||
arrange(awesome_config *awesomeconf, int screen)
|
||||
arrange(int screen)
|
||||
{
|
||||
Client *c;
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen]);
|
||||
Tag *curtag = get_current_tag(screen);
|
||||
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
{
|
||||
if(client_isvisible(c, &awesomeconf->screens[screen], screen))
|
||||
if(client_isvisible(c, screen))
|
||||
client_unban(c);
|
||||
/* we don't touch other screens windows */
|
||||
else if(c->screen == screen)
|
||||
client_ban(c);
|
||||
}
|
||||
|
||||
curtag->layout->arrange(awesomeconf, screen);
|
||||
focus(focus_get_latest_client_for_tag(awesomeconf->focus, awesomeconf->screens[screen].tclink, curtag),
|
||||
True, awesomeconf, screen);
|
||||
restack(awesomeconf, screen);
|
||||
curtag->layout->arrange(screen);
|
||||
focus(focus_get_latest_client_for_tag(globalconf.focus, screen, curtag),
|
||||
True, screen);
|
||||
restack(screen);
|
||||
}
|
||||
|
||||
Layout *
|
||||
get_current_layout(VirtScreen screen)
|
||||
get_current_layout(int screen)
|
||||
{
|
||||
Tag *curtag;
|
||||
|
||||
|
@ -84,62 +85,58 @@ get_current_layout(VirtScreen screen)
|
|||
}
|
||||
|
||||
void
|
||||
uicb_client_focusnext(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_client_focusnext(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *c, *sel = awesomeconf->focus->client;
|
||||
Client *c, *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
for(c = sel->next; c && !client_isvisible(c, &awesomeconf->screens[screen], screen); c = c->next);
|
||||
for(c = sel->next; c && !client_isvisible(c, screen); c = c->next);
|
||||
if(!c)
|
||||
for(c = awesomeconf->clients; c && !client_isvisible(c, &awesomeconf->screens[screen], screen); c = c->next);
|
||||
for(c = globalconf.clients; c && !client_isvisible(c, screen); c = c->next);
|
||||
if(c)
|
||||
{
|
||||
focus(c, True, awesomeconf, screen);
|
||||
restack(awesomeconf, screen);
|
||||
focus(c, True, screen);
|
||||
restack(screen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_focusprev(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_client_focusprev(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *c, *sel = awesomeconf->focus->client;
|
||||
Client *c, *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
for(c = sel->prev; c && !client_isvisible(c, &awesomeconf->screens[screen], screen); c = c->prev);
|
||||
for(c = sel->prev; c && !client_isvisible(c, screen); c = c->prev);
|
||||
if(!c)
|
||||
{
|
||||
for(c = awesomeconf->clients; c && c->next; c = c->next);
|
||||
for(; c && !client_isvisible(c, &awesomeconf->screens[screen], screen); c = c->prev);
|
||||
for(c = globalconf.clients; c && c->next; c = c->next);
|
||||
for(; c && !client_isvisible(c, screen); c = c->prev);
|
||||
}
|
||||
if(c)
|
||||
{
|
||||
focus(c, True, awesomeconf, screen);
|
||||
restack(awesomeconf, screen);
|
||||
focus(c, True, screen);
|
||||
restack(screen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
loadawesomeprops(awesome_config *awesomeconf, int screen)
|
||||
loadawesomeprops(int screen)
|
||||
{
|
||||
int i, ntags = 0;
|
||||
char *prop;
|
||||
Tag *tag;
|
||||
|
||||
for(tag = awesomeconf->screens[screen].tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
ntags++;
|
||||
|
||||
prop = p_new(char, ntags + 1);
|
||||
|
||||
if(xgettextprop(awesomeconf->display,
|
||||
RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)),
|
||||
AWESOMEPROPS_ATOM(awesomeconf->display), prop, ntags + 1))
|
||||
for(i = 0, tag = awesomeconf->screens[screen].tags; tag && prop[i]; i++, tag = tag->next)
|
||||
if(xgettextprop(globalconf.display,
|
||||
RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)),
|
||||
AWESOMEPROPS_ATOM(globalconf.display), prop, ntags + 1))
|
||||
for(i = 0, tag = globalconf.screens[screen].tags; tag && prop[i]; i++, tag = tag->next)
|
||||
if(prop[i] == '1')
|
||||
tag->selected = True;
|
||||
else
|
||||
|
@ -149,106 +146,104 @@ loadawesomeprops(awesome_config *awesomeconf, int screen)
|
|||
}
|
||||
|
||||
void
|
||||
restack(awesome_config *awesomeconf, int screen)
|
||||
restack(int screen)
|
||||
{
|
||||
Client *c, *sel = awesomeconf->focus->client;
|
||||
Client *c, *sel = globalconf.focus->client;
|
||||
XEvent ev;
|
||||
XWindowChanges wc;
|
||||
|
||||
statusbar_draw(awesomeconf, screen);
|
||||
statusbar_draw(screen);
|
||||
if(!sel)
|
||||
return;
|
||||
if(awesomeconf->screens[screen].allow_lower_floats)
|
||||
XRaiseWindow(awesomeconf->display, sel->win);
|
||||
if(globalconf.screens[screen].allow_lower_floats)
|
||||
XRaiseWindow(globalconf.display, sel->win);
|
||||
else
|
||||
{
|
||||
if(sel->isfloating ||
|
||||
get_current_layout(awesomeconf->screens[screen])->arrange == layout_floating)
|
||||
get_current_layout(screen)->arrange == layout_floating)
|
||||
XRaiseWindow(sel->display, sel->win);
|
||||
if(!(get_current_layout(awesomeconf->screens[screen])->arrange == layout_floating))
|
||||
if(!(get_current_layout(screen)->arrange == layout_floating))
|
||||
{
|
||||
wc.stack_mode = Below;
|
||||
wc.sibling = awesomeconf->screens[screen].statusbar.window;
|
||||
wc.sibling = globalconf.screens[screen].statusbar.window;
|
||||
if(!sel->isfloating)
|
||||
{
|
||||
XConfigureWindow(sel->display, sel->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = sel->win;
|
||||
}
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
{
|
||||
if(!IS_TILED(c, &awesomeconf->screens[screen], screen) || c == sel)
|
||||
if(!IS_TILED(c, screen) || c == sel)
|
||||
continue;
|
||||
XConfigureWindow(awesomeconf->display, c->win, CWSibling | CWStackMode, &wc);
|
||||
XConfigureWindow(globalconf.display, c->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = c->win;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(awesomeconf->screens[screen].focus_move_pointer)
|
||||
XWarpPointer(awesomeconf->display, None, sel->win, 0, 0, 0, 0, sel->w / 2, sel->h / 2);
|
||||
XSync(awesomeconf->display, False);
|
||||
while(XCheckMaskEvent(awesomeconf->display, EnterWindowMask, &ev));
|
||||
if(globalconf.screens[screen].focus_move_pointer)
|
||||
XWarpPointer(globalconf.display, None, sel->win, 0, 0, 0, 0, sel->w / 2, sel->h / 2);
|
||||
XSync(globalconf.display, False);
|
||||
while(XCheckMaskEvent(globalconf.display, EnterWindowMask, &ev));
|
||||
}
|
||||
|
||||
void
|
||||
saveawesomeprops(awesome_config *awesomeconf, int screen)
|
||||
saveawesomeprops(int screen)
|
||||
{
|
||||
int i, ntags = 0;
|
||||
char *prop;
|
||||
Tag *tag;
|
||||
|
||||
for(tag = awesomeconf->screens[screen].tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
ntags++;
|
||||
|
||||
prop = p_new(char, ntags + 1);
|
||||
|
||||
for(i = 0, tag = awesomeconf->screens[screen].tags; tag; tag = tag->next, i++)
|
||||
for(i = 0, tag = globalconf.screens[screen].tags; tag; tag = tag->next, i++)
|
||||
prop[i] = tag->selected ? '1' : '0';
|
||||
|
||||
prop[i] = '\0';
|
||||
XChangeProperty(awesomeconf->display,
|
||||
RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)),
|
||||
AWESOMEPROPS_ATOM(awesomeconf->display), XA_STRING, 8,
|
||||
XChangeProperty(globalconf.display,
|
||||
RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)),
|
||||
AWESOMEPROPS_ATOM(globalconf.display), XA_STRING, 8,
|
||||
PropModeReplace, (unsigned char *) prop, i);
|
||||
p_delete(&prop);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_tag_setlayout(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_tag_setlayout(int screen, const char *arg)
|
||||
{
|
||||
Layout *l = awesomeconf->screens[screen].layouts;
|
||||
Layout *l = globalconf.screens[screen].layouts;
|
||||
Tag *tag;
|
||||
int i;
|
||||
|
||||
if(arg)
|
||||
{
|
||||
for(i = 0; l && l != get_current_layout(awesomeconf->screens[screen]); i++, l = l->next);
|
||||
for(i = 0; l && l != get_current_layout(screen); i++, l = l->next);
|
||||
if(!l)
|
||||
i = 0;
|
||||
for(i = compute_new_value_from_arg(arg, (double) i),
|
||||
l = awesomeconf->screens[screen].layouts; l && i > 0; i--)
|
||||
l = globalconf.screens[screen].layouts; l && i > 0; i--)
|
||||
l = l->next;
|
||||
if(!l)
|
||||
l = awesomeconf->screens[screen].layouts;
|
||||
l = globalconf.screens[screen].layouts;
|
||||
}
|
||||
|
||||
for(tag = awesomeconf->screens[screen].tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
if(tag->selected)
|
||||
tag->layout = l;
|
||||
|
||||
if(awesomeconf->focus->client)
|
||||
arrange(awesomeconf, screen);
|
||||
if(globalconf.focus->client)
|
||||
arrange(screen);
|
||||
else
|
||||
statusbar_draw(awesomeconf, screen);
|
||||
statusbar_draw(screen);
|
||||
|
||||
saveawesomeprops(awesomeconf, screen);
|
||||
saveawesomeprops(screen);
|
||||
}
|
||||
|
||||
static void
|
||||
maximize(int x, int y, int w, int h, awesome_config *awesomeconf, int screen)
|
||||
maximize(int x, int y, int w, int h, int screen)
|
||||
{
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
@ -257,83 +252,76 @@ maximize(int x, int y, int w, int h, awesome_config *awesomeconf, int screen)
|
|||
{
|
||||
sel->wasfloating = sel->isfloating;
|
||||
sel->isfloating = True;
|
||||
client_resize(sel, x, y, w, h, awesomeconf, True, !sel->isfloating);
|
||||
client_resize(sel, x, y, w, h, True, !sel->isfloating);
|
||||
}
|
||||
else if(sel->wasfloating)
|
||||
client_resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True, False);
|
||||
client_resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True, False);
|
||||
else
|
||||
sel->isfloating = False;
|
||||
|
||||
arrange(awesomeconf, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_togglemax(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_client_togglemax(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||
|
||||
maximize(si[screen].x_org, si[screen].y_org,
|
||||
si[screen].width - 2 * awesomeconf->screens[screen].borderpx,
|
||||
si[screen].height - 2 * awesomeconf->screens[screen].borderpx,
|
||||
awesomeconf, screen);
|
||||
si[screen].width - 2 * globalconf.screens[screen].borderpx,
|
||||
si[screen].height - 2 * globalconf.screens[screen].borderpx,
|
||||
screen);
|
||||
p_delete(&si);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_toggleverticalmax(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_client_toggleverticalmax(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
Client *sel = globalconf.focus->client;
|
||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||
|
||||
if(sel)
|
||||
maximize(sel->x,
|
||||
si[screen].y_org,
|
||||
sel->w,
|
||||
si[screen].height - 2 * awesomeconf->screens[screen].borderpx,
|
||||
awesomeconf, screen);
|
||||
si[screen].height - 2 * globalconf.screens[screen].borderpx,
|
||||
screen);
|
||||
p_delete(&si);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
uicb_client_togglehorizontalmax(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_client_togglehorizontalmax(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
Client *sel = globalconf.focus->client;
|
||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||
|
||||
if(sel)
|
||||
maximize(si[screen].x_org,
|
||||
sel->y,
|
||||
si[screen].height - 2 * awesomeconf->screens[screen].borderpx,
|
||||
si[screen].height - 2 * globalconf.screens[screen].borderpx,
|
||||
sel->h,
|
||||
awesomeconf, screen);
|
||||
screen);
|
||||
p_delete(&si);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_zoom(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
uicb_client_zoom(int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(awesomeconf->clients == sel)
|
||||
for(sel = sel->next; sel && !client_isvisible(sel, &awesomeconf->screens[screen], screen); sel = sel->next);
|
||||
if(globalconf.clients == sel)
|
||||
for(sel = sel->next; sel && !client_isvisible(sel, screen); sel = sel->next);
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
client_detach(&awesomeconf->clients, sel);
|
||||
client_attach(&awesomeconf->clients, sel);
|
||||
client_detach(sel);
|
||||
client_attach(sel);
|
||||
|
||||
focus(sel, True, awesomeconf, screen);
|
||||
arrange(awesomeconf, screen);
|
||||
focus(sel, True, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
12
layout.h
12
layout.h
|
@ -26,12 +26,12 @@
|
|||
|
||||
#define AWESOMEPROPS_ATOM(disp) XInternAtom(disp, "_AWESOME_PROPERTIES", False)
|
||||
|
||||
void arrange(awesome_config *, int);
|
||||
Layout * get_current_layout(VirtScreen);
|
||||
Tag * get_current_tag(VirtScreen);
|
||||
void restack(awesome_config *, int);
|
||||
void loadawesomeprops(awesome_config *, int);
|
||||
void saveawesomeprops(awesome_config *, int);
|
||||
void arrange(int);
|
||||
Layout * get_current_layout(int);
|
||||
Tag * get_current_tag(int);
|
||||
void restack(int);
|
||||
void loadawesomeprops(int);
|
||||
void saveawesomeprops(int);
|
||||
|
||||
UICB_PROTO(uicb_client_focusnext);
|
||||
UICB_PROTO(uicb_client_focusprev);
|
||||
|
|
|
@ -24,25 +24,27 @@
|
|||
#include "util.h"
|
||||
#include "layouts/fibonacci.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
static void
|
||||
layout_fibonacci(awesome_config *awesomeconf, int screen, int shape)
|
||||
layout_fibonacci(int screen, int shape)
|
||||
{
|
||||
int n = 0, i = 0, nx, ny, nw, nh;
|
||||
Client *c;
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, screen,
|
||||
&awesomeconf->screens[screen].statusbar,
|
||||
&awesomeconf->screens[screen].padding);
|
||||
ScreenInfo *si = get_screen_info(globalconf.display, screen,
|
||||
&globalconf.screens[screen].statusbar,
|
||||
&globalconf.screens[screen].padding);
|
||||
|
||||
nx = si[screen].x_org;
|
||||
ny = si[screen].y_org;
|
||||
nw = si[screen].width;
|
||||
nh = si[screen].height;
|
||||
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
if(IS_TILED(c, &awesomeconf->screens[screen], screen))
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if(IS_TILED(c, screen))
|
||||
n++;
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
if(IS_TILED(c, &awesomeconf->screens[screen], screen))
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if(IS_TILED(c, screen))
|
||||
{
|
||||
c->ismax = False;
|
||||
if((i % 2 && nh / 2 > 2 * c->border)
|
||||
|
@ -81,22 +83,22 @@ layout_fibonacci(awesome_config *awesomeconf, int screen, int shape)
|
|||
ny = si[screen].y_org;
|
||||
i++;
|
||||
}
|
||||
client_resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, awesomeconf,
|
||||
awesomeconf->screens[screen].resize_hints, False);
|
||||
client_resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border,
|
||||
globalconf.screens[screen].resize_hints, False);
|
||||
}
|
||||
p_delete(&si);
|
||||
}
|
||||
|
||||
void
|
||||
layout_spiral(awesome_config *awesomeconf, int screen)
|
||||
layout_spiral(int screen)
|
||||
{
|
||||
layout_fibonacci(awesomeconf, screen, 0);
|
||||
layout_fibonacci(screen, 0);
|
||||
}
|
||||
|
||||
void
|
||||
layout_dwindle(awesome_config *awesomeconf, int screen)
|
||||
layout_dwindle(int screen)
|
||||
{
|
||||
layout_fibonacci(awesomeconf, screen, 1);
|
||||
layout_fibonacci(screen, 1);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
|
@ -22,13 +22,15 @@
|
|||
#include "tag.h"
|
||||
#include "layouts/floating.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
void
|
||||
layout_floating(awesome_config *awesomeconf, int screen)
|
||||
layout_floating(int screen)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
if(client_isvisible(c, &awesomeconf->screens[screen], screen))
|
||||
client_resize(c, c->rx, c->ry, c->rw, c->rh, awesomeconf, True, False);
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if(client_isvisible(c, screen))
|
||||
client_resize(c, c->rx, c->ry, c->rw, c->rh, True, False);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
|
@ -24,17 +24,19 @@
|
|||
#include "util.h"
|
||||
#include "layouts/max.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
void
|
||||
layout_max(awesome_config *awesomeconf, int screen)
|
||||
layout_max(int screen)
|
||||
{
|
||||
Client *c;
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
if(IS_TILED(c, &awesomeconf->screens[screen], screen))
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if(IS_TILED(c, screen))
|
||||
client_resize(c, si[screen].x_org, si[screen].y_org,
|
||||
si[screen].width - 2 * c->border,
|
||||
si[screen].height - 2 * c->border, awesomeconf, awesomeconf->screens[screen].resize_hints, False);
|
||||
si[screen].height - 2 * c->border, globalconf.screens[screen].resize_hints, False);
|
||||
p_delete(&si);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
#include "layout.h"
|
||||
#include "layouts/tile.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
void
|
||||
uicb_tag_setnmaster(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char * arg)
|
||||
uicb_tag_setnmaster(int screen, const char * arg)
|
||||
{
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen]);
|
||||
Tag *curtag = get_current_tag(screen);
|
||||
Layout *curlay = curtag->layout;
|
||||
|
||||
if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft))
|
||||
|
@ -42,15 +42,13 @@ uicb_tag_setnmaster(awesome_config *awesomeconf,
|
|||
if((curtag->nmaster = (int) compute_new_value_from_arg(arg, (double) curtag->nmaster)) < 0)
|
||||
curtag->nmaster = 0;
|
||||
|
||||
arrange(awesomeconf, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_tag_setncol(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char * arg)
|
||||
uicb_tag_setncol(int screen, const char * arg)
|
||||
{
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen]);
|
||||
Tag *curtag = get_current_tag(screen);
|
||||
Layout *curlay = curtag->layout;
|
||||
|
||||
if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft))
|
||||
|
@ -59,16 +57,14 @@ uicb_tag_setncol(awesome_config *awesomeconf,
|
|||
if((curtag->ncol = (int) compute_new_value_from_arg(arg, (double) curtag->ncol)) < 1)
|
||||
curtag->ncol = 1;
|
||||
|
||||
arrange(awesomeconf, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_tag_setmwfact(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_tag_setmwfact(int screen, const char *arg)
|
||||
{
|
||||
char *newarg;
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen]);
|
||||
Tag *curtag = get_current_tag(screen);
|
||||
Layout *curlay = curtag->layout;
|
||||
|
||||
if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft))
|
||||
|
@ -88,12 +84,12 @@ uicb_tag_setmwfact(awesome_config * awesomeconf,
|
|||
else if(curtag->mwfact > 0.9)
|
||||
curtag->mwfact = 0.9;
|
||||
|
||||
arrange(awesomeconf, screen);
|
||||
arrange(screen);
|
||||
p_delete(&newarg);
|
||||
}
|
||||
|
||||
static void
|
||||
_tile(awesome_config *awesomeconf, int screen, const Bool right)
|
||||
_tile(int screen, const Bool right)
|
||||
{
|
||||
/* windows area geometry */
|
||||
int wah = 0, waw = 0, wax = 0, way = 0;
|
||||
|
@ -105,12 +101,12 @@ _tile(awesome_config *awesomeconf, int screen, const Bool right)
|
|||
int real_ncol = 1, win_by_col = 1, current_col = 0;
|
||||
ScreenInfo *screens_info = NULL;
|
||||
Client *c;
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen]);
|
||||
Tag *curtag = get_current_tag(screen);
|
||||
|
||||
screens_info = get_screen_info(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
screens_info = get_screen_info(globalconf.display, screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||
|
||||
for(n = 0, c = awesomeconf->clients; c; c = c->next)
|
||||
if(IS_TILED(c, &awesomeconf->screens[screen], screen))
|
||||
for(n = 0, c = globalconf.clients; c; c = c->next)
|
||||
if(IS_TILED(c, screen))
|
||||
n++;
|
||||
|
||||
wah = screens_info[screen].height;
|
||||
|
@ -135,9 +131,9 @@ _tile(awesome_config *awesomeconf, int screen, const Bool right)
|
|||
|
||||
real_ncol = MIN(otherwin, curtag->ncol);
|
||||
|
||||
for(i = 0, c = awesomeconf->clients; c; c = c->next)
|
||||
for(i = 0, c = globalconf.clients; c; c = c->next)
|
||||
{
|
||||
if(!IS_TILED(c, &awesomeconf->screens[screen], screen))
|
||||
if(!IS_TILED(c, screen))
|
||||
continue;
|
||||
|
||||
c->ismax = False;
|
||||
|
@ -145,7 +141,7 @@ _tile(awesome_config *awesomeconf, int screen, const Bool right)
|
|||
{ /* master */
|
||||
ny = way + i * mh;
|
||||
nx = wax + (right ? 0 : waw - mw);
|
||||
client_resize(c, nx, ny, mw - 2 * c->border, mh - 2 * c->border, awesomeconf, awesomeconf->screens[screen].resize_hints, False);
|
||||
client_resize(c, nx, ny, mw - 2 * c->border, mh - 2 * c->border, globalconf.screens[screen].resize_hints, False);
|
||||
}
|
||||
else
|
||||
{ /* tile window */
|
||||
|
@ -171,7 +167,7 @@ _tile(awesome_config *awesomeconf, int screen, const Bool right)
|
|||
ny = way + ((i - curtag->nmaster) % win_by_col) * (nh + 2 * c->border);
|
||||
|
||||
nx = wax + current_col * (nw + 2 * c->border) + (right ? mw : 0);
|
||||
client_resize(c, nx, ny, nw, nh, awesomeconf, awesomeconf->screens[screen].resize_hints, False);
|
||||
client_resize(c, nx, ny, nw, nh, globalconf.screens[screen].resize_hints, False);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@ -179,15 +175,15 @@ _tile(awesome_config *awesomeconf, int screen, const Bool right)
|
|||
}
|
||||
|
||||
void
|
||||
layout_tile(awesome_config *awesomeconf, int screen)
|
||||
layout_tile(int screen)
|
||||
{
|
||||
_tile(awesomeconf, screen, True);
|
||||
_tile(screen, True);
|
||||
}
|
||||
|
||||
void
|
||||
layout_tileleft(awesome_config *awesomeconf, int screen)
|
||||
layout_tileleft(int screen)
|
||||
{
|
||||
_tile(awesomeconf, screen, False);
|
||||
_tile(screen, False);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
52
mouse.c
52
mouse.c
|
@ -28,31 +28,33 @@
|
|||
#include "window.h"
|
||||
#include "layouts/floating.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
void
|
||||
uicb_client_movemouse(awesome_config *awesomeconf, int screen, const char *arg __attribute__ ((unused)))
|
||||
uicb_client_movemouse(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
int x1, y1, ocx, ocy, di, nx, ny;
|
||||
unsigned int dui;
|
||||
Window dummy;
|
||||
XEvent ev;
|
||||
ScreenInfo *si;
|
||||
Client *c = awesomeconf->focus->client;
|
||||
Client *c = globalconf.focus->client;
|
||||
|
||||
if(!c)
|
||||
return;
|
||||
|
||||
if((get_current_layout(awesomeconf->screens[screen])->arrange != layout_floating)
|
||||
if((get_current_layout(screen)->arrange != layout_floating)
|
||||
&& !c->isfloating)
|
||||
uicb_client_togglefloating(awesomeconf, screen, "DUMMY");
|
||||
uicb_client_togglefloating(screen, "DUMMY");
|
||||
else
|
||||
restack(awesomeconf, screen);
|
||||
restack(screen);
|
||||
|
||||
si = get_screen_info(c->display, c->screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
si = get_screen_info(c->display, c->screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||
|
||||
ocx = nx = c->x;
|
||||
ocy = ny = c->y;
|
||||
if(XGrabPointer(c->display, RootWindow(c->display, c->phys_screen), False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||
None, awesomeconf->cursor[CurMove], CurrentTime) != GrabSuccess)
|
||||
None, globalconf.cursor[CurMove], CurrentTime) != GrabSuccess)
|
||||
return;
|
||||
XQueryPointer(c->display, RootWindow(c->display, c->phys_screen), &dummy, &dummy, &x1, &y1, &di, &di, &dui);
|
||||
for(;;)
|
||||
|
@ -65,53 +67,53 @@ uicb_client_movemouse(awesome_config *awesomeconf, int screen, const char *arg _
|
|||
p_delete(&si);
|
||||
return;
|
||||
case ConfigureRequest:
|
||||
handle_event_configurerequest(&ev, awesomeconf);
|
||||
handle_event_configurerequest(&ev);
|
||||
break;
|
||||
case Expose:
|
||||
handle_event_expose(&ev, awesomeconf);
|
||||
handle_event_expose(&ev);
|
||||
break;
|
||||
case MapRequest:
|
||||
handle_event_maprequest(&ev, awesomeconf);
|
||||
handle_event_maprequest(&ev);
|
||||
break;
|
||||
case MotionNotify:
|
||||
XSync(c->display, False);
|
||||
nx = ocx + (ev.xmotion.x - x1);
|
||||
ny = ocy + (ev.xmotion.y - y1);
|
||||
if(abs(nx) < awesomeconf->screens[screen].snap + si[c->screen].x_org && nx > si[c->screen].x_org)
|
||||
if(abs(nx) < globalconf.screens[screen].snap + si[c->screen].x_org && nx > si[c->screen].x_org)
|
||||
nx = si[c->screen].x_org;
|
||||
else if(abs((si[c->screen].x_org + si[c->screen].width) - (nx + c->w + 2 * c->border)) < awesomeconf->screens[screen].snap)
|
||||
else if(abs((si[c->screen].x_org + si[c->screen].width) - (nx + c->w + 2 * c->border)) < globalconf.screens[screen].snap)
|
||||
nx = si[c->screen].x_org + si[c->screen].width - c->w - 2 * c->border;
|
||||
if(abs(ny) < awesomeconf->screens[screen].snap + si[c->screen].y_org && ny > si[c->screen].y_org)
|
||||
if(abs(ny) < globalconf.screens[screen].snap + si[c->screen].y_org && ny > si[c->screen].y_org)
|
||||
ny = si[c->screen].y_org;
|
||||
else if(abs((si[c->screen].y_org + si[c->screen].height) - (ny + c->h + 2 * c->border)) < awesomeconf->screens[screen].snap)
|
||||
else if(abs((si[c->screen].y_org + si[c->screen].height) - (ny + c->h + 2 * c->border)) < globalconf.screens[screen].snap)
|
||||
ny = si[c->screen].y_org + si[c->screen].height - c->h - 2 * c->border;
|
||||
client_resize(c, nx, ny, c->w, c->h, awesomeconf, False, False);
|
||||
client_resize(c, nx, ny, c->w, c->h, False, False);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_resizemouse(awesome_config *awesomeconf, int screen, const char *arg __attribute__ ((unused)))
|
||||
uicb_client_resizemouse(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
int ocx, ocy, nw, nh;
|
||||
XEvent ev;
|
||||
Client *c = awesomeconf->focus->client;
|
||||
Client *c = globalconf.focus->client;
|
||||
|
||||
if(!c)
|
||||
return;
|
||||
|
||||
if((get_current_layout(awesomeconf->screens[screen])->arrange != layout_floating)
|
||||
if((get_current_layout(screen)->arrange != layout_floating)
|
||||
&& !c->isfloating)
|
||||
uicb_client_togglefloating(awesomeconf, screen, "DUMMY");
|
||||
uicb_client_togglefloating(screen, "DUMMY");
|
||||
else
|
||||
restack(awesomeconf, screen);
|
||||
restack(screen);
|
||||
|
||||
ocx = c->x;
|
||||
ocy = c->y;
|
||||
if(XGrabPointer(c->display, RootWindow(c->display, c->phys_screen),
|
||||
False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||
None, awesomeconf->cursor[CurResize], CurrentTime) != GrabSuccess)
|
||||
None, globalconf.cursor[CurResize], CurrentTime) != GrabSuccess)
|
||||
return;
|
||||
c->ismax = False;
|
||||
XWarpPointer(c->display, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1);
|
||||
|
@ -126,13 +128,13 @@ uicb_client_resizemouse(awesome_config *awesomeconf, int screen, const char *arg
|
|||
while(XCheckMaskEvent(c->display, EnterWindowMask, &ev));
|
||||
return;
|
||||
case ConfigureRequest:
|
||||
handle_event_configurerequest(&ev, awesomeconf);
|
||||
handle_event_configurerequest(&ev);
|
||||
break;
|
||||
case Expose:
|
||||
handle_event_expose(&ev, awesomeconf);
|
||||
handle_event_expose(&ev);
|
||||
break;
|
||||
case MapRequest:
|
||||
handle_event_maprequest(&ev, awesomeconf);
|
||||
handle_event_maprequest(&ev);
|
||||
break;
|
||||
case MotionNotify:
|
||||
XSync(c->display, False);
|
||||
|
@ -140,7 +142,7 @@ uicb_client_resizemouse(awesome_config *awesomeconf, int screen, const char *arg
|
|||
nw = 1;
|
||||
if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0)
|
||||
nh = 1;
|
||||
client_resize(c, c->x, c->y, nw, nh, awesomeconf, True, False);
|
||||
client_resize(c, c->x, c->y, nw, nh, True, False);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
55
screen.c
55
screen.c
|
@ -26,6 +26,8 @@
|
|||
#include "focus.h"
|
||||
#include "statusbar.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
/** Get screens info
|
||||
* \param disp Display ref
|
||||
* \param screen Screen number
|
||||
|
@ -173,21 +175,20 @@ get_phys_screen(Display *disp, int screen)
|
|||
|
||||
/** Move a client to a virtual screen
|
||||
* \param c the client
|
||||
* \param acf_new the awesome_config for the new screen
|
||||
* \param doresize set to True if we also move the client to the new x_org and
|
||||
* y_org of the new screen
|
||||
*/
|
||||
void
|
||||
move_client_to_screen(Client *c, awesome_config *awesomeconf, int new_screen, Bool doresize)
|
||||
move_client_to_screen(Client *c, int new_screen, Bool doresize)
|
||||
{
|
||||
Tag *tag;
|
||||
int old_screen = c->screen;
|
||||
|
||||
for(tag = awesomeconf->screens[old_screen].tags; tag; tag = tag->next)
|
||||
untag_client(&awesomeconf->screens[old_screen].tclink, c, tag);
|
||||
for(tag = globalconf.screens[old_screen].tags; tag; tag = tag->next)
|
||||
untag_client(c, tag, old_screen);
|
||||
|
||||
/* tag client with new screen tags */
|
||||
tag_client_with_current_selected(c, &awesomeconf->screens[new_screen]);
|
||||
tag_client_with_current_selected(c, new_screen);
|
||||
|
||||
c->screen = new_screen;
|
||||
|
||||
|
@ -211,17 +212,17 @@ move_client_to_screen(Client *c, awesome_config *awesomeconf, int new_screen, Bo
|
|||
if(c->ry + c->rh >= si[c->screen].y_org + si[c->screen].height)
|
||||
c->ry = si[c->screen].y_org + si[c->screen].height - c->rh - 2 * c->border;
|
||||
|
||||
client_resize(c, c->rx, c->ry, c->rw, c->rh, awesomeconf, True, False);
|
||||
client_resize(c, c->rx, c->ry, c->rw, c->rh, True, False);
|
||||
|
||||
p_delete(&si);
|
||||
p_delete(&si_old);
|
||||
}
|
||||
|
||||
focus(c, True, awesomeconf, c->screen);
|
||||
focus(c, True, c->screen);
|
||||
|
||||
/* redraw statusbar on all screens */
|
||||
statusbar_draw(awesomeconf, old_screen);
|
||||
statusbar_draw(awesomeconf, new_screen);
|
||||
statusbar_draw(old_screen);
|
||||
statusbar_draw(new_screen);
|
||||
}
|
||||
|
||||
/** Move mouse pointer to x_org and y_xorg of specified screen
|
||||
|
@ -243,14 +244,13 @@ move_mouse_pointer_to_screen(Display *disp, int screen)
|
|||
|
||||
|
||||
/** Switch focus to a specified screen
|
||||
* \param awesomeconf awesome config ref
|
||||
* \param arg screen number
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_screen_focus(awesome_config *awesomeconf, int screen, const char *arg)
|
||||
uicb_screen_focus(int screen, const char *arg)
|
||||
{
|
||||
int new_screen, numscreens = get_screen_count(awesomeconf->display);
|
||||
int new_screen, numscreens = get_screen_count(globalconf.display);
|
||||
|
||||
if(arg)
|
||||
new_screen = compute_new_value_from_arg(arg, screen);
|
||||
|
@ -262,28 +262,25 @@ uicb_screen_focus(awesome_config *awesomeconf, int screen, const char *arg)
|
|||
if (new_screen > (numscreens - 1))
|
||||
new_screen = 0;
|
||||
|
||||
focus(focus_get_latest_client_for_tag(awesomeconf->focus,
|
||||
awesomeconf->screens[new_screen].tclink,
|
||||
get_current_tag(awesomeconf->screens[new_screen])),
|
||||
True, awesomeconf, new_screen);
|
||||
focus(focus_get_latest_client_for_tag(globalconf.focus,
|
||||
new_screen,
|
||||
get_current_tag(new_screen)),
|
||||
True, new_screen);
|
||||
|
||||
move_mouse_pointer_to_screen(awesomeconf->display, new_screen);
|
||||
move_mouse_pointer_to_screen(globalconf.display, new_screen);
|
||||
}
|
||||
|
||||
/** Move client to a virtual screen (if Xinerama is active)
|
||||
* \param awesomeconf awesome config
|
||||
* \param arg screen number
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_movetoscreen(awesome_config * awesomeconf,
|
||||
int screen __attribute__ ((unused)),
|
||||
const char *arg)
|
||||
uicb_client_movetoscreen(int screen __attribute__ ((unused)), const char *arg)
|
||||
{
|
||||
int new_screen, prev_screen;
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel || !XineramaIsActive(awesomeconf->display))
|
||||
if(!sel || !XineramaIsActive(globalconf.display))
|
||||
return;
|
||||
|
||||
if(arg)
|
||||
|
@ -291,15 +288,15 @@ uicb_client_movetoscreen(awesome_config * awesomeconf,
|
|||
else
|
||||
new_screen = sel->screen + 1;
|
||||
|
||||
if(new_screen >= get_screen_count(awesomeconf->display))
|
||||
if(new_screen >= get_screen_count(globalconf.display))
|
||||
new_screen = 0;
|
||||
else if(new_screen < 0)
|
||||
new_screen = get_screen_count(awesomeconf->display) - 1;
|
||||
new_screen = get_screen_count(globalconf.display) - 1;
|
||||
|
||||
prev_screen = sel->screen;
|
||||
move_client_to_screen(sel, awesomeconf, new_screen, True);
|
||||
move_mouse_pointer_to_screen(awesomeconf->display, new_screen);
|
||||
arrange(awesomeconf, prev_screen);
|
||||
arrange(awesomeconf, new_screen);
|
||||
move_client_to_screen(sel, new_screen, True);
|
||||
move_mouse_pointer_to_screen(globalconf.display, new_screen);
|
||||
arrange(prev_screen);
|
||||
arrange(new_screen);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
2
screen.h
2
screen.h
|
@ -33,7 +33,7 @@ ScreenInfo * get_display_info(Display *, int, Statusbar *, Padding *);
|
|||
int get_screen_bycoord(Display *, int, int);
|
||||
int get_screen_count(Display *);
|
||||
int get_phys_screen(Display *, int);
|
||||
void move_client_to_screen(Client *, awesome_config *, int, Bool);
|
||||
void move_client_to_screen(Client *, int, Bool);
|
||||
|
||||
UICB_PROTO(uicb_screen_focus);
|
||||
UICB_PROTO(uicb_client_movetoscreen);
|
||||
|
|
60
statusbar.c
60
statusbar.c
|
@ -30,31 +30,33 @@
|
|||
#include "tag.h"
|
||||
#include "widget.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
void
|
||||
statusbar_draw(awesome_config *awesomeconf, int screen)
|
||||
statusbar_draw(int screen)
|
||||
{
|
||||
int phys_screen = get_phys_screen(awesomeconf->display, screen);
|
||||
int phys_screen = get_phys_screen(globalconf.display, screen);
|
||||
VirtScreen vscreen;
|
||||
Widget *widget;
|
||||
int left = 0, right = 0;
|
||||
|
||||
vscreen = awesomeconf->screens[screen];
|
||||
vscreen = globalconf.screens[screen];
|
||||
/* don't waste our time */
|
||||
if(vscreen.statusbar.position == BarOff)
|
||||
return;
|
||||
|
||||
DrawCtx *ctx = draw_get_context(awesomeconf->display, phys_screen,
|
||||
DrawCtx *ctx = draw_get_context(globalconf.display, phys_screen,
|
||||
vscreen.statusbar.width, vscreen.statusbar.height);
|
||||
|
||||
for(widget = vscreen.statusbar.widgets; widget; widget = widget->next)
|
||||
if (widget->alignment == AlignLeft)
|
||||
left += widget->draw(ctx, awesomeconf, vscreen, screen, left, (left + right), AlignLeft);
|
||||
left += widget->draw(ctx, screen, left, (left + right), AlignLeft);
|
||||
else if (widget->alignment == AlignRight)
|
||||
right += widget->draw(ctx, awesomeconf, vscreen, screen, right, (left + right), AlignRight);
|
||||
right += widget->draw(ctx, screen, right, (left + right), AlignRight);
|
||||
|
||||
for(widget = vscreen.statusbar.widgets; widget; widget = widget->next)
|
||||
if (widget->alignment == AlignFlex)
|
||||
left += widget->draw(ctx, awesomeconf, vscreen, screen, left, (left + right), AlignFlex);
|
||||
left += widget->draw(ctx, screen, left, (left + right), AlignFlex);
|
||||
|
||||
if(vscreen.statusbar.position == BarRight || vscreen.statusbar.position == BarLeft)
|
||||
{
|
||||
|
@ -63,21 +65,21 @@ statusbar_draw(awesome_config *awesomeconf, int screen)
|
|||
d = draw_rotate(ctx, phys_screen, M_PI_2, vscreen.statusbar.height, 0);
|
||||
else
|
||||
d = draw_rotate(ctx, phys_screen, - M_PI_2, 0, vscreen.statusbar.width);
|
||||
XCopyArea(awesomeconf->display, d,
|
||||
XCopyArea(globalconf.display, d,
|
||||
vscreen.statusbar.window,
|
||||
DefaultGC(awesomeconf->display, phys_screen), 0, 0,
|
||||
DefaultGC(globalconf.display, phys_screen), 0, 0,
|
||||
vscreen.statusbar.height,
|
||||
vscreen.statusbar.width, 0, 0);
|
||||
XFreePixmap(awesomeconf->display, d);
|
||||
XFreePixmap(globalconf.display, d);
|
||||
}
|
||||
else
|
||||
XCopyArea(awesomeconf->display, ctx->drawable,
|
||||
XCopyArea(globalconf.display, ctx->drawable,
|
||||
vscreen.statusbar.window,
|
||||
DefaultGC(awesomeconf->display, phys_screen), 0, 0,
|
||||
DefaultGC(globalconf.display, phys_screen), 0, 0,
|
||||
vscreen.statusbar.width, vscreen.statusbar.height, 0, 0);
|
||||
|
||||
draw_free_context(ctx);
|
||||
XSync(awesomeconf->display, False);
|
||||
XSync(globalconf.display, False);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -168,38 +170,34 @@ statusbar_get_position_from_str(const char * pos)
|
|||
}
|
||||
|
||||
void
|
||||
uicb_statusbar_toggle(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_statusbar_toggle(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
if(awesomeconf->screens[screen].statusbar.position == BarOff)
|
||||
awesomeconf->screens[screen].statusbar.position = (awesomeconf->screens[screen].statusbar.dposition == BarOff) ? BarTop : awesomeconf->screens[screen].statusbar.dposition;
|
||||
if(globalconf.screens[screen].statusbar.position == BarOff)
|
||||
globalconf.screens[screen].statusbar.position = (globalconf.screens[screen].statusbar.dposition == BarOff) ? BarTop : globalconf.screens[screen].statusbar.dposition;
|
||||
else
|
||||
awesomeconf->screens[screen].statusbar.position = BarOff;
|
||||
statusbar_update_position(awesomeconf->display, awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
arrange(awesomeconf, screen);
|
||||
globalconf.screens[screen].statusbar.position = BarOff;
|
||||
statusbar_update_position(globalconf.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_statusbar_set_position(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_statusbar_set_position(int screen, const char *arg)
|
||||
{
|
||||
awesomeconf->screens[screen].statusbar.dposition =
|
||||
awesomeconf->screens[screen].statusbar.position =
|
||||
globalconf.screens[screen].statusbar.dposition =
|
||||
globalconf.screens[screen].statusbar.position =
|
||||
statusbar_get_position_from_str(arg);
|
||||
statusbar_update_position(awesomeconf->display, awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
statusbar_update_position(globalconf.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_statusbar_set_text(awesome_config *awesomeconf, int screen, const char *arg)
|
||||
uicb_statusbar_set_text(int screen, const char *arg)
|
||||
{
|
||||
if(!arg)
|
||||
return;
|
||||
a_strncpy(awesomeconf->screens[screen].statustext,
|
||||
sizeof(awesomeconf->screens[screen].statustext), arg, a_strlen(arg));
|
||||
a_strncpy(globalconf.screens[screen].statustext,
|
||||
sizeof(globalconf.screens[screen].statustext), arg, a_strlen(arg));
|
||||
|
||||
statusbar_draw(awesomeconf, screen);
|
||||
statusbar_draw(screen);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "common.h"
|
||||
|
||||
void statusbar_init(Display *, int, Statusbar *, Cursor, XftFont *, Padding *);
|
||||
void statusbar_draw(awesome_config *, int);
|
||||
void statusbar_draw(int);
|
||||
int statusbar_get_position_from_str(const char *);
|
||||
void statusbar_update_position(Display *, Statusbar, Padding *);
|
||||
|
||||
|
|
181
tag.c
181
tag.c
|
@ -28,17 +28,18 @@
|
|||
#include "util.h"
|
||||
#include "rules.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
static void
|
||||
detach_tagclientlink(TagClientLink **head, TagClientLink *tc)
|
||||
detach_tagclientlink(int screen, TagClientLink *tc)
|
||||
{
|
||||
TagClientLink *tmp;
|
||||
|
||||
if(*head == tc)
|
||||
*head = tc->next;
|
||||
if(globalconf.screens[screen].tclink == tc)
|
||||
globalconf.screens[screen].tclink = tc->next;
|
||||
else
|
||||
{
|
||||
for(tmp = *head; tmp && tmp->next != tc; tmp = tmp->next);
|
||||
for(tmp = globalconf.screens[screen].tclink; tmp && tmp->next != tc; tmp = tmp->next);
|
||||
tmp->next = tc->next;
|
||||
}
|
||||
|
||||
|
@ -46,21 +47,21 @@ detach_tagclientlink(TagClientLink **head, TagClientLink *tc)
|
|||
}
|
||||
|
||||
void
|
||||
tag_client(TagClientLink **head, Client *c, Tag *t)
|
||||
tag_client(Client *c, Tag *t, int screen)
|
||||
{
|
||||
TagClientLink *tc, *new_tc;
|
||||
|
||||
/* don't tag twice */
|
||||
if(is_client_tagged(*head, c, t))
|
||||
if(is_client_tagged(c, t, screen))
|
||||
return;
|
||||
|
||||
new_tc = p_new(TagClientLink, 1);
|
||||
|
||||
if(!*head)
|
||||
*head = new_tc;
|
||||
if(!globalconf.screens[screen].tclink)
|
||||
globalconf.screens[screen].tclink = new_tc;
|
||||
else
|
||||
{
|
||||
for(tc = *head; tc->next; tc = tc->next);
|
||||
for(tc = globalconf.screens[screen].tclink; tc->next; tc = tc->next);
|
||||
tc->next = new_tc;
|
||||
}
|
||||
|
||||
|
@ -69,64 +70,66 @@ tag_client(TagClientLink **head, Client *c, Tag *t)
|
|||
}
|
||||
|
||||
void
|
||||
untag_client(TagClientLink **head, Client *c, Tag *t)
|
||||
untag_client(Client *c, Tag *t, int screen)
|
||||
{
|
||||
TagClientLink *tc;
|
||||
|
||||
for(tc = *head; tc; tc = tc->next)
|
||||
for(tc = globalconf.screens[screen].tclink; tc; tc = tc->next)
|
||||
if(tc->client == c && tc->tag == t)
|
||||
detach_tagclientlink(head, tc);
|
||||
detach_tagclientlink(screen, tc);
|
||||
}
|
||||
|
||||
Bool
|
||||
is_client_tagged(TagClientLink *head, Client *c, Tag *t)
|
||||
is_client_tagged(Client *c, Tag *t, int screen)
|
||||
{
|
||||
TagClientLink *tc;
|
||||
|
||||
for(tc = head; tc; tc = tc->next)
|
||||
for(tc = globalconf.screens[screen].tclink; tc; tc = tc->next)
|
||||
if(tc->client == c && tc->tag == t)
|
||||
return True;
|
||||
return False;
|
||||
}
|
||||
|
||||
void
|
||||
tag_client_with_current_selected(Client *c, VirtScreen *screen)
|
||||
tag_client_with_current_selected(Client *c, int screen)
|
||||
{
|
||||
Tag *tag;
|
||||
VirtScreen vscreen;
|
||||
|
||||
for(tag = screen->tags; tag; tag = tag->next)
|
||||
vscreen = globalconf.screens[screen];
|
||||
for(tag = vscreen.tags; tag; tag = tag->next)
|
||||
if(tag->selected)
|
||||
tag_client(&screen->tclink, c, tag);
|
||||
tag_client(c, tag, screen);
|
||||
else
|
||||
untag_client(&screen->tclink, c, tag);
|
||||
untag_client(c, tag, screen);
|
||||
}
|
||||
|
||||
void
|
||||
tag_client_with_rules(Client *c, awesome_config *awesomeconf)
|
||||
tag_client_with_rules(Client *c)
|
||||
{
|
||||
Rule *r;
|
||||
Tag *tag;
|
||||
Bool matched = False;
|
||||
|
||||
for(r = awesomeconf->rules; r; r = r->next)
|
||||
for(r = globalconf.rules; r; r = r->next)
|
||||
if(client_match_rule(c, r))
|
||||
{
|
||||
c->isfloating = r->isfloating;
|
||||
|
||||
if(r->screen != RULE_NOSCREEN && r->screen != c->screen)
|
||||
move_client_to_screen(c, awesomeconf, r->screen, True);
|
||||
move_client_to_screen(c, r->screen, True);
|
||||
|
||||
for(tag = awesomeconf->screens[c->screen].tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next)
|
||||
if(is_tag_match_rules(tag, r))
|
||||
{
|
||||
matched = True;
|
||||
tag_client(&awesomeconf->screens[c->screen].tclink, c, tag);
|
||||
tag_client(c, tag, c->screen);
|
||||
}
|
||||
else
|
||||
untag_client(&awesomeconf->screens[c->screen].tclink, c, tag);
|
||||
untag_client(c, tag, c->screen);
|
||||
|
||||
if(!matched)
|
||||
tag_client_with_current_selected(c, &awesomeconf->screens[c->screen]);
|
||||
tag_client_with_current_selected(c, c->screen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -136,13 +139,11 @@ tag_client_with_rules(Client *c, awesome_config *awesomeconf)
|
|||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_tag(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_client_tag(int screen, const char *arg)
|
||||
{
|
||||
int tag_id = -1;
|
||||
Tag *tag, *target_tag;
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
@ -152,22 +153,22 @@ uicb_client_tag(awesome_config *awesomeconf,
|
|||
tag_id = atoi(arg) - 1;
|
||||
if(tag_id != -1)
|
||||
{
|
||||
for(target_tag = awesomeconf->screens[screen].tags; target_tag && tag_id > 0;
|
||||
for(target_tag = globalconf.screens[screen].tags; target_tag && tag_id > 0;
|
||||
target_tag = target_tag->next, tag_id--);
|
||||
if(target_tag)
|
||||
{
|
||||
for(tag = awesomeconf->screens[screen].tags; tag; tag = tag->next)
|
||||
untag_client(&awesomeconf->screens[screen].tclink, sel, tag);
|
||||
tag_client(&awesomeconf->screens[screen].tclink, sel, target_tag);
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
untag_client(sel, tag, screen);
|
||||
tag_client(sel, target_tag, screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
for(tag = awesomeconf->screens[screen].tags; tag; tag = tag->next)
|
||||
tag_client(&awesomeconf->screens[screen].tclink, sel, tag);
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
tag_client(sel, tag, screen);
|
||||
|
||||
client_saveprops(sel, &awesomeconf->screens[screen]);
|
||||
arrange(awesomeconf, screen);
|
||||
client_saveprops(sel, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** Toggle floating state of a client
|
||||
|
@ -175,11 +176,9 @@ uicb_client_tag(awesome_config *awesomeconf,
|
|||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_togglefloating(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_client_togglefloating(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
@ -187,12 +186,12 @@ uicb_client_togglefloating(awesome_config * awesomeconf,
|
|||
sel->isfloating = !sel->isfloating;
|
||||
|
||||
if (arg == NULL)
|
||||
client_resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True, False);
|
||||
client_resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True, False);
|
||||
else
|
||||
client_resize(sel, sel->x, sel->y, sel->w, sel->h, awesomeconf, True, True);
|
||||
client_resize(sel, sel->x, sel->y, sel->w, sel->h, True, True);
|
||||
|
||||
client_saveprops(sel, &awesomeconf->screens[screen]);
|
||||
arrange(awesomeconf, screen);
|
||||
client_saveprops(sel, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** Toggle a tag on client
|
||||
|
@ -200,11 +199,9 @@ uicb_client_togglefloating(awesome_config * awesomeconf,
|
|||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_toggletag(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_client_toggletag(int screen, const char *arg)
|
||||
{
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
int i;
|
||||
Tag *tag, *target_tag;
|
||||
|
||||
|
@ -214,32 +211,32 @@ uicb_client_toggletag(awesome_config *awesomeconf,
|
|||
if(arg)
|
||||
{
|
||||
i = atoi(arg) - 1;
|
||||
for(target_tag = awesomeconf->screens[screen].tags; target_tag && i > 0;
|
||||
for(target_tag = globalconf.screens[screen].tags; target_tag && i > 0;
|
||||
target_tag = target_tag->next, i--);
|
||||
if(target_tag)
|
||||
{
|
||||
if(is_client_tagged(awesomeconf->screens[screen].tclink, sel, target_tag))
|
||||
untag_client(&awesomeconf->screens[screen].tclink, sel, target_tag);
|
||||
if(is_client_tagged(sel, target_tag, screen))
|
||||
untag_client(sel, target_tag, screen);
|
||||
else
|
||||
tag_client(&awesomeconf->screens[screen].tclink, sel, target_tag);
|
||||
tag_client(sel, target_tag, screen);
|
||||
}
|
||||
|
||||
/* check that there's at least one tag selected for this client*/
|
||||
for(tag = awesomeconf->screens[screen].tags; tag
|
||||
&& !is_client_tagged(awesomeconf->screens[screen].tclink, sel, tag); tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag
|
||||
&& !is_client_tagged(sel, tag, screen); tag = tag->next)
|
||||
|
||||
if(!tag)
|
||||
tag_client(&awesomeconf->screens[screen].tclink, sel, target_tag);
|
||||
tag_client(sel, target_tag, screen);
|
||||
}
|
||||
else
|
||||
for(tag = awesomeconf->screens[screen].tags; tag; tag = tag->next)
|
||||
if(is_client_tagged(awesomeconf->screens[screen].tclink, sel, tag))
|
||||
tag_client(&awesomeconf->screens[screen].tclink, sel, tag);
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
if(is_client_tagged(sel, tag, screen))
|
||||
tag_client(sel, tag, screen);
|
||||
else
|
||||
untag_client(&awesomeconf->screens[screen].tclink, sel, tag);
|
||||
untag_client(sel, tag, screen);
|
||||
|
||||
client_saveprops(sel, &awesomeconf->screens[screen]);
|
||||
arrange(awesomeconf, screen);
|
||||
client_saveprops(sel, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** Add a tag to viewed tags
|
||||
|
@ -247,9 +244,7 @@ uicb_client_toggletag(awesome_config *awesomeconf,
|
|||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_tag_toggleview(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_tag_toggleview(int screen, const char *arg)
|
||||
{
|
||||
int i;
|
||||
Tag *tag, *target_tag;
|
||||
|
@ -257,34 +252,31 @@ uicb_tag_toggleview(awesome_config *awesomeconf,
|
|||
if(arg)
|
||||
{
|
||||
i = atoi(arg) - 1;
|
||||
for(target_tag = awesomeconf->screens[screen].tags; target_tag && i > 0;
|
||||
for(target_tag = globalconf.screens[screen].tags; target_tag && i > 0;
|
||||
target_tag = target_tag->next, i--);
|
||||
|
||||
if(target_tag)
|
||||
target_tag->selected = !target_tag->selected;
|
||||
|
||||
/* check that there's at least one tag selected */
|
||||
for(tag = awesomeconf->screens[screen].tags; tag && !tag->selected; tag = tag->next);
|
||||
for(tag = globalconf.screens[screen].tags; tag && !tag->selected; tag = tag->next);
|
||||
if(!tag)
|
||||
target_tag->selected = True;
|
||||
}
|
||||
else
|
||||
for(tag = awesomeconf->screens[screen].tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
tag->selected = !tag->selected;
|
||||
|
||||
saveawesomeprops(awesomeconf, screen);
|
||||
arrange(awesomeconf, screen);
|
||||
saveawesomeprops(screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** View tag
|
||||
* \param awesomeconf awesome config ref
|
||||
* \param arg tag to view
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_tag_view(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_tag_view(int screen, const char *arg)
|
||||
{
|
||||
int i;
|
||||
Tag *tag, *target_tag;
|
||||
|
@ -292,43 +284,40 @@ uicb_tag_view(awesome_config *awesomeconf,
|
|||
if(arg)
|
||||
{
|
||||
i = atoi(arg) - 1;
|
||||
for(target_tag = awesomeconf->screens[screen].tags; target_tag && i > 0;
|
||||
for(target_tag = globalconf.screens[screen].tags; target_tag && i > 0;
|
||||
target_tag = target_tag->next, i--);
|
||||
if(target_tag)
|
||||
{
|
||||
for(tag = awesomeconf->screens[screen].tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
tag->selected = False;
|
||||
target_tag->selected = True;
|
||||
}
|
||||
}
|
||||
else
|
||||
for(tag = awesomeconf->screens[screen].tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
tag->selected = True;
|
||||
|
||||
saveawesomeprops(awesomeconf, screen);
|
||||
arrange(awesomeconf, screen);
|
||||
saveawesomeprops(screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** View previously selected tags
|
||||
* \param awesomeconf awesome config ref
|
||||
* \param arg unused
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_tag_prev_selected(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_tag_prev_selected(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Tag *tag;
|
||||
Bool t;
|
||||
|
||||
for(tag = awesomeconf->screens[screen].tags; tag; tag = tag->next)
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
{
|
||||
t = tag->selected;
|
||||
tag->selected = tag->was_selected;
|
||||
tag->was_selected = t;
|
||||
}
|
||||
arrange(awesomeconf, screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** View next tag
|
||||
|
@ -336,11 +325,9 @@ uicb_tag_prev_selected(awesome_config *awesomeconf,
|
|||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_tag_viewnext(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_tag_viewnext(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen]);
|
||||
Tag *curtag = get_current_tag(screen);
|
||||
|
||||
if(!curtag->next)
|
||||
return;
|
||||
|
@ -348,8 +335,8 @@ uicb_tag_viewnext(awesome_config *awesomeconf,
|
|||
curtag->selected = False;
|
||||
curtag->next->selected = True;
|
||||
|
||||
saveawesomeprops(awesomeconf, screen);
|
||||
arrange(awesomeconf, screen);
|
||||
saveawesomeprops(screen);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** View previous tag
|
||||
|
@ -357,19 +344,17 @@ uicb_tag_viewnext(awesome_config *awesomeconf,
|
|||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_tag_viewprev(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_tag_viewprev(int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Tag *tag, *curtag = get_current_tag(awesomeconf->screens[screen]);
|
||||
Tag *tag, *curtag = get_current_tag(screen);
|
||||
|
||||
for(tag = awesomeconf->screens[screen].tags; tag && tag->next != curtag; tag = tag->next);
|
||||
for(tag = globalconf.screens[screen].tags; tag && tag->next != curtag; tag = tag->next);
|
||||
if(tag)
|
||||
{
|
||||
tag->selected = True;
|
||||
curtag->selected = False;
|
||||
saveawesomeprops(awesomeconf, screen);
|
||||
arrange(awesomeconf, screen);
|
||||
saveawesomeprops(screen);
|
||||
arrange(screen);
|
||||
}
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
12
tag.h
12
tag.h
|
@ -25,13 +25,13 @@
|
|||
#include "client.h"
|
||||
|
||||
/** Check if a client is tiled */
|
||||
#define IS_TILED(client, scr, screen) (client && !client->isfloating && client_isvisible(client, scr, screen))
|
||||
#define IS_TILED(client, screen) (client && !client->isfloating && client_isvisible(client, screen))
|
||||
|
||||
void tag_client(TagClientLink **, Client *, Tag *);
|
||||
void untag_client(TagClientLink **, Client *, Tag *);
|
||||
Bool is_client_tagged(TagClientLink *, Client *, Tag *);
|
||||
void tag_client_with_current_selected(Client *, VirtScreen *);
|
||||
void tag_client_with_rules(Client *, awesome_config *);
|
||||
void tag_client(Client *, Tag *, int);
|
||||
void untag_client(Client *, Tag *, int);
|
||||
Bool is_client_tagged(Client *, Tag *, int);
|
||||
void tag_client_with_current_selected(Client *, int);
|
||||
void tag_client_with_rules(Client *);
|
||||
|
||||
UICB_PROTO(uicb_client_tag);
|
||||
UICB_PROTO(uicb_client_togglefloating);
|
||||
|
|
10
uicb.c
10
uicb.c
|
@ -31,6 +31,8 @@
|
|||
#include "focus.h"
|
||||
#include "layouts/tile.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
const NameFuncLink UicbList[] =
|
||||
{
|
||||
/* xutil.c */
|
||||
|
@ -87,7 +89,7 @@ run_uicb(char *cmd, awesome_config *awesomeconf)
|
|||
char *p;
|
||||
const char *arg;
|
||||
int screen, len;
|
||||
void (*uicb) (awesome_config *, int, const char *);
|
||||
void (*uicb) (int, const char *);
|
||||
|
||||
len = strlen(cmd);
|
||||
p = strtok(cmd, " ");
|
||||
|
@ -117,12 +119,12 @@ run_uicb(char *cmd, awesome_config *awesomeconf)
|
|||
else
|
||||
arg = NULL;
|
||||
|
||||
uicb(awesomeconf, screen, arg);
|
||||
uicb(screen, arg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
parse_control(char *cmd, awesome_config *awesomeconf)
|
||||
parse_control(char *cmd)
|
||||
{
|
||||
char *p, *curcmd = cmd;
|
||||
|
||||
|
@ -132,7 +134,7 @@ parse_control(char *cmd, awesome_config *awesomeconf)
|
|||
while((p = strchr(curcmd, '\n')))
|
||||
{
|
||||
*p = '\0';
|
||||
run_uicb(curcmd, awesomeconf);
|
||||
run_uicb(curcmd, &globalconf);
|
||||
curcmd = p + 1;
|
||||
}
|
||||
|
||||
|
|
2
uicb.h
2
uicb.h
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
int parse_control(char *, awesome_config *);
|
||||
int parse_control(char *);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
#include "util.h"
|
||||
#include "widget.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
static char name[] = "focustitle";
|
||||
|
||||
static int
|
||||
focustitle_draw(DrawCtx *ctx,
|
||||
awesome_config *awesomeconf __attribute__ ((unused)),
|
||||
VirtScreen vscreen,
|
||||
int screen __attribute__ ((unused)),
|
||||
int offset,
|
||||
int used,
|
||||
int align)
|
||||
focustitle_draw(DrawCtx *ctx, int screen, int offset, int used, int align)
|
||||
{
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
VirtScreen vscreen = globalconf.screens[screen];
|
||||
int location = calculate_offset(vscreen.statusbar.width, 0, offset, align);
|
||||
|
||||
if(sel)
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
#include "util.h"
|
||||
#include "layout.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
static char name[] = "layoutinfo";
|
||||
|
||||
static int
|
||||
layoutinfo_draw(DrawCtx *ctx,
|
||||
awesome_config *awesomeconf __attribute__ ((unused)),
|
||||
VirtScreen vscreen,
|
||||
int screen __attribute__ ((unused)),
|
||||
int offset,
|
||||
layoutinfo_draw(DrawCtx *ctx, int screen, int offset,
|
||||
int used __attribute__ ((unused)),
|
||||
int align __attribute__ ((unused)))
|
||||
{
|
||||
int width = 0, location;
|
||||
VirtScreen vscreen = globalconf.screens[screen];
|
||||
Layout *l;
|
||||
for(l = vscreen.layouts ; l; l = l->next)
|
||||
width = MAX(width, (textwidth(ctx, vscreen.font, l->symbol)));
|
||||
|
@ -22,7 +21,7 @@ layoutinfo_draw(DrawCtx *ctx,
|
|||
width,
|
||||
vscreen.statusbar.height,
|
||||
vscreen.font,
|
||||
get_current_layout(vscreen)->symbol,
|
||||
get_current_layout(screen)->symbol,
|
||||
vscreen.colors_normal);
|
||||
return width;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "widget.h"
|
||||
#include "tag.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
static char name[] = "taglist";
|
||||
|
||||
/** Check if at least a client is tagged with tag number t and is on screen
|
||||
|
@ -17,22 +19,21 @@ isoccupied(TagClientLink *tc, int screen, Client *head, Tag *t)
|
|||
Client *c;
|
||||
|
||||
for(c = head; c; c = c->next)
|
||||
if(c->screen == screen && is_client_tagged(tc, c, t))
|
||||
if(c->screen == screen && is_client_tagged(c, t, screen))
|
||||
return True;
|
||||
return False;
|
||||
}
|
||||
|
||||
static int
|
||||
taglist_draw(DrawCtx *ctx,
|
||||
awesome_config *awesomeconf,
|
||||
VirtScreen vscreen,
|
||||
int screen,
|
||||
int offset,
|
||||
int used __attribute__ ((unused)),
|
||||
int align __attribute__ ((unused)))
|
||||
{
|
||||
Tag *tag;
|
||||
Client *sel = awesomeconf->focus->client;
|
||||
Client *sel = globalconf.focus->client;
|
||||
VirtScreen vscreen = globalconf.screens[screen];
|
||||
int w = 0, width = 0, location;
|
||||
int flagsize;
|
||||
XColor *colors;
|
||||
|
@ -55,9 +56,9 @@ taglist_draw(DrawCtx *ctx,
|
|||
colors = vscreen.colors_normal;
|
||||
drawtext(ctx, location + width, 0, w,
|
||||
vscreen.statusbar.height, vscreen.font, tag->name, colors);
|
||||
if(isoccupied(vscreen.tclink, screen, awesomeconf->clients, tag))
|
||||
if(isoccupied(vscreen.tclink, screen, globalconf.clients, tag))
|
||||
drawrectangle(ctx, location + width, 0, flagsize, flagsize,
|
||||
sel && is_client_tagged(vscreen.tclink, sel, tag),
|
||||
sel && is_client_tagged(sel, tag, screen),
|
||||
colors[ColFG]);
|
||||
width += w;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
#include "util.h"
|
||||
#include "widget.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
static char name[] = "textbox";
|
||||
|
||||
static int
|
||||
textbox_draw(DrawCtx *ctx,
|
||||
awesome_config *awesomeconf __attribute__ ((unused)),
|
||||
VirtScreen vscreen,
|
||||
int screen __attribute__ ((unused)),
|
||||
int offset,
|
||||
int used __attribute__ ((unused)),
|
||||
int align)
|
||||
{
|
||||
VirtScreen vscreen = globalconf.screens[screen];
|
||||
int width = textwidth(ctx, vscreen.font, vscreen.statustext);
|
||||
int location = calculate_offset(vscreen.statusbar.width, width, offset, align);
|
||||
drawtext(ctx, location, 0, width, vscreen.statusbar.height,
|
||||
|
|
18
window.c
18
window.c
|
@ -25,6 +25,8 @@
|
|||
#include "window.h"
|
||||
#include "util.h"
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
/** Set client WM_STATE property
|
||||
* \param disp Display ref
|
||||
* \param win Window
|
||||
|
@ -89,11 +91,9 @@ window_configure(Display *disp, Window win, int x, int y, int w, int h, int bord
|
|||
* \param focused True if client is focused
|
||||
* \param raised True if the client is above other clients
|
||||
* \param modkey Mod key mask
|
||||
* \param numlockmask Numlock mask
|
||||
*/
|
||||
void
|
||||
window_grabbuttons(Display *disp, int screen, Window win, Bool focused, Bool raised,
|
||||
Button *buttons_root, Button *buttons_client, unsigned int numlockmask)
|
||||
window_grabbuttons(Display *disp, int screen, Window win, Bool focused, Bool raised)
|
||||
{
|
||||
Button *b;
|
||||
|
||||
|
@ -105,15 +105,15 @@ window_grabbuttons(Display *disp, int screen, Window win, Bool focused, Bool rai
|
|||
XGrabButton(disp, Button1, NoSymbol, win, False,
|
||||
BUTTONMASK, GrabModeSync, GrabModeAsync, None, None);
|
||||
|
||||
for(b = buttons_client; b; b = b->next)
|
||||
for(b = globalconf.buttons.client; b; b = b->next)
|
||||
{
|
||||
XGrabButton(disp, b->button, b->mod, win, False, BUTTONMASK,
|
||||
GrabModeAsync, GrabModeSync, None, None);
|
||||
XGrabButton(disp, b->button, b->mod | LockMask, win, False,
|
||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
||||
XGrabButton(disp, b->button, b->mod | numlockmask, win, False,
|
||||
XGrabButton(disp, b->button, b->mod | globalconf.numlockmask, win, False,
|
||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
||||
XGrabButton(disp, b->button, b->mod | numlockmask | LockMask,
|
||||
XGrabButton(disp, b->button, b->mod | globalconf.numlockmask | LockMask,
|
||||
win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ window_grabbuttons(Display *disp, int screen, Window win, Bool focused, Bool rai
|
|||
XGrabButton(disp, AnyButton, AnyModifier, win, False, BUTTONMASK,
|
||||
GrabModeAsync, GrabModeSync, None, None);
|
||||
|
||||
for(b = buttons_root; b; b = b->next)
|
||||
for(b = globalconf.buttons.root; b; b = b->next)
|
||||
{
|
||||
XGrabButton(disp, b->button, b->mod,
|
||||
RootWindow(disp, screen), False, BUTTONMASK,
|
||||
|
@ -132,10 +132,10 @@ window_grabbuttons(Display *disp, int screen, Window win, Bool focused, Bool rai
|
|||
XGrabButton(disp, b->button, b->mod | LockMask,
|
||||
RootWindow(disp, screen), False, BUTTONMASK,
|
||||
GrabModeAsync, GrabModeSync, None, None);
|
||||
XGrabButton(disp, b->button, b->mod | numlockmask,
|
||||
XGrabButton(disp, b->button, b->mod | globalconf.numlockmask,
|
||||
RootWindow(disp, screen), False, BUTTONMASK,
|
||||
GrabModeAsync, GrabModeSync, None, None);
|
||||
XGrabButton(disp, b->button, b->mod | numlockmask | LockMask,
|
||||
XGrabButton(disp, b->button, b->mod | globalconf.numlockmask | LockMask,
|
||||
RootWindow(disp, screen), False, BUTTONMASK,
|
||||
GrabModeAsync, GrabModeSync, None, None);
|
||||
}
|
||||
|
|
2
window.h
2
window.h
|
@ -30,7 +30,7 @@
|
|||
int window_setstate(Display *, Window, long);
|
||||
long window_getstate(Display *, Window);
|
||||
Status window_configure(Display *, Window, int, int, int, int, int);
|
||||
void window_grabbuttons(Display *, int, Window, Bool, Bool, Button *, Button *, unsigned int);
|
||||
void window_grabbuttons(Display *, int, Window, Bool, Bool);
|
||||
void window_setshape(Display *, int, Window);
|
||||
void window_settrans(Display *, Window, double);
|
||||
|
||||
|
|
21
xutil.c
21
xutil.c
|
@ -27,23 +27,22 @@
|
|||
#include "util.h"
|
||||
#include "xutil.h"
|
||||
|
||||
|
||||
extern awesome_config globalconf;
|
||||
|
||||
void
|
||||
uicb_exec(awesome_config * awesomeconf,
|
||||
int screen __attribute__ ((unused)),
|
||||
const char *arg)
|
||||
uicb_exec(int screen __attribute__ ((unused)), const char *arg)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
if(awesomeconf->display)
|
||||
close(ConnectionNumber(awesomeconf->display));
|
||||
if(globalconf.display)
|
||||
close(ConnectionNumber(globalconf.display));
|
||||
|
||||
sscanf(arg, "%s", path);
|
||||
execlp(path, arg, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_spawn(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
uicb_spawn(int screen, const char *arg)
|
||||
{
|
||||
static char *shell = NULL;
|
||||
char *display = NULL;
|
||||
|
@ -54,7 +53,7 @@ uicb_spawn(awesome_config * awesomeconf,
|
|||
if(!arg)
|
||||
return;
|
||||
|
||||
if(!XineramaIsActive(awesomeconf->display) && (tmp = getenv("DISPLAY")))
|
||||
if(!XineramaIsActive(globalconf.display) && (tmp = getenv("DISPLAY")))
|
||||
{
|
||||
display = a_strdup(tmp);
|
||||
if((tmp = strrchr(display, '.')))
|
||||
|
@ -70,8 +69,8 @@ uicb_spawn(awesome_config * awesomeconf,
|
|||
{
|
||||
if(fork() == 0)
|
||||
{
|
||||
if(awesomeconf->display)
|
||||
close(ConnectionNumber(awesomeconf->display));
|
||||
if(globalconf.display)
|
||||
close(ConnectionNumber(globalconf.display));
|
||||
setsid();
|
||||
execl(shell, shell, "-c", arg, (char *) NULL);
|
||||
warn("execl '%s -c %s'", shell, arg);
|
||||
|
|
Loading…
Reference in New Issue