mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
- add missing prototypes.
- properly name, place and static private functions. - move function which finds the xinerama screen for a coordinate to a more appropriate place while altering its semantics to match others. - tiny bit of style. ok oga@
This commit is contained in:
parent
7e110f379b
commit
49e218cf53
1
calmwm.h
1
calmwm.h
@ -413,6 +413,7 @@ struct screen_ctx *screen_fromroot(Window);
|
|||||||
struct screen_ctx *screen_current(void);
|
struct screen_ctx *screen_current(void);
|
||||||
void screen_updatestackingorder(void);
|
void screen_updatestackingorder(void);
|
||||||
void screen_init_xinerama(struct screen_ctx *);
|
void screen_init_xinerama(struct screen_ctx *);
|
||||||
|
XineramaScreenInfo *screen_find_xinerama(struct screen_ctx *, int, int);
|
||||||
|
|
||||||
void conf_setup(struct conf *, const char *);
|
void conf_setup(struct conf *, const char *);
|
||||||
void conf_client(struct client_ctx *);
|
void conf_client(struct client_ctx *);
|
||||||
|
43
client.c
43
client.c
@ -21,12 +21,9 @@
|
|||||||
#include "headers.h"
|
#include "headers.h"
|
||||||
#include "calmwm.h"
|
#include "calmwm.h"
|
||||||
|
|
||||||
int _inwindowbounds(struct client_ctx *, int, int);
|
static int _client_inbound(struct client_ctx *, int, int);
|
||||||
XineramaScreenInfo *client_find_xinerama_screen(int , int ,
|
|
||||||
struct screen_ctx *);
|
|
||||||
|
|
||||||
static char emptystring[] = "";
|
static char emptystring[] = "";
|
||||||
|
|
||||||
struct client_ctx *_curcc = NULL;
|
struct client_ctx *_curcc = NULL;
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -339,9 +336,9 @@ client_maximize(struct client_ctx *cc)
|
|||||||
* that's probably more fair than if just the origin of
|
* that's probably more fair than if just the origin of
|
||||||
* a window is poking over a boundary
|
* a window is poking over a boundary
|
||||||
*/
|
*/
|
||||||
xine = client_find_xinerama_screen(cc->geom.x +
|
xine = screen_find_xinerama(CCTOSC(cc),
|
||||||
cc->geom.width / 2, cc->geom.y +
|
cc->geom.x + cc->geom.width / 2,
|
||||||
cc->geom.height / 2, CCTOSC(cc));
|
cc->geom.y + cc->geom.height / 2);
|
||||||
if (xine == NULL)
|
if (xine == NULL)
|
||||||
goto calc;
|
goto calc;
|
||||||
x_org = xine->x_org;
|
x_org = xine->x_org;
|
||||||
@ -373,9 +370,9 @@ client_vertmaximize(struct client_ctx *cc)
|
|||||||
cc->savegeom = cc->geom;
|
cc->savegeom = cc->geom;
|
||||||
if (HasXinerama) {
|
if (HasXinerama) {
|
||||||
XineramaScreenInfo *xine;
|
XineramaScreenInfo *xine;
|
||||||
xine = client_find_xinerama_screen(cc->geom.x +
|
xine = screen_find_xinerama(CCTOSC(cc),
|
||||||
cc->geom.width / 2, cc->geom.y +
|
cc->geom.x + cc->geom.width / 2,
|
||||||
cc->geom.height / 2, CCTOSC(cc));
|
cc->geom.y + cc->geom.height / 2);
|
||||||
if (xine == NULL)
|
if (xine == NULL)
|
||||||
goto calc;
|
goto calc;
|
||||||
y_org = xine->y_org;
|
y_org = xine->y_org;
|
||||||
@ -457,7 +454,7 @@ client_ptrsave(struct client_ctx *cc)
|
|||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
xu_ptr_getpos(cc->pwin, &x, &y);
|
xu_ptr_getpos(cc->pwin, &x, &y);
|
||||||
if (_inwindowbounds(cc, x, y)) {
|
if (_client_inbound(cc, x, y)) {
|
||||||
cc->ptr.x = x;
|
cc->ptr.x = x;
|
||||||
cc->ptr.y = y;
|
cc->ptr.y = y;
|
||||||
}
|
}
|
||||||
@ -728,7 +725,7 @@ client_placecalc(struct client_ctx *cc)
|
|||||||
|
|
||||||
xu_ptr_getpos(sc->rootwin, &xmouse, &ymouse);
|
xu_ptr_getpos(sc->rootwin, &xmouse, &ymouse);
|
||||||
if (HasXinerama) {
|
if (HasXinerama) {
|
||||||
info = client_find_xinerama_screen(xmouse, ymouse, sc);
|
info = screen_find_xinerama(sc, xmouse, ymouse);
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
goto noxine;
|
goto noxine;
|
||||||
xorig = info->x_org;
|
xorig = info->x_org;
|
||||||
@ -846,27 +843,9 @@ client_freehints(struct client_ctx *cc)
|
|||||||
xfree(cc->app_cliarg);
|
xfree(cc->app_cliarg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
_inwindowbounds(struct client_ctx *cc, int x, int y)
|
_client_inbound(struct client_ctx *cc, int x, int y)
|
||||||
{
|
{
|
||||||
return (x < cc->geom.width && x >= 0 &&
|
return (x < cc->geom.width && x >= 0 &&
|
||||||
y < cc->geom.height && y >= 0);
|
y < cc->geom.height && y >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Find which xinerama screen the coordinates (x,y) is on.
|
|
||||||
*/
|
|
||||||
XineramaScreenInfo *
|
|
||||||
client_find_xinerama_screen(int x, int y, struct screen_ctx *sc)
|
|
||||||
{
|
|
||||||
XineramaScreenInfo *info;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < sc->xinerama_no; i++) {
|
|
||||||
info = &sc->xinerama[i];
|
|
||||||
if (x > info->x_org && x < info->x_org + info->width &&
|
|
||||||
y > info->y_org && y < info->y_org + info->height)
|
|
||||||
return (info);
|
|
||||||
}
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
13
group.c
13
group.c
@ -24,6 +24,12 @@
|
|||||||
|
|
||||||
#define CALMWM_NGROUPS 9
|
#define CALMWM_NGROUPS 9
|
||||||
|
|
||||||
|
static void _group_add(struct group_ctx *, struct client_ctx *);
|
||||||
|
static void _group_remove(struct client_ctx *);
|
||||||
|
static void _group_hide(struct group_ctx *);
|
||||||
|
static void _group_show(struct group_ctx *);
|
||||||
|
static void _group_fix_hidden_state(struct group_ctx *);
|
||||||
|
|
||||||
struct group_ctx *Group_active = NULL;
|
struct group_ctx *Group_active = NULL;
|
||||||
struct group_ctx Groups[CALMWM_NGROUPS];
|
struct group_ctx Groups[CALMWM_NGROUPS];
|
||||||
int Grouphideall = 0;
|
int Grouphideall = 0;
|
||||||
@ -161,12 +167,9 @@ group_sticky_toggle_exit(struct client_ctx *cc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* selection list display
|
* if group_hidetoggle would produce no effect, toggle the group's hidden state
|
||||||
*/
|
*/
|
||||||
|
static void
|
||||||
/* if group_hidetoggle would produce no effect, toggle the group's hidden state
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_group_fix_hidden_state(struct group_ctx *gc)
|
_group_fix_hidden_state(struct group_ctx *gc)
|
||||||
{
|
{
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
18
screen.c
18
screen.c
@ -92,3 +92,21 @@ screen_init_xinerama(struct screen_ctx *sc)
|
|||||||
sc->xinerama = info;
|
sc->xinerama = info;
|
||||||
sc->xinerama_no = no;
|
sc->xinerama_no = no;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Find which xinerama screen the coordinates (x,y) is on.
|
||||||
|
*/
|
||||||
|
XineramaScreenInfo *
|
||||||
|
screen_find_xinerama(struct screen_ctx *sc, int x, int y)
|
||||||
|
{
|
||||||
|
XineramaScreenInfo *info;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < sc->xinerama_no; i++) {
|
||||||
|
info = &sc->xinerama[i];
|
||||||
|
if (x > info->x_org && x < info->x_org + info->width &&
|
||||||
|
y > info->y_org && y < info->y_org + info->height)
|
||||||
|
return (info);
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user