1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-09 07:14:18 +01:00

Trivial coding style changes

Some trivial style changes I made while reading src/placement.c
This commit is contained in:
Carlos R. Mafra
2009-08-29 18:46:05 +02:00
parent 9af6316d1d
commit 34be9d7816

View File

@@ -49,17 +49,14 @@ extern WPreferences wPreferences;
#define Y_ORIGIN WMAX(usableArea.y1,\ #define Y_ORIGIN WMAX(usableArea.y1,\
wPreferences.window_place_origin.y) wPreferences.window_place_origin.y)
/* /* interactive window placement is in moveres.c */
* interactive window placement is in moveres.c extern void InteractivePlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
*/ unsigned width, unsigned height);
extern void InteractivePlaceWindow(WWindow * wwin, int *x_ret, int *y_ret, unsigned width, unsigned height); /* Returns True if it is an icon and is in this workspace */
/*
* Returns True if it is an icon and is in this workspace.
*/
static Bool static Bool
iconPosition(WCoreWindow * wcore, int sx1, int sy1, int sx2, int sy2, int workspace, int *retX, int *retY) iconPosition(WCoreWindow *wcore, int sx1, int sy1, int sx2, int sy2,
int workspace, int *retX, int *retY)
{ {
void *parent; void *parent;
int ok = 0; int ok = 0;
@@ -92,9 +89,7 @@ iconPosition(WCoreWindow * wcore, int sx1, int sy1, int sx2, int sy2, int worksp
ok = 1; ok = 1;
} }
/* /* Check if it is inside the screen */
* Check if it is inside the screen.
*/
if (ok) { if (ok) {
if (*retX < sx1 - wPreferences.icon_size) if (*retX < sx1 - wPreferences.icon_size)
ok = 0; ok = 0;
@@ -110,7 +105,7 @@ iconPosition(WCoreWindow * wcore, int sx1, int sy1, int sx2, int sy2, int worksp
return ok; return ok;
} }
void PlaceIcon(WScreen * scr, int *x_ret, int *y_ret, int head) void PlaceIcon(WScreen *scr, int *x_ret, int *y_ret, int head)
{ {
int pf; /* primary axis */ int pf; /* primary axis */
int sf; /* secondary axis */ int sf; /* secondary axis */
@@ -132,7 +127,6 @@ void PlaceIcon(WScreen * scr, int *x_ret, int *y_ret, int head)
/* Find out screen boundaries. */ /* Find out screen boundaries. */
/* Allows each head to have miniwindows */ /* Allows each head to have miniwindows */
sx1 = area.x1; sx1 = area.x1;
sy1 = area.y1; sy1 = area.y1;
sx2 = area.x2; sx2 = area.x2;
@@ -211,15 +205,11 @@ void PlaceIcon(WScreen * scr, int *x_ret, int *y_ret, int head)
obj = obj->stacking->under; obj = obj->stacking->under;
} }
} }
/* /* Default position */
* Default position
*/
*x_ret = 0; *x_ret = 0;
*y_ret = 0; *y_ret = 0;
/* /* Look for an empty slot */
* Look for an empty slot
*/
for (si = 0; si < sf; si++) { for (si = 0; si < sf; si++) {
for (pi = 0; pi < pf; pi++) { for (pi = 0; pi < pf; pi++) {
if (wPreferences.icon_yard & IY_VERT) { if (wPreferences.icon_yard & IY_VERT) {
@@ -243,10 +233,7 @@ void PlaceIcon(WScreen * scr, int *x_ret, int *y_ret, int head)
wfree(map); wfree(map);
} }
/* /* Computes the intersecting length of two line sections */
* This function calculates the length of the intersection of two
* line sections. (Hey, is that english?)
*/
static int calcIntersectionLength(int p1, int l1, int p2, int l2) static int calcIntersectionLength(int p1, int l1, int p2, int l2)
{ {
int isect; int isect;
@@ -271,17 +258,14 @@ static int calcIntersectionLength(int p1, int l1, int p2, int l2)
return isect; return isect;
} }
/* /* Computes the intersecting area of two rectangles */
* This function calculates the area of the intersection of two rectangles.
*/
int calcIntersectionArea(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2) int calcIntersectionArea(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
{ {
return calcIntersectionLength(x1, w1, x2, w2) return calcIntersectionLength(x1, w1, x2, w2)
* calcIntersectionLength(y1, h1, y2, h2); * calcIntersectionLength(y1, h1, y2, h2);
} }
static int calcSumOfCoveredAreas(WWindow * wwin, int x, int y, int w, int h) static int calcSumOfCoveredAreas(WWindow *wwin, int x, int y, int w, int h)
{ {
int sum_isect = 0; int sum_isect = 0;
WWindow *test_window; WWindow *test_window;
@@ -335,7 +319,8 @@ static void set_width_height(WWindow *wwin, unsigned int *width, unsigned int *h
} }
static void static void
smartPlaceWindow(WWindow * wwin, int *x_ret, int *y_ret, unsigned int width, unsigned int height, WArea usableArea) smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, unsigned int width,
unsigned int height, WArea usableArea)
{ {
int test_x = 0, test_y = Y_ORIGIN; int test_x = 0, test_y = Y_ORIGIN;
int from_x, to_x, from_y, to_y; int from_x, to_x, from_y, to_y;
@@ -395,7 +380,7 @@ smartPlaceWindow(WWindow * wwin, int *x_ret, int *y_ret, unsigned int width, uns
} }
static Bool static Bool
autoPlaceWindow(WWindow * wwin, int *x_ret, int *y_ret, autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
unsigned int width, unsigned int height, int tryCount, WArea usableArea) unsigned int width, unsigned int height, int tryCount, WArea usableArea)
{ {
WScreen *scr = wwin->screen_ptr; WScreen *scr = wwin->screen_ptr;
@@ -496,7 +481,7 @@ autoPlaceWindow(WWindow * wwin, int *x_ret, int *y_ret,
} }
static void static void
cascadeWindow(WScreen * scr, WWindow * wwin, int *x_ret, int *y_ret, cascadeWindow(WScreen *scr, WWindow *wwin, int *x_ret, int *y_ret,
unsigned int width, unsigned int height, int h, WArea usableArea) unsigned int width, unsigned int height, int h, WArea usableArea)
{ {
set_width_height(wwin, &width, &height); set_width_height(wwin, &width, &height);
@@ -512,7 +497,7 @@ cascadeWindow(WScreen * scr, WWindow * wwin, int *x_ret, int *y_ret,
} }
static void static void
randomPlaceWindow(WScreen * scr, WWindow * wwin, int *x_ret, int *y_ret, randomPlaceWindow(WScreen *scr, WWindow *wwin, int *x_ret, int *y_ret,
unsigned int width, unsigned int height, WArea usableArea) unsigned int width, unsigned int height, WArea usableArea)
{ {
int w, h; int w, h;
@@ -529,12 +514,12 @@ randomPlaceWindow(WScreen * scr, WWindow * wwin, int *x_ret, int *y_ret,
*y_ret = Y_ORIGIN + rand() % h; *y_ret = Y_ORIGIN + rand() % h;
} }
void PlaceWindow(WWindow * wwin, int *x_ret, int *y_ret, unsigned width, unsigned height) void PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, unsigned width, unsigned height)
{ {
WScreen *scr = wwin->screen_ptr; WScreen *scr = wwin->screen_ptr;
int h = WMFontHeight(scr->title_font) + (wPreferences.window_title_clearance + TITLEBAR_EXTEND_SPACE) * 2; int h = WMFontHeight(scr->title_font)
WArea usableArea = wGetUsableAreaForHead(scr, + (wPreferences.window_title_clearance + TITLEBAR_EXTEND_SPACE) * 2;
wGetHeadForPointerLocation(scr), WArea usableArea = wGetUsableAreaForHead(scr, wGetHeadForPointerLocation(scr),
NULL, True); NULL, True);
switch (wPreferences.window_placement) { switch (wPreferences.window_placement) {