mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-14 06:15:46 +01:00
Trivial coding style changes
Some trivial style changes I made while reading src/placement.c
This commit is contained in:
@@ -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;
|
||||||
@@ -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,10 +258,7 @@ 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)
|
||||||
@@ -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;
|
||||||
@@ -532,9 +517,9 @@ randomPlaceWindow(WScreen * scr, WWindow * wwin, int *x_ret, int *y_ret,
|
|||||||
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user