Fix min/maximise bugs/inconsistencies, simplify code.
Some xinerama code cleanups. SVN revision: 7197
This commit is contained in:
parent
2f580d7154
commit
5d300a6561
9
src/E.h
9
src/E.h
|
@ -1935,8 +1935,6 @@ void PastePixmap(Display * d, Drawable w, Pixmap p, Mask m,
|
|||
int x, int y);
|
||||
void PasteMask(Display * d, Drawable w, Pixmap p, int x, int y,
|
||||
int wd, int ht);
|
||||
int GetPointerScreenGeometry(int *px, int *py, int *pw,
|
||||
int *ph);
|
||||
|
||||
void CheckEvent(void);
|
||||
void WaitEvent(void);
|
||||
|
@ -3022,6 +3020,13 @@ char CanZoom(void);
|
|||
void ZoomInit(void);
|
||||
void Zoom(EWin * ewin);
|
||||
|
||||
/* screen.c functions */
|
||||
void ScreenInit(void);
|
||||
int ScreenGetGeometry(int x, int y, int *px, int *py,
|
||||
int *pw, int *ph);
|
||||
int GetPointerScreenGeometry(int *px, int *py,
|
||||
int *pw, int *ph);
|
||||
|
||||
/* Global vars */
|
||||
extern const char e_wm_name[];
|
||||
extern const char e_wm_version[];
|
||||
|
|
|
@ -64,6 +64,7 @@ enlightenment_SOURCES = \
|
|||
pager.c \
|
||||
progress.c \
|
||||
regex.c \
|
||||
screen.c \
|
||||
scursor.c \
|
||||
session.c \
|
||||
settings.c \
|
||||
|
|
115
src/arrange.c
115
src/arrange.c
|
@ -92,58 +92,22 @@ ArrangeRects(RectBox * fixed, int fixed_count, RectBox * floating,
|
|||
|
||||
#define Filled(x,y) (filled[(y * (xsize - 1)) + x])
|
||||
|
||||
#ifdef HAS_XINERAMA
|
||||
if (initial_window)
|
||||
{
|
||||
if (xinerama_active)
|
||||
{
|
||||
Window rt, ch;
|
||||
int d;
|
||||
unsigned int ud;
|
||||
int pointer_x, pointer_y;
|
||||
int num;
|
||||
XineramaScreenInfo *screens;
|
||||
int xx1, yy1, xx2, yy2;
|
||||
|
||||
XQueryPointer(disp, root.win, &rt, &ch, &pointer_x, &pointer_y, &d,
|
||||
&d, &ud);
|
||||
|
||||
screens = XineramaQueryScreens(disp, &num);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (pointer_x >= screens[i].x_org)
|
||||
{
|
||||
if (pointer_x <= (screens[i].width + screens[i].x_org))
|
||||
{
|
||||
if (pointer_y >= screens[i].y_org)
|
||||
{
|
||||
if (pointer_y <=
|
||||
(screens[i].height + screens[i].y_org))
|
||||
{
|
||||
if (screens[i].x_org > startx)
|
||||
startx = screens[i].x_org;
|
||||
if ((screens[i].x_org + screens[i].width)
|
||||
< width)
|
||||
width =
|
||||
screens[i].x_org + screens[i].width;
|
||||
if (screens[i].y_org > starty)
|
||||
starty = screens[i].y_org;
|
||||
if ((screens[i].y_org + screens[i].height)
|
||||
< height)
|
||||
height =
|
||||
screens[i].y_org +
|
||||
screens[i].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XFree(screens);
|
||||
}
|
||||
GetPointerScreenGeometry(&xx1, &yy1, &xx2, &yy2);
|
||||
xx2 += xx1;
|
||||
yy2 += yy1;
|
||||
if (startx < xx1)
|
||||
startx = xx1;
|
||||
if (width > xx2)
|
||||
width = xx2;
|
||||
if (starty < yy1)
|
||||
starty = yy1;
|
||||
if (height > yy2)
|
||||
height = yy2;
|
||||
}
|
||||
#else
|
||||
initial_window = 0;
|
||||
#endif
|
||||
|
||||
switch (policy)
|
||||
{
|
||||
|
@ -626,13 +590,7 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
|
|||
EWin **lst, **gwins;
|
||||
int gnum, num, i, j, screen_snap_dist, odx, ody;
|
||||
static char last_res = 0;
|
||||
|
||||
#ifdef HAS_XINERAMA
|
||||
static XineramaScreenInfo *screens = NULL;
|
||||
|
||||
#endif
|
||||
static int num_screens = 0;
|
||||
int top_bound, bottom_bound, left_bound, right_bound;
|
||||
int top_bound, bottom_bound, left_bound, right_bound, w, h;
|
||||
|
||||
EDBUG(5, "SnapEwin");
|
||||
if (!ewin)
|
||||
|
@ -645,49 +603,10 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
left_bound = 0;
|
||||
right_bound = root.w;
|
||||
top_bound = 0;
|
||||
bottom_bound = root.h;
|
||||
|
||||
screen_snap_dist =
|
||||
mode.constrained ? (root.w + root.h) : mode.screen_snap_dist;
|
||||
|
||||
#ifdef HAS_XINERAMA
|
||||
|
||||
if (xinerama_active)
|
||||
{
|
||||
if (!screens)
|
||||
screens = XineramaQueryScreens(disp, &num_screens);
|
||||
for (i = 0; i < num_screens; i++)
|
||||
{
|
||||
if (ewin->x >= screens[i].x_org)
|
||||
{
|
||||
if (ewin->x <= (screens[i].width + screens[i].x_org))
|
||||
{
|
||||
if (ewin->y >= screens[i].y_org)
|
||||
{
|
||||
if (ewin->y <=
|
||||
(screens[i].height + screens[i].y_org))
|
||||
{
|
||||
left_bound = screens[i].x_org;
|
||||
right_bound =
|
||||
screens[i].x_org + screens[i].width;
|
||||
top_bound = screens[i].y_org;
|
||||
bottom_bound =
|
||||
screens[i].y_org + screens[i].height;
|
||||
screen_snap_dist =
|
||||
mode.constrained ? (screens[i].width +
|
||||
screens[i].height) :
|
||||
mode.screen_snap_dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ScreenGetGeometry(ewin->x, ewin->y, &left_bound, &top_bound, &w, &h);
|
||||
right_bound = left_bound + w;
|
||||
bottom_bound = top_bound + h;
|
||||
screen_snap_dist = mode.constrained ? (w + h) : mode.screen_snap_dist;
|
||||
|
||||
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
||||
gwins = ListWinGroupMembersForEwin(ewin, ACTION_MOVE, mode.nogroup
|
||||
|
|
|
@ -703,12 +703,6 @@ HandleMotion(XEvent * ev)
|
|||
{
|
||||
int i, offx = 0, offy = 0, xdist = 0, ydist = 0;
|
||||
EWin *ewin;
|
||||
|
||||
#ifdef HAS_XINERAMA
|
||||
static XineramaScreenInfo *screens;
|
||||
static int num_screens;
|
||||
|
||||
#endif
|
||||
EWin *menus[256];
|
||||
int fx[256];
|
||||
int fy[256];
|
||||
|
@ -717,43 +711,8 @@ HandleMotion(XEvent * ev)
|
|||
static int menu_scroll_dist = 4;
|
||||
int my_width, my_height, x_org, y_org, head_num = 0;
|
||||
|
||||
my_width = root.w;
|
||||
my_height = root.h;
|
||||
x_org = 0;
|
||||
y_org = 0;
|
||||
|
||||
#ifdef HAS_XINERAMA
|
||||
if (xinerama_active)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!screens)
|
||||
{
|
||||
screens = XineramaQueryScreens(disp, &num_screens);
|
||||
}
|
||||
for (i = 0; i < num_screens; i++)
|
||||
{
|
||||
if (mode.x >= screens[i].x_org)
|
||||
{
|
||||
if (mode.x <= (screens[i].width + screens[i].x_org))
|
||||
{
|
||||
if (mode.y >= screens[i].y_org)
|
||||
{
|
||||
if (mode.y <=
|
||||
(screens[i].height + screens[i].y_org))
|
||||
{
|
||||
my_width = screens[i].width;
|
||||
my_height = screens[i].height;
|
||||
x_org = screens[i].x_org;
|
||||
y_org = screens[i].y_org;
|
||||
head_num = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
head_num = ScreenGetGeometry(mode.x, mode.y, &x_org, &y_org,
|
||||
&my_width, &my_height);
|
||||
|
||||
if (mode.x > ((x_org + my_width) - (menu_scroll_dist + 1)))
|
||||
{
|
||||
|
|
|
@ -77,9 +77,6 @@ char *badtheme = NULL;
|
|||
char *badreason = NULL;
|
||||
char *e_machine_name = NULL;
|
||||
|
||||
#ifdef HAS_XINERAMA
|
||||
char xinerama_active;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
int call_level;
|
||||
int debug_level;
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "E.h"
|
||||
#include <math.h>
|
||||
|
||||
#define _COORD_MODULO(a, b, c) { a = b % c; if (a < 0) a += c; }
|
||||
|
||||
static void IcondefChecker(int val, void *data);
|
||||
|
||||
#define IB_ANIM_TIME 0.25
|
||||
|
@ -276,7 +274,7 @@ DeIconifyEwin(EWin * ewin)
|
|||
{
|
||||
static int call_depth = 0;
|
||||
Iconbox *ib;
|
||||
int x, y;
|
||||
int x1, y1, x2, y2, dx, dy;
|
||||
|
||||
EDBUG(6, "DeIconifyEwin");
|
||||
call_depth++;
|
||||
|
@ -289,11 +287,29 @@ DeIconifyEwin(EWin * ewin)
|
|||
{
|
||||
ib = SelectIconboxForEwin(ewin);
|
||||
RemoveMiniIcon(ewin);
|
||||
|
||||
ScreenGetGeometry(ewin->x, ewin->y, &x1, &y1, &x2, &y2);
|
||||
/* Allow 75% of client (container) offscreen */
|
||||
dx = 3 * ewin->w / 4;
|
||||
dy = 3 * ewin->h / 4;
|
||||
x2 = x1 + x2 - (ewin->w - dx);
|
||||
y2 = y1 + y2 - (ewin->h - dy);
|
||||
x1 -= dx;
|
||||
y1 -= dy;
|
||||
dx = dy = 0;
|
||||
if (ewin->x < x1)
|
||||
dx = x1 - ewin->x;
|
||||
if (ewin->x > x2)
|
||||
dx = x2 - ewin->x;
|
||||
if (ewin->y < y1)
|
||||
dy = y1 - ewin->y;
|
||||
if (ewin->y > y2)
|
||||
dy = y2 - ewin->y;
|
||||
|
||||
if (!ewin->sticky)
|
||||
{
|
||||
_COORD_MODULO(x, ewin->x, root.w);
|
||||
_COORD_MODULO(y, ewin->y, root.h);
|
||||
MoveEwinToDesktopAt(ewin, desks.current, x, y);
|
||||
MoveEwinToDesktopAt(ewin, desks.current,
|
||||
ewin->x + dx, ewin->y + dy);
|
||||
}
|
||||
else
|
||||
ConformEwinToDesktop(ewin);
|
||||
|
@ -322,10 +338,9 @@ DeIconifyEwin(EWin * ewin)
|
|||
{
|
||||
if (!lst[i]->sticky)
|
||||
{
|
||||
_COORD_MODULO(x, lst[i]->x, root.w);
|
||||
_COORD_MODULO(y, lst[i]->y, root.h);
|
||||
MoveEwinToDesktopAt(lst[i], desks.current,
|
||||
x, y);
|
||||
lst[i]->x + dx,
|
||||
lst[i]->y + dy);
|
||||
}
|
||||
else
|
||||
ConformEwinToDesktop(lst[i]);
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright (C) 2000 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2003 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "E.h"
|
||||
|
||||
#ifdef HAS_XINERAMA
|
||||
char xinerama_active;
|
||||
static XineramaScreenInfo *screens = NULL;
|
||||
static int num_screens = 0;
|
||||
#endif
|
||||
|
||||
void
|
||||
ScreenInit(void)
|
||||
{
|
||||
#ifdef HAS_XINERAMA
|
||||
xinerama_active = XineramaIsActive(disp);
|
||||
mode.extra_head = 0;
|
||||
if (xinerama_active)
|
||||
screens = XineramaQueryScreens(disp, &num_screens);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
ScreenGetGeometry(int xi, int yi, int *px, int *py, int *pw, int *ph)
|
||||
{
|
||||
int x, y, w, h, head;
|
||||
|
||||
head = 0;
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = root.w;
|
||||
h = root.h;
|
||||
|
||||
#ifdef HAS_XINERAMA
|
||||
if (xinerama_active)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_screens; i++)
|
||||
{
|
||||
XineramaScreenInfo *ps = &screens[i];
|
||||
|
||||
if (xi >= ps->x_org && xi < ps->x_org + ps->width &&
|
||||
yi >= ps->y_org && yi < ps->y_org + ps->height)
|
||||
{
|
||||
x = ps->x_org;
|
||||
y = ps->y_org;
|
||||
w = ps->width;
|
||||
h = ps->height;
|
||||
head = i;
|
||||
/* NB! *First* matching head is used */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (px)
|
||||
*px = x;
|
||||
if (py)
|
||||
*py = y;
|
||||
if (pw)
|
||||
*pw = w;
|
||||
if (ph)
|
||||
*ph = h;
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
int
|
||||
GetPointerScreenGeometry(int *px, int *py, int *pw, int *ph)
|
||||
{
|
||||
Window rt, ch;
|
||||
int pointer_x, pointer_y;
|
||||
int d;
|
||||
unsigned int ud;
|
||||
|
||||
XQueryPointer(disp, root.win, &rt, &ch, &pointer_x, &pointer_y, &d, &d, &ud);
|
||||
|
||||
return ScreenGetGeometry(pointer_x, pointer_y, px, py, pw, ph);
|
||||
}
|
|
@ -606,10 +606,7 @@ SetupX()
|
|||
desks.hiqualitybg = 1;
|
||||
SetAreaSize(2, 1);
|
||||
|
||||
#ifdef HAS_XINERAMA
|
||||
xinerama_active = XineramaIsActive(disp);
|
||||
mode.extra_head = 0;
|
||||
#endif
|
||||
ScreenInit();
|
||||
|
||||
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; task_menu[i++] = NULL);
|
||||
|
||||
|
|
805
src/size.c
805
src/size.c
|
@ -1,6 +1,6 @@
|
|||
|
||||
/*
|
||||
* Copyright (C) 2000 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2003 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -23,197 +23,24 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
|
||||
void
|
||||
MaxHeight(EWin * ewin, char *resize_type)
|
||||
{
|
||||
#define MAX_HOR 0x1
|
||||
#define MAX_VER 0x2
|
||||
|
||||
int x, y, w, h, y1, y2;
|
||||
#define MAX_ABSOLUTE 0
|
||||
#define MAX_AVAILABLE 1
|
||||
#define MAX_CONSERVATIVE 2
|
||||
|
||||
static void
|
||||
MaxSizeHV(EWin * ewin, char *resize_type, int direction)
|
||||
{
|
||||
int x, y, w, h, x1, x2, y1, y2, type;
|
||||
EWin **lst, *pe;
|
||||
int i, num;
|
||||
|
||||
if (!ewin)
|
||||
return;
|
||||
|
||||
if (!ewin->toggle)
|
||||
{
|
||||
x = ewin->x;
|
||||
y = 0;
|
||||
w = ewin->client.w;
|
||||
h = root.h - ewin->border->border.top - ewin->border->border.bottom;
|
||||
if ((resize_type) && (!strcmp(resize_type, "available")))
|
||||
{
|
||||
EWin **lst;
|
||||
int i, num;
|
||||
|
||||
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
||||
if (lst)
|
||||
{
|
||||
y = ewin->y;
|
||||
h = ewin->h;
|
||||
#if ENABLE_KDE
|
||||
if (mode.kde_support)
|
||||
{
|
||||
y1 = mode.kde_y1;
|
||||
y2 = mode.kde_y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
y1 = 0;
|
||||
y2 = root.h;
|
||||
#if ENABLE_KDE
|
||||
}
|
||||
#endif
|
||||
#ifdef HAS_XINERAMA
|
||||
if (xinerama_active)
|
||||
{
|
||||
XineramaScreenInfo *screens;
|
||||
int num_screens;
|
||||
|
||||
screens = XineramaQueryScreens(disp, &num_screens);
|
||||
for (i = 0; i < num_screens; i++)
|
||||
{
|
||||
if (ewin->x >= screens[i].x_org)
|
||||
{
|
||||
if (ewin->x <=
|
||||
(screens[i].width + screens[i].x_org))
|
||||
{
|
||||
if (ewin->y >= screens[i].y_org)
|
||||
{
|
||||
if (ewin->y <=
|
||||
(screens[i].height +
|
||||
screens[i].y_org))
|
||||
{
|
||||
if (screens[i].y_org > y1)
|
||||
{
|
||||
y1 = screens[i].y_org;
|
||||
}
|
||||
if (screens[i].y_org +
|
||||
screens[i].height < y2)
|
||||
{
|
||||
y2 = screens[i].y_org +
|
||||
screens[i].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if ((((ewin->desktop == lst[i]->desktop)
|
||||
&& !(lst[i]->iconified)) || (lst[i]->sticky))
|
||||
&& (!(lst[i]->floating)) && (lst[i] != ewin)
|
||||
&& (!(lst[i]->ignorearrange))
|
||||
&& SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
|
||||
lst[i]->w))
|
||||
{
|
||||
if (((lst[i]->y + lst[i]->h) <= y)
|
||||
&& ((lst[i]->y + lst[i]->h) >= y1))
|
||||
y1 = lst[i]->y + lst[i]->h;
|
||||
else if (((y + h) <= lst[i]->y)
|
||||
&& (y2 >= lst[i]->y))
|
||||
y2 = lst[i]->y;
|
||||
}
|
||||
}
|
||||
Efree(lst);
|
||||
y = y1;
|
||||
h = y2 - y1 - (ewin->border->border.top +
|
||||
ewin->border->border.bottom);
|
||||
}
|
||||
}
|
||||
else if ((resize_type) && (!strcmp(resize_type, "conservative")))
|
||||
{
|
||||
EWin **lst;
|
||||
int i, num;
|
||||
|
||||
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
||||
if (lst)
|
||||
{
|
||||
y = ewin->y;
|
||||
h = ewin->h;
|
||||
#if ENABLE_KDE
|
||||
if (mode.kde_support)
|
||||
{
|
||||
y1 = mode.kde_y1;
|
||||
y2 = mode.kde_y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
y1 = 0;
|
||||
y2 = root.h;
|
||||
#if ENABLE_KDE
|
||||
}
|
||||
#endif
|
||||
#ifdef HAS_XINERAMA
|
||||
if (xinerama_active)
|
||||
{
|
||||
XineramaScreenInfo *screens;
|
||||
int num_screens;
|
||||
|
||||
screens = XineramaQueryScreens(disp, &num_screens);
|
||||
for (i = 0; i < num_screens; i++)
|
||||
{
|
||||
if (ewin->x >= screens[i].x_org)
|
||||
{
|
||||
if (ewin->x <=
|
||||
(screens[i].width + screens[i].x_org))
|
||||
{
|
||||
if (ewin->y >= screens[i].y_org)
|
||||
{
|
||||
if (ewin->y <=
|
||||
(screens[i].height +
|
||||
screens[i].y_org))
|
||||
{
|
||||
if (screens[i].y_org > y1)
|
||||
{
|
||||
y1 = screens[i].y_org;
|
||||
}
|
||||
if (screens[i].y_org +
|
||||
screens[i].height < y2)
|
||||
{
|
||||
y2 = screens[i].y_org +
|
||||
screens[i].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if ((((ewin->desktop == lst[i]->desktop)
|
||||
&& !(lst[i]->iconified)) || (lst[i]->sticky))
|
||||
&& (!(lst[i]->floating)) && (lst[i] != ewin)
|
||||
&& (lst[i]->never_use_area)
|
||||
&& SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
|
||||
lst[i]->w))
|
||||
{
|
||||
if (((lst[i]->y + lst[i]->h) <= y)
|
||||
&& ((lst[i]->y + lst[i]->h) >= y1))
|
||||
y1 = lst[i]->y + lst[i]->h;
|
||||
else if (((y + h) <= lst[i]->y)
|
||||
&& (y2 >= lst[i]->y))
|
||||
y2 = lst[i]->y;
|
||||
}
|
||||
}
|
||||
Efree(lst);
|
||||
y = y1;
|
||||
h = y2 - y1 - (ewin->border->border.top +
|
||||
ewin->border->border.bottom);
|
||||
}
|
||||
}
|
||||
ewin->lx = ewin->x;
|
||||
ewin->ly = ewin->y;
|
||||
ewin->lw = ewin->client.w;
|
||||
ewin->lh = ewin->client.h;
|
||||
MoveResizeEwin(ewin, x, y, w, h);
|
||||
ewin->toggle = 1;
|
||||
}
|
||||
else
|
||||
if (ewin->toggle)
|
||||
{
|
||||
MoveResizeEwin(ewin, ewin->lx, ewin->ly, ewin->lw, ewin->lh);
|
||||
ewin->lx = ewin->x;
|
||||
|
@ -221,493 +48,145 @@ MaxHeight(EWin * ewin, char *resize_type)
|
|||
ewin->lw = ewin->client.w;
|
||||
ewin->lh = ewin->client.h;
|
||||
ewin->toggle = 0;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
return;
|
||||
if ((resize_type) && (!strcmp(resize_type, "available")))
|
||||
type = MAX_AVAILABLE;
|
||||
else if ((resize_type) && (!strcmp(resize_type, "conservative")))
|
||||
type = MAX_CONSERVATIVE;
|
||||
else
|
||||
type = MAX_ABSOLUTE;
|
||||
|
||||
/* Default is no change */
|
||||
y = ewin->y;
|
||||
h = ewin->h;
|
||||
x = ewin->x;
|
||||
w = ewin->w;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case MAX_ABSOLUTE:
|
||||
if (direction & MAX_HOR)
|
||||
{
|
||||
x = 0;
|
||||
w = root.w - ewin->border->border.left -
|
||||
ewin->border->border.right;
|
||||
}
|
||||
if (direction & MAX_VER)
|
||||
{
|
||||
y = 0;
|
||||
h = root.h - ewin->border->border.top -
|
||||
ewin->border->border.bottom;
|
||||
}
|
||||
break;
|
||||
|
||||
case MAX_CONSERVATIVE:
|
||||
case MAX_AVAILABLE:
|
||||
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
||||
if (!lst)
|
||||
break;
|
||||
|
||||
ScreenGetGeometry(ewin->x, ewin->y, &x1, &y1, &x2, &y2);
|
||||
x2 += x1;
|
||||
y2 += y1;
|
||||
|
||||
#if ENABLE_KDE
|
||||
if (mode.kde_support)
|
||||
{
|
||||
if (x1 < mode.kde_x1)
|
||||
x1 = mode.kde_x1;
|
||||
if (x2 > mode.kde_x2)
|
||||
x2 = mode.kde_x2;
|
||||
if (y1 < mode.kde_y1)
|
||||
y1 = mode.kde_y1;
|
||||
if (y2 > mode.kde_y2)
|
||||
y2 = mode.kde_y2;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (direction & MAX_VER)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
pe = lst[i];
|
||||
if (pe == ewin ||
|
||||
pe->iconified ||
|
||||
pe->floating ||
|
||||
pe->ignorearrange ||
|
||||
(ewin->desktop != pe->desktop && !pe->sticky) ||
|
||||
(pe->type & (EWIN_TYPE_DIALOG | EWIN_TYPE_MENU)) ||
|
||||
(type == MAX_AVAILABLE && pe->never_use_area) ||
|
||||
!SPANS_COMMON(x, w, pe->x, pe->w))
|
||||
continue;
|
||||
|
||||
if (((pe->y + pe->h) <= y) && ((pe->y + pe->h) >= y1))
|
||||
y1 = pe->y + pe->h;
|
||||
else if (((y + h) <= pe->y) && (y2 >= pe->y))
|
||||
y2 = pe->y;
|
||||
}
|
||||
y = y1;
|
||||
h = y2 - y1 - (ewin->border->border.top +
|
||||
ewin->border->border.bottom);
|
||||
}
|
||||
|
||||
if (direction & MAX_HOR)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
pe = lst[i];
|
||||
if (pe == ewin ||
|
||||
pe->iconified ||
|
||||
pe->floating ||
|
||||
pe->ignorearrange ||
|
||||
(ewin->desktop != pe->desktop && !pe->sticky) ||
|
||||
(pe->type & (EWIN_TYPE_DIALOG | EWIN_TYPE_MENU)) ||
|
||||
(type == MAX_AVAILABLE && pe->never_use_area) ||
|
||||
!SPANS_COMMON(y, h, pe->y, pe->h))
|
||||
continue;
|
||||
|
||||
if (((pe->x + pe->w) <= x) && ((pe->x + pe->w) >= x1))
|
||||
x1 = pe->x + pe->w;
|
||||
else if (((x + w) <= pe->x) && (x2 >= pe->x))
|
||||
x2 = pe->x;
|
||||
}
|
||||
x = x1;
|
||||
w = x2 - x1 - (ewin->border->border.left +
|
||||
ewin->border->border.right);
|
||||
}
|
||||
|
||||
Efree(lst);
|
||||
break;
|
||||
}
|
||||
|
||||
ewin->lx = ewin->x;
|
||||
ewin->ly = ewin->y;
|
||||
ewin->lw = ewin->client.w;
|
||||
ewin->lh = ewin->client.h;
|
||||
MoveResizeEwin(ewin, x, y, w, h);
|
||||
ewin->toggle = 1;
|
||||
|
||||
exit:;
|
||||
#if ENABLE_KDE
|
||||
if (mode.kde_support)
|
||||
KDE_UpdateClient(ewin);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
MaxWidth(EWin * ewin, char *resize_type)
|
||||
{
|
||||
MaxSizeHV(ewin, resize_type, MAX_HOR);
|
||||
}
|
||||
|
||||
int x, y, w, h, x1, x2;
|
||||
|
||||
if (!ewin)
|
||||
return;
|
||||
|
||||
if (!ewin->toggle)
|
||||
{
|
||||
x = 0;
|
||||
y = ewin->y;
|
||||
w = root.w - ewin->border->border.left - ewin->border->border.right;
|
||||
h = ewin->client.h;
|
||||
if ((resize_type) && (!strcmp(resize_type, "available")))
|
||||
{
|
||||
EWin **lst;
|
||||
int i, num;
|
||||
|
||||
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
||||
if (lst)
|
||||
{
|
||||
x = ewin->x;
|
||||
w = ewin->w;
|
||||
#if ENABLE_KDE
|
||||
if (mode.kde_support)
|
||||
{
|
||||
x1 = mode.kde_x1;
|
||||
x2 = mode.kde_x2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
x1 = 0;
|
||||
x2 = root.w;
|
||||
#if ENABLE_KDE
|
||||
}
|
||||
#endif
|
||||
#ifdef HAS_XINERAMA
|
||||
if (xinerama_active)
|
||||
{
|
||||
XineramaScreenInfo *screens;
|
||||
int num_screens;
|
||||
|
||||
screens = XineramaQueryScreens(disp, &num_screens);
|
||||
for (i = 0; i < num_screens; i++)
|
||||
{
|
||||
if (ewin->x >= screens[i].x_org)
|
||||
{
|
||||
if (ewin->x <=
|
||||
(screens[i].width + screens[i].x_org))
|
||||
{
|
||||
if (ewin->y >= screens[i].y_org)
|
||||
{
|
||||
if (ewin->y <=
|
||||
(screens[i].height +
|
||||
screens[i].y_org))
|
||||
{
|
||||
if (screens[i].x_org > x1)
|
||||
{
|
||||
x1 = screens[i].x_org;
|
||||
}
|
||||
if (screens[i].x_org +
|
||||
screens[i].width < x2)
|
||||
{
|
||||
x2 = screens[i].x_org +
|
||||
screens[i].width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if ((((ewin->desktop == lst[i]->desktop)
|
||||
&& !(lst[i]->iconified)) || (lst[i]->sticky))
|
||||
&& (!(lst[i]->floating)) && (lst[i] != ewin)
|
||||
&& (!(lst[i]->ignorearrange))
|
||||
&& SPANS_COMMON(ewin->y, ewin->h, lst[i]->y,
|
||||
lst[i]->h))
|
||||
{
|
||||
if (((lst[i]->x + lst[i]->w) <= x)
|
||||
&& ((lst[i]->x + lst[i]->w) >= x1))
|
||||
x1 = lst[i]->x + lst[i]->w;
|
||||
else if (((x + w) <= lst[i]->x)
|
||||
&& (x2 >= lst[i]->x))
|
||||
x2 = lst[i]->x;
|
||||
}
|
||||
}
|
||||
Efree(lst);
|
||||
x = x1;
|
||||
w = x2 - x1 - (ewin->border->border.left +
|
||||
ewin->border->border.right);
|
||||
}
|
||||
}
|
||||
else if ((resize_type) && (!strcmp(resize_type, "conservative")))
|
||||
{
|
||||
EWin **lst;
|
||||
int i, num;
|
||||
|
||||
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
||||
if (lst)
|
||||
{
|
||||
x = ewin->x;
|
||||
w = ewin->w;
|
||||
#if ENABLE_KDE
|
||||
if (mode.kde_support)
|
||||
{
|
||||
x1 = mode.kde_x1;
|
||||
x2 = mode.kde_x2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
x1 = 0;
|
||||
x2 = root.w;
|
||||
#if ENABLE_KDE
|
||||
}
|
||||
#endif
|
||||
#ifdef HAS_XINERAMA
|
||||
if (xinerama_active)
|
||||
{
|
||||
XineramaScreenInfo *screens;
|
||||
int num_screens;
|
||||
|
||||
screens = XineramaQueryScreens(disp, &num_screens);
|
||||
for (i = 0; i < num_screens; i++)
|
||||
{
|
||||
if (ewin->x >= screens[i].x_org)
|
||||
{
|
||||
if (ewin->x <=
|
||||
(screens[i].width + screens[i].x_org))
|
||||
{
|
||||
if (ewin->y >= screens[i].y_org)
|
||||
{
|
||||
if (ewin->y <=
|
||||
(screens[i].height +
|
||||
screens[i].y_org))
|
||||
{
|
||||
if (screens[i].x_org > x1)
|
||||
{
|
||||
x1 = screens[i].x_org;
|
||||
}
|
||||
if (screens[i].x_org +
|
||||
screens[i].width < x2)
|
||||
{
|
||||
x2 = screens[i].x_org +
|
||||
screens[i].width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if ((lst[i] != ewin) && (!(lst[i]->ignorearrange))
|
||||
&& (!(lst[i]->floating)) && !(lst[i]->iconified)
|
||||
&&
|
||||
(((ewin->desktop
|
||||
== lst[i]->desktop) && (lst[i]->fixedpos))
|
||||
|| (lst[i]->sticky))
|
||||
&& SPANS_COMMON(ewin->y, ewin->h, lst[i]->y,
|
||||
lst[i]->h))
|
||||
{
|
||||
if (((lst[i]->x + lst[i]->w) <= x)
|
||||
&& ((lst[i]->x + lst[i]->w) >= x1))
|
||||
x1 = lst[i]->x + lst[i]->w;
|
||||
else if (((x + w) <= lst[i]->x)
|
||||
&& (x2 >= lst[i]->x))
|
||||
x2 = lst[i]->x;
|
||||
}
|
||||
}
|
||||
Efree(lst);
|
||||
x = x1;
|
||||
w = x2 - x1 - (ewin->border->border.left +
|
||||
ewin->border->border.right);
|
||||
}
|
||||
}
|
||||
ewin->lx = ewin->x;
|
||||
ewin->ly = ewin->y;
|
||||
ewin->lw = ewin->client.w;
|
||||
ewin->lh = ewin->client.h;
|
||||
MoveResizeEwin(ewin, x, y, w, h);
|
||||
ewin->toggle = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveResizeEwin(ewin, ewin->lx, ewin->ly, ewin->lw, ewin->lh);
|
||||
ewin->lx = ewin->x;
|
||||
ewin->ly = ewin->y;
|
||||
ewin->lw = ewin->client.w;
|
||||
ewin->lh = ewin->client.h;
|
||||
ewin->toggle = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
void
|
||||
MaxHeight(EWin * ewin, char *resize_type)
|
||||
{
|
||||
MaxSizeHV(ewin, resize_type, MAX_VER);
|
||||
}
|
||||
|
||||
void
|
||||
MaxSize(EWin * ewin, char *resize_type)
|
||||
{
|
||||
|
||||
int x, y, w, h, x1, x2, y1, y2;
|
||||
|
||||
if (!ewin)
|
||||
return;
|
||||
|
||||
if (!ewin->toggle)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = root.w - ewin->border->border.left - ewin->border->border.right;
|
||||
h = root.h - ewin->border->border.top - ewin->border->border.bottom;
|
||||
if ((resize_type) && (!strcmp(resize_type, "available")))
|
||||
{
|
||||
EWin **lst;
|
||||
int i, num;
|
||||
|
||||
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
||||
if (lst)
|
||||
{
|
||||
y = ewin->y;
|
||||
h = ewin->h;
|
||||
x = ewin->x;
|
||||
w = ewin->w;
|
||||
#if ENABLE_KDE
|
||||
if (mode.kde_support)
|
||||
{
|
||||
x1 = mode.kde_x1;
|
||||
x2 = mode.kde_x2;
|
||||
y1 = mode.kde_y1;
|
||||
y2 = mode.kde_y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
x1 = 0;
|
||||
x2 = root.w;
|
||||
y1 = 0;
|
||||
y2 = root.h;
|
||||
#if ENABLE_KDE
|
||||
}
|
||||
#endif
|
||||
#ifdef HAS_XINERAMA
|
||||
if (xinerama_active)
|
||||
{
|
||||
XineramaScreenInfo *screens;
|
||||
int num_screens;
|
||||
|
||||
screens = XineramaQueryScreens(disp, &num_screens);
|
||||
for (i = 0; i < num_screens; i++)
|
||||
{
|
||||
if (ewin->x >= screens[i].x_org)
|
||||
{
|
||||
if (ewin->x <=
|
||||
(screens[i].width + screens[i].x_org))
|
||||
{
|
||||
if (ewin->y >= screens[i].y_org)
|
||||
{
|
||||
if (ewin->y <=
|
||||
(screens[i].height +
|
||||
screens[i].y_org))
|
||||
{
|
||||
if (screens[i].x_org > x1)
|
||||
{
|
||||
x1 = screens[i].x_org;
|
||||
}
|
||||
if (screens[i].x_org +
|
||||
screens[i].width < x2)
|
||||
{
|
||||
x2 = screens[i].x_org +
|
||||
screens[i].width;
|
||||
}
|
||||
if (screens[i].y_org > y1)
|
||||
{
|
||||
y1 = screens[i].y_org;
|
||||
}
|
||||
if (screens[i].y_org +
|
||||
screens[i].height < y2)
|
||||
{
|
||||
y2 = screens[i].y_org +
|
||||
screens[i].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if ((((ewin->desktop == lst[i]->desktop)
|
||||
&& !(lst[i]->iconified)) || (lst[i]->sticky))
|
||||
&& (!(lst[i]->floating)) && (lst[i] != ewin)
|
||||
&& (!(lst[i]->ignorearrange))
|
||||
&& SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
|
||||
lst[i]->w))
|
||||
{
|
||||
if (((lst[i]->y + lst[i]->h) <= y)
|
||||
&& ((lst[i]->y + lst[i]->h) >= y1))
|
||||
y1 = lst[i]->y + lst[i]->h;
|
||||
else if (((y + h) <= lst[i]->y)
|
||||
&& (y2 >= lst[i]->y))
|
||||
y2 = lst[i]->y;
|
||||
}
|
||||
}
|
||||
y = y1;
|
||||
h = y2 - y1 - (ewin->border->border.top +
|
||||
ewin->border->border.bottom);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (((ewin->desktop == lst[i]->desktop)
|
||||
|| (lst[i]->sticky)) && (!(lst[i]->floating))
|
||||
&& (lst[i] != ewin) && (!(lst[i]->ignorearrange))
|
||||
&& SPANS_COMMON(y, h, lst[i]->y, lst[i]->h))
|
||||
{
|
||||
if (((lst[i]->x + lst[i]->w) <= x)
|
||||
&& ((lst[i]->x + lst[i]->w) >= x1))
|
||||
x1 = lst[i]->x + lst[i]->w;
|
||||
else if (((x + w) <= lst[i]->x)
|
||||
&& (x2 >= lst[i]->x))
|
||||
x2 = lst[i]->x;
|
||||
}
|
||||
}
|
||||
x = x1;
|
||||
w = x2 - x1 - (ewin->border->border.left +
|
||||
ewin->border->border.right);
|
||||
Efree(lst);
|
||||
}
|
||||
}
|
||||
else if ((resize_type) && (!strcmp(resize_type, "conservative")))
|
||||
{
|
||||
EWin **lst;
|
||||
int i, num;
|
||||
|
||||
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
||||
if (lst)
|
||||
{
|
||||
y = ewin->y;
|
||||
h = ewin->h;
|
||||
x = ewin->x;
|
||||
w = ewin->w;
|
||||
#if ENABLE_KDE
|
||||
if (mode.kde_support)
|
||||
{
|
||||
x1 = mode.kde_x1;
|
||||
x2 = mode.kde_x2;
|
||||
y1 = mode.kde_y1;
|
||||
y2 = mode.kde_y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
x1 = 0;
|
||||
x2 = root.w;
|
||||
y1 = 0;
|
||||
y2 = root.h;
|
||||
#if ENABLE_KDE
|
||||
}
|
||||
#endif
|
||||
#ifdef HAS_XINERAMA
|
||||
if (xinerama_active)
|
||||
{
|
||||
XineramaScreenInfo *screens;
|
||||
int num_screens;
|
||||
|
||||
screens = XineramaQueryScreens(disp, &num_screens);
|
||||
for (i = 0; i < num_screens; i++)
|
||||
{
|
||||
if (ewin->x >= screens[i].x_org)
|
||||
{
|
||||
if (ewin->x <=
|
||||
(screens[i].width + screens[i].x_org))
|
||||
{
|
||||
if (ewin->y >= screens[i].y_org)
|
||||
{
|
||||
if (ewin->y <=
|
||||
(screens[i].height +
|
||||
screens[i].y_org))
|
||||
{
|
||||
if (screens[i].x_org > x1)
|
||||
{
|
||||
x1 = screens[i].x_org;
|
||||
}
|
||||
if (screens[i].x_org +
|
||||
screens[i].width < x2)
|
||||
{
|
||||
x2 = screens[i].x_org +
|
||||
screens[i].width;
|
||||
}
|
||||
if (screens[i].y_org > y1)
|
||||
{
|
||||
y1 = screens[i].y_org;
|
||||
}
|
||||
if (screens[i].y_org +
|
||||
screens[i].height < y2)
|
||||
{
|
||||
y2 = screens[i].y_org +
|
||||
screens[i].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (((lst[i] != ewin) && (!(lst[i]->ignorearrange))
|
||||
&& !(lst[i]->iconified)) && (!(lst[i]->floating))
|
||||
&&
|
||||
(((ewin->desktop
|
||||
== lst[i]->desktop) && (lst[i]->fixedpos))
|
||||
|| (lst[i]->sticky))
|
||||
&& SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
|
||||
lst[i]->w))
|
||||
{
|
||||
if (((lst[i]->y + lst[i]->h) <= y)
|
||||
&& ((lst[i]->y + lst[i]->h) >= y1))
|
||||
y1 = lst[i]->y + lst[i]->h;
|
||||
else if (((y + h) <= lst[i]->y)
|
||||
&& (y2 >= lst[i]->y))
|
||||
y2 = lst[i]->y;
|
||||
}
|
||||
}
|
||||
y = y1;
|
||||
h = y2 - y1 - (ewin->border->border.top +
|
||||
ewin->border->border.bottom);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if ((lst[i] != ewin) && (!(lst[i]->ignorearrange))
|
||||
&& (!(lst[i]->floating))
|
||||
&&
|
||||
(((ewin->desktop
|
||||
== lst[i]->desktop) && (lst[i]->fixedpos))
|
||||
|| (lst[i]->sticky))
|
||||
&& SPANS_COMMON(y, h, lst[i]->y, lst[i]->h))
|
||||
{
|
||||
if (((lst[i]->x + lst[i]->w) <= x)
|
||||
&& ((lst[i]->x + lst[i]->w) >= x1))
|
||||
x1 = lst[i]->x + lst[i]->w;
|
||||
else if (((x + w) <= lst[i]->x)
|
||||
&& (x2 >= lst[i]->x))
|
||||
x2 = lst[i]->x;
|
||||
}
|
||||
}
|
||||
x = x1;
|
||||
w = x2 - x1 - (ewin->border->border.left +
|
||||
ewin->border->border.right);
|
||||
Efree(lst);
|
||||
}
|
||||
}
|
||||
ewin->lx = ewin->x;
|
||||
ewin->ly = ewin->y;
|
||||
ewin->lw = ewin->client.w;
|
||||
ewin->lh = ewin->client.h;
|
||||
MoveResizeEwin(ewin, x, y, w, h);
|
||||
ewin->toggle = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveResizeEwin(ewin, ewin->lx, ewin->ly, ewin->lw, ewin->lh);
|
||||
ewin->lx = ewin->x;
|
||||
ewin->ly = ewin->y;
|
||||
ewin->lw = ewin->client.w;
|
||||
ewin->lh = ewin->client.h;
|
||||
ewin->toggle = 0;
|
||||
}
|
||||
|
||||
#if ENABLE_KDE
|
||||
if (mode.kde_support)
|
||||
KDE_UpdateClient(ewin);
|
||||
#endif
|
||||
|
||||
return;
|
||||
MaxSizeHV(ewin, resize_type, MAX_HOR | MAX_VER);
|
||||
}
|
||||
|
|
47
src/x.c
47
src/x.c
|
@ -908,50 +908,3 @@ PasteMask(Display * d, Drawable w, Pixmap p, int x, int y, int wd, int ht)
|
|||
XFillRectangle(disp, w, gc, x, y, wd, ht);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
GetPointerScreenGeometry(int *px, int *py, int *pw, int *ph)
|
||||
{
|
||||
int head = 0;
|
||||
|
||||
#ifdef HAS_XINERAMA
|
||||
if (xinerama_active)
|
||||
{
|
||||
int i;
|
||||
Window rt, ch;
|
||||
XineramaScreenInfo *screens;
|
||||
int pointer_x, pointer_y;
|
||||
int num;
|
||||
int d;
|
||||
unsigned int ud;
|
||||
|
||||
XQueryPointer(disp, root.win, &rt, &ch, &pointer_x, &pointer_y, &d,
|
||||
&d, &ud);
|
||||
screens = XineramaQueryScreens(disp, &num);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (pointer_x >= screens[i].x_org &&
|
||||
pointer_x <= (screens[i].width + screens[i].x_org) &&
|
||||
pointer_y >= screens[i].y_org &&
|
||||
pointer_y <= (screens[i].height + screens[i].y_org))
|
||||
{
|
||||
*px = screens[i].x_org;
|
||||
*py = screens[i].y_org;
|
||||
*pw = screens[i].width;
|
||||
*ph = screens[i].height;
|
||||
head = i;
|
||||
}
|
||||
}
|
||||
XFree(screens);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
*px = 0;
|
||||
*py = 0;
|
||||
*pw = root.w;
|
||||
*ph = root.h;
|
||||
}
|
||||
|
||||
return head;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue