mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
assign and use screen ctx where appropriate and consistently.
This commit is contained in:
parent
3681b26914
commit
287a5b2aad
20
kbfunc.c
20
kbfunc.c
@ -54,14 +54,13 @@ kbfunc_client_raise(struct client_ctx *cc, union arg *arg)
|
|||||||
void
|
void
|
||||||
kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
|
kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
int x, y, flags, amt;
|
int x, y, flags, amt;
|
||||||
u_int mx, my;
|
u_int mx, my;
|
||||||
|
|
||||||
if (cc->flags & CLIENT_FREEZE)
|
if (cc->flags & CLIENT_FREEZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sc = cc->sc;
|
|
||||||
mx = my = 0;
|
mx = my = 0;
|
||||||
|
|
||||||
flags = arg->i;
|
flags = arg->i;
|
||||||
@ -140,12 +139,11 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
|
|||||||
void
|
void
|
||||||
kbfunc_client_search(struct client_ctx *cc, union arg *arg)
|
kbfunc_client_search(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct client_ctx *old_cc;
|
struct client_ctx *old_cc;
|
||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
struct menu_q menuq;
|
struct menu_q menuq;
|
||||||
|
|
||||||
sc = cc->sc;
|
|
||||||
old_cc = client_current();
|
old_cc = client_current();
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
@ -177,12 +175,11 @@ kbfunc_client_search(struct client_ctx *cc, union arg *arg)
|
|||||||
void
|
void
|
||||||
kbfunc_menu_search(struct client_ctx *cc, union arg *arg)
|
kbfunc_menu_search(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct cmd *cmd;
|
struct cmd *cmd;
|
||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
struct menu_q menuq;
|
struct menu_q menuq;
|
||||||
|
|
||||||
sc = cc->sc;
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
|
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
|
||||||
@ -205,9 +202,7 @@ kbfunc_menu_search(struct client_ctx *cc, union arg *arg)
|
|||||||
void
|
void
|
||||||
kbfunc_client_cycle(struct client_ctx *cc, union arg *arg)
|
kbfunc_client_cycle(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
|
|
||||||
sc = cc->sc;
|
|
||||||
|
|
||||||
/* XXX for X apps that ignore events */
|
/* XXX for X apps that ignore events */
|
||||||
XGrabKeyboard(X_Dpy, sc->rootwin, True,
|
XGrabKeyboard(X_Dpy, sc->rootwin, True,
|
||||||
@ -244,7 +239,7 @@ void
|
|||||||
kbfunc_exec(struct client_ctx *cc, union arg *arg)
|
kbfunc_exec(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
#define NPATHS 256
|
#define NPATHS 256
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
char **ap, *paths[NPATHS], *path, *pathcpy, *label;
|
char **ap, *paths[NPATHS], *path, *pathcpy, *label;
|
||||||
char tpath[MAXPATHLEN];
|
char tpath[MAXPATHLEN];
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
@ -253,7 +248,6 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
|
|||||||
struct menu_q menuq;
|
struct menu_q menuq;
|
||||||
int l, i, cmd = arg->i;
|
int l, i, cmd = arg->i;
|
||||||
|
|
||||||
sc = cc->sc;
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CWM_EXEC_PROGRAM:
|
case CWM_EXEC_PROGRAM:
|
||||||
label = "exec";
|
label = "exec";
|
||||||
@ -332,7 +326,7 @@ out:
|
|||||||
void
|
void
|
||||||
kbfunc_ssh(struct client_ctx *cc, union arg *arg)
|
kbfunc_ssh(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
struct menu_q menuq;
|
struct menu_q menuq;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -342,8 +336,6 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
|
|||||||
int l;
|
int l;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
sc = cc->sc;
|
|
||||||
|
|
||||||
if ((home = getenv("HOME")) == NULL)
|
if ((home = getenv("HOME")) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
12
mousefunc.c
12
mousefunc.c
@ -137,6 +137,7 @@ mousefunc_window_move(struct client_ctx *cc, void *arg)
|
|||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
Time ltime = 0;
|
Time ltime = 0;
|
||||||
|
struct screen_ctx *sc = cc->sc;
|
||||||
int px, py;
|
int px, py;
|
||||||
|
|
||||||
client_raise(cc);
|
client_raise(cc);
|
||||||
@ -161,10 +162,10 @@ mousefunc_window_move(struct client_ctx *cc, void *arg)
|
|||||||
cc->geom.y = ev.xmotion.y_root - py - cc->bwidth;
|
cc->geom.y = ev.xmotion.y_root - py - cc->bwidth;
|
||||||
|
|
||||||
cc->geom.x += client_snapcalc(cc->geom.x,
|
cc->geom.x += client_snapcalc(cc->geom.x,
|
||||||
cc->geom.width, cc->sc->xmax,
|
cc->geom.width, sc->xmax,
|
||||||
cc->bwidth, Conf.snapdist);
|
cc->bwidth, Conf.snapdist);
|
||||||
cc->geom.y += client_snapcalc(cc->geom.y,
|
cc->geom.y += client_snapcalc(cc->geom.y,
|
||||||
cc->geom.height, cc->sc->ymax,
|
cc->geom.height, sc->ymax,
|
||||||
cc->bwidth, Conf.snapdist);
|
cc->bwidth, Conf.snapdist);
|
||||||
|
|
||||||
/* don't move more than 60 times / second */
|
/* don't move more than 60 times / second */
|
||||||
@ -217,13 +218,12 @@ mousefunc_menu_group(struct client_ctx *cc, void *arg)
|
|||||||
void
|
void
|
||||||
mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
|
mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct client_ctx *old_cc;
|
struct client_ctx *old_cc;
|
||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
struct menu_q menuq;
|
struct menu_q menuq;
|
||||||
char *wname;
|
char *wname;
|
||||||
|
|
||||||
sc = cc->sc;
|
|
||||||
old_cc = client_current();
|
old_cc = client_current();
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
@ -261,13 +261,11 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
|
|||||||
void
|
void
|
||||||
mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
|
mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
struct menu_q menuq;
|
struct menu_q menuq;
|
||||||
struct cmd *cmd;
|
struct cmd *cmd;
|
||||||
|
|
||||||
sc = cc->sc;
|
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
|
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
|
||||||
mi = xcalloc(1, sizeof(*mi));
|
mi = xcalloc(1, sizeof(*mi));
|
||||||
|
Loading…
Reference in New Issue
Block a user