Screen stuff naming consistency and code tweaks.
SVN revision: 31874
This commit is contained in:
parent
e860b36218
commit
4880283400
|
@ -286,7 +286,7 @@ ArrangeRects(const RectBox * fixed, int fixed_count, RectBox * floating,
|
|||
{
|
||||
int xx1, yy1, xx2, yy2;
|
||||
|
||||
GetPointerScreenAvailableArea(&xx1, &yy1, &xx2, &yy2);
|
||||
ScreenGetAvailableAreaByPointer(&xx1, &yy1, &xx2, &yy2);
|
||||
xx2 += xx1;
|
||||
yy2 += yy1;
|
||||
if (startx < xx1)
|
||||
|
@ -958,7 +958,7 @@ ArrangeEwinCenteredXY(EWin * ewin, int *px, int *py)
|
|||
{
|
||||
int x, y, w, h;
|
||||
|
||||
GetPointerScreenAvailableArea(&x, &y, &w, &h);
|
||||
ScreenGetAvailableAreaByPointer(&x, &y, &w, &h);
|
||||
*px = (w - EoGetW(ewin)) / 2 + x;
|
||||
*py = (h - EoGetH(ewin)) / 2 + y;
|
||||
}
|
||||
|
|
|
@ -142,15 +142,12 @@ IPC_Screen(const char *params)
|
|||
}
|
||||
else if (!strcmp(param, "split"))
|
||||
{
|
||||
int i, j, nx, ny;
|
||||
unsigned int nx, ny;
|
||||
|
||||
nx = 2;
|
||||
ny = 1;
|
||||
sscanf(p, "%i %i\n", &nx, &ny);
|
||||
for (i = 0; i < nx; i++)
|
||||
for (j = 0; j < ny; j++)
|
||||
ScreenAdd(1, VRoot.scr, i * VRoot.w / nx, j * VRoot.h / ny,
|
||||
VRoot.w / nx, VRoot.h / ny);
|
||||
sscanf(p, "%u %u\n", &nx, &ny);
|
||||
ScreenSplit(nx, ny);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -318,8 +318,8 @@ MenuShow(Menu * m, char noshow)
|
|||
int x_origin;
|
||||
int y_origin;
|
||||
|
||||
head_num =
|
||||
GetPointerScreenGeometry(&x_origin, &y_origin, &width, &height);
|
||||
head_num = ScreenGetGeometryByPointer(&x_origin, &y_origin,
|
||||
&width, &height);
|
||||
|
||||
if (wx > x_origin + width - mw - b->border.right)
|
||||
wx = x_origin + width - mw - b->border.right;
|
||||
|
|
85
src/screen.c
85
src/screen.c
|
@ -61,6 +61,8 @@ ScreenAdd(int type, int head, int x, int y, unsigned int w, unsigned int h)
|
|||
void
|
||||
ScreenInit(void)
|
||||
{
|
||||
n_screens = 0; /* Causes reconfiguration */
|
||||
|
||||
#ifdef HAVE_XINERAMA
|
||||
XineramaScreenInfo *screens = NULL;
|
||||
int num_screens = 0;
|
||||
|
@ -79,6 +81,22 @@ ScreenInit(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ScreenSplit(unsigned int nx, unsigned int ny)
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
if (nx > 8 || ny > 8) /* At least some limit */
|
||||
return;
|
||||
|
||||
ScreenInit(); /* Reset screen configuration */
|
||||
|
||||
for (i = 0; i < nx; i++)
|
||||
for (j = 0; j < ny; j++)
|
||||
ScreenAdd(1, VRoot.scr, i * VRoot.w / nx, j * VRoot.h / ny,
|
||||
VRoot.w / nx, VRoot.h / ny);
|
||||
}
|
||||
|
||||
void
|
||||
ScreenShowInfo(const char *prm __UNUSED__)
|
||||
{
|
||||
|
@ -126,13 +144,41 @@ ScreenShowInfo(const char *prm __UNUSED__)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ScreenGetGeometryByHead(int head, int *px, int *py, int *pw, int *ph)
|
||||
{
|
||||
EScreen *ps;
|
||||
int x, y, w, h;
|
||||
|
||||
if (head > 0 && head < n_screens)
|
||||
{
|
||||
ps = p_screens + head;
|
||||
x = ps->x;
|
||||
y = ps->y;
|
||||
w = ps->w;
|
||||
h = ps->h;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = VRoot.w;
|
||||
h = VRoot.h;
|
||||
}
|
||||
|
||||
*px = x;
|
||||
*py = y;
|
||||
*pw = w;
|
||||
*ph = h;
|
||||
}
|
||||
|
||||
int
|
||||
ScreenGetGeometry(int xi, int yi, int *px, int *py, int *pw, int *ph)
|
||||
{
|
||||
int i, dx, dy, x, y, w, h, dist, ix;
|
||||
int i, dx, dy, dist, head;
|
||||
EScreen *ps;
|
||||
|
||||
ix = -1;
|
||||
head = 0;
|
||||
dist = 2147483647;
|
||||
|
||||
if (n_screens > 1)
|
||||
|
@ -147,38 +193,13 @@ ScreenGetGeometry(int xi, int yi, int *px, int *py, int *pw, int *ph)
|
|||
if (dx >= dist)
|
||||
continue;
|
||||
dist = dx;
|
||||
ix = i;
|
||||
head = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (ix >= 0)
|
||||
{
|
||||
ps = p_screens + ix;
|
||||
ix = ps->head;
|
||||
x = ps->x;
|
||||
y = ps->y;
|
||||
w = ps->w;
|
||||
h = ps->h;
|
||||
}
|
||||
else
|
||||
{
|
||||
ix = VRoot.scr;
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = VRoot.w;
|
||||
h = VRoot.h;
|
||||
}
|
||||
ScreenGetGeometryByHead(head, px, py, pw, ph);
|
||||
|
||||
if (px)
|
||||
*px = x;
|
||||
if (py)
|
||||
*py = y;
|
||||
if (pw)
|
||||
*pw = w;
|
||||
if (ph)
|
||||
*ph = h;
|
||||
|
||||
return ix;
|
||||
return head;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -238,7 +259,7 @@ ScreenGetAvailableArea(int xi, int yi, int *px, int *py, int *pw, int *ph)
|
|||
}
|
||||
|
||||
int
|
||||
GetPointerScreenGeometry(int *px, int *py, int *pw, int *ph)
|
||||
ScreenGetGeometryByPointer(int *px, int *py, int *pw, int *ph)
|
||||
{
|
||||
int pointer_x, pointer_y;
|
||||
|
||||
|
@ -248,7 +269,7 @@ GetPointerScreenGeometry(int *px, int *py, int *pw, int *ph)
|
|||
}
|
||||
|
||||
int
|
||||
GetPointerScreenAvailableArea(int *px, int *py, int *pw, int *ph)
|
||||
ScreenGetAvailableAreaByPointer(int *px, int *py, int *pw, int *ph)
|
||||
{
|
||||
int pointer_x, pointer_y;
|
||||
|
||||
|
|
11
src/screen.h
11
src/screen.h
|
@ -28,14 +28,17 @@
|
|||
void ScreenInit(void);
|
||||
void ScreenAdd(int type, int head, int x, int y, unsigned int w,
|
||||
unsigned int h);
|
||||
void ScreenSplit(unsigned int nx, unsigned int ny);
|
||||
void ScreenShowInfo(const char *prm);
|
||||
int ScreenGetGeometry(int x, int y, int *px, int *py,
|
||||
int *pw, int *ph);
|
||||
void ScreenGetGeometryByHead(int head, int *px, int *py,
|
||||
int *pw, int *ph);
|
||||
int ScreenGetAvailableArea(int x, int y, int *px, int *py,
|
||||
int *pw, int *ph);
|
||||
int GetPointerScreenGeometry(int *px, int *py,
|
||||
int *pw, int *ph);
|
||||
int GetPointerScreenAvailableArea(int *px, int *py,
|
||||
int *pw, int *ph);
|
||||
int ScreenGetGeometryByPointer(int *px, int *py,
|
||||
int *pw, int *ph);
|
||||
int ScreenGetAvailableAreaByPointer(int *px, int *py,
|
||||
int *pw, int *ph);
|
||||
|
||||
#endif /* _SCREEN_H_ */
|
||||
|
|
|
@ -164,7 +164,7 @@ WarpFocusWinShow(WarpFocusWin * fw)
|
|||
/* Reset shape */
|
||||
EShapeCombineMask(EoGetWin(fw), ShapeBounding, 0, 0, None, ShapeSet);
|
||||
|
||||
GetPointerScreenAvailableArea(&x, &y, &ww, &hh);
|
||||
ScreenGetAvailableAreaByPointer(&x, &y, &ww, &hh);
|
||||
x += (ww - w) / 2;
|
||||
y += (hh - h * warplist_num) / 2;
|
||||
EoMoveResize(fw, x, y, w, h * warplist_num);
|
||||
|
|
Loading…
Reference in New Issue