Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h Makefile.am arrange.c evhandlers.c globals.c iconify.c
setup.c size.c x.c
Added Files:
screen.c
Log Message:
Fix min/maximise bugs/inconsistencies, simplify code.
Some xinerama code cleanups.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -3 -r1.131 -r1.132
--- E.h 15 Jul 2003 18:35:02 -0000 1.131
+++ E.h 20 Jul 2003 18:02:15 -0000 1.132
@@ -1935,8 +1935,6 @@
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);
@@ -3021,6 +3019,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[];
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- Makefile.am 15 Jul 2003 18:35:03 -0000 1.14
+++ Makefile.am 20 Jul 2003 18:02:16 -0000 1.15
@@ -64,6 +64,7 @@
pager.c \
progress.c \
regex.c \
+ screen.c \
scursor.c \
session.c \
settings.c \
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/arrange.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -3 -r1.54 -r1.55
--- arrange.c 15 Jun 2003 21:43:06 -0000 1.54
+++ arrange.c 20 Jul 2003 18:02:16 -0000 1.55
@@ -92,58 +92,22 @@
#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;
-
- 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;
- }
- }
- }
- }
- }
+ int xx1, yy1, xx2, yy2;
- 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 @@
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 @@
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
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -3 -r1.116 -r1.117
--- evhandlers.c 12 Jul 2003 09:21:38 -0000 1.116
+++ evhandlers.c 20 Jul 2003 18:02:16 -0000 1.117
@@ -703,12 +703,6 @@
{
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 @@
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)))
{
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/globals.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- globals.c 12 Jul 2003 15:04:31 -0000 1.16
+++ globals.c 20 Jul 2003 18:02:16 -0000 1.17
@@ -77,9 +77,6 @@
char *badreason = NULL;
char *e_machine_name = NULL;
-#ifdef HAS_XINERAMA
-char xinerama_active;
-#endif
#ifdef DEBUG
int call_level;
int debug_level;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- iconify.c 12 Jul 2003 15:04:31 -0000 1.67
+++ iconify.c 20 Jul 2003 18:02:16 -0000 1.68
@@ -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 @@
{
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 @@
{
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 @@
{
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]);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -3 -r1.89 -r1.90
--- setup.c 12 Jul 2003 15:04:32 -0000 1.89
+++ setup.c 20 Jul 2003 18:02:16 -0000 1.90
@@ -606,10 +606,7 @@
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);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/size.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- size.c 22 May 2003 19:15:02 -0000 1.26
+++ size.c 20 Jul 2003 18:02:16 -0000 1.27
@@ -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 @@
ewin->lw = ewin->client.w;
ewin->lh = ewin->client.h;
ewin->toggle = 0;
+ goto exit;
}
- return;
-}
-
-void
-MaxWidth(EWin * ewin, char *resize_type)
-{
-
- int x, y, w, h, x1, x2;
+ 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;
- if (!ewin)
- return;
+ /* Default is no change */
+ y = ewin->y;
+ h = ewin->h;
+ x = ewin->x;
+ w = ewin->w;
- if (!ewin->toggle)
+ switch (type)
{
- 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")))
+ case MAX_ABSOLUTE:
+ if (direction & MAX_HOR)
{
- 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);
- }
+ x = 0;
+ w = root.w - ewin->border->border.left -
+ ewin->border->border.right;
}
- else if ((resize_type) && (!strcmp(resize_type, "conservative")))
+ if (direction & MAX_VER)
{
- 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);
- }
+ y = 0;
+ h = root.h - 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
- {
- 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;
- }
+ break;
- return;
-}
-
-void
-MaxSize(EWin * ewin, char *resize_type)
-{
-
- int x, y, w, h, x1, x2, y1, y2;
+ case MAX_CONSERVATIVE:
+ case MAX_AVAILABLE:
+ lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
+ if (!lst)
+ break;
- if (!ewin)
- return;
+ ScreenGetGeometry(ewin->x, ewin->y, &x1, &y1, &x2, &y2);
+ x2 += x1;
+ y2 += y1;
- 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")))
+#if ENABLE_KDE
+ if (mode.kde_support)
{
- EWin **lst;
- int i, num;
+ 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
- lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
- if (lst)
+ if (direction & MAX_VER)
+ {
+ for (i = 0; i < num; i++)
{
- 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);
+ 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);
}
- else if ((resize_type) && (!strcmp(resize_type, "conservative")))
- {
- EWin **lst;
- int i, num;
- lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
- if (lst)
+ if (direction & MAX_HOR)
+ {
+ for (i = 0; i < num; i++)
{
- 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);
+ 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);
}
- 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;
+
+ 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);
+}
- return;
+void
+MaxHeight(EWin * ewin, char *resize_type)
+{
+ MaxSizeHV(ewin, resize_type, MAX_VER);
+}
+
+void
+MaxSize(EWin * ewin, char *resize_type)
+{
+ MaxSizeHV(ewin, resize_type, MAX_HOR | MAX_VER);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- x.c 12 Jul 2003 07:52:03 -0000 1.53
+++ x.c 20 Jul 2003 18:02:16 -0000 1.54
@@ -908,50 +908,3 @@
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;
-}
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs