mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
fixes to comply to ANSI C
This commit is contained in:
@@ -625,6 +625,8 @@ WMPoint wmkpoint(int x, int y);
|
|||||||
|
|
||||||
WMSize wmksize(unsigned int width, unsigned int height);
|
WMSize wmksize(unsigned int width, unsigned int height);
|
||||||
|
|
||||||
|
WMRect wmkrect(int x, int y, unsigned int width, unsigned int height);
|
||||||
|
|
||||||
#ifdef ANSI_C_DOESNT_LIKE_IT_THIS_WAY
|
#ifdef ANSI_C_DOESNT_LIKE_IT_THIS_WAY
|
||||||
#define wmksize(width, height) (WMSize){(width), (height)}
|
#define wmksize(width, height) (WMSize){(width), (height)}
|
||||||
#define wmkpoint(x, y) (WMPoint){(x), (y)}
|
#define wmkpoint(x, y) (WMPoint){(x), (y)}
|
||||||
|
|||||||
@@ -1615,7 +1615,9 @@ WMReadPropListFromFile(char *file)
|
|||||||
pldata->lineNumber = 1;
|
pldata->lineNumber = 1;
|
||||||
|
|
||||||
if (fread(pldata->ptr, length, 1, f) != 1) {
|
if (fread(pldata->ptr, length, 1, f) != 1) {
|
||||||
|
if (ferror(f)) {
|
||||||
wsyserror(_("error reading from file '%s'"), file);
|
wsyserror(_("error reading from file '%s'"), file);
|
||||||
|
}
|
||||||
plist = NULL;
|
plist = NULL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,7 +338,18 @@ wmksize(unsigned int width, unsigned int height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WMRect
|
||||||
|
wmkrect(int x, int y, unsigned int width, unsigned int height)
|
||||||
|
{
|
||||||
|
WMRect rect;
|
||||||
|
|
||||||
|
rect.pos.x = x;
|
||||||
|
rect.pos.y = y;
|
||||||
|
rect.size.width = width;
|
||||||
|
rect.size.height = height;
|
||||||
|
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -146,12 +146,12 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
|
|||||||
|
|
||||||
LastFocusChange = timestamp;
|
LastFocusChange = timestamp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a hack, because XSetInputFocus() should have a proper
|
* This is a hack, because XSetInputFocus() should have a proper
|
||||||
* timestamp instead of CurrentTime but it seems that some times
|
* timestamp instead of CurrentTime but it seems that some times
|
||||||
* clients will not receive focus properly that way.
|
* clients will not receive focus properly that way.
|
||||||
if (ignoreTimestamp)
|
if (ignoreTimestamp)
|
||||||
*/
|
*/
|
||||||
timestamp = CurrentTime;
|
timestamp = CurrentTime;
|
||||||
|
|
||||||
if (old_focused)
|
if (old_focused)
|
||||||
@@ -415,11 +415,11 @@ wMaximizeWindow(WWindow *wwin, int directions)
|
|||||||
if (WFLAGP(wwin, no_resizable))
|
if (WFLAGP(wwin, no_resizable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
usableArea = totalArea = (WArea){
|
totalArea.x1 = 0;
|
||||||
0, 0,
|
totalArea.y1 = 0;
|
||||||
wwin->screen_ptr->scr_width,
|
totalArea.x2 = wwin->screen_ptr->scr_width;
|
||||||
wwin->screen_ptr->scr_height
|
totalArea.y2 = wwin->screen_ptr->scr_height;
|
||||||
};
|
usableArea = totalArea;
|
||||||
|
|
||||||
if (!(directions & MAX_IGNORE_XINERAMA)) {
|
if (!(directions & MAX_IGNORE_XINERAMA)) {
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
@@ -1019,7 +1019,7 @@ wIconifyWindow(WWindow *wwin)
|
|||||||
if (present) {
|
if (present) {
|
||||||
WWindow *owner = recursiveTransientFor(wwin->screen_ptr->focused_window);
|
WWindow *owner = recursiveTransientFor(wwin->screen_ptr->focused_window);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It doesn't seem to be working and causes button event hangup
|
* It doesn't seem to be working and causes button event hangup
|
||||||
* when deiconifying a transient window.
|
* when deiconifying a transient window.
|
||||||
setupIconGrabs(wwin->icon);
|
setupIconGrabs(wwin->icon);
|
||||||
@@ -1524,7 +1524,7 @@ wArrangeIcons(WScreen *scr, Bool arrangeAll)
|
|||||||
int head;
|
int head;
|
||||||
const int heads = wXineramaHeads(scr);
|
const int heads = wXineramaHeads(scr);
|
||||||
|
|
||||||
struct {
|
struct HeadVars {
|
||||||
int pf; /* primary axis */
|
int pf; /* primary axis */
|
||||||
int sf; /* secondary axis */
|
int sf; /* secondary axis */
|
||||||
int fullW;
|
int fullW;
|
||||||
@@ -1534,16 +1534,18 @@ wArrangeIcons(WScreen *scr, Bool arrangeAll)
|
|||||||
int sw, sh;
|
int sw, sh;
|
||||||
int xo, yo;
|
int xo, yo;
|
||||||
int xs, ys;
|
int xs, ys;
|
||||||
} vars[heads];
|
} *vars;
|
||||||
|
|
||||||
int isize = wPreferences.icon_size;
|
int isize = wPreferences.icon_size;
|
||||||
|
|
||||||
|
vars = (struct HeadVars*)wmalloc(sizeof(struct HeadVars)*heads);
|
||||||
|
|
||||||
for (head = 0; head < heads; ++head) {
|
for (head = 0; head < heads; ++head) {
|
||||||
#if 0
|
#if 0
|
||||||
WMRect rect = wGetRectForHead(scr, head);
|
WMRect rect = wGetRectForHead(scr, head);
|
||||||
#else
|
#else
|
||||||
WArea area = wGetUsableAreaForHead(scr, head, NULL, False);
|
WArea area = wGetUsableAreaForHead(scr, head, NULL, False);
|
||||||
WMRect rect = (WMRect){ area.x1, area.y1, area.x2-area.x1, area.y2-area.y1 };
|
WMRect rect = wmkrect(area.x1, area.y1, area.x2-area.x1, area.y2-area.y1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vars[head].pi = vars[head].si = 0;
|
vars[head].pi = vars[head].si = 0;
|
||||||
@@ -1611,7 +1613,7 @@ wArrangeIcons(WScreen *scr, Bool arrangeAll)
|
|||||||
if (!aicon->docked) {
|
if (!aicon->docked) {
|
||||||
/* XXX: can: icon == NULL ? */
|
/* XXX: can: icon == NULL ? */
|
||||||
/* The intention here is to place the AppIcon on the head that contains most of the applications _main_ window. */
|
/* The intention here is to place the AppIcon on the head that contains most of the applications _main_ window. */
|
||||||
/* printf( "appicon: %x %x\n", aicon->icon->core->window, aicon->main_window); */
|
/* printf("appicon: %x %x\n", aicon->icon->core->window, aicon->main_window); */
|
||||||
head = wGetHeadForWindow(aicon->icon->owner);
|
head = wGetHeadForWindow(aicon->icon->owner);
|
||||||
|
|
||||||
if (aicon->x_pos != X || aicon->y_pos != Y) {
|
if (aicon->x_pos != X || aicon->y_pos != Y) {
|
||||||
@@ -1674,6 +1676,8 @@ wArrangeIcons(WScreen *scr, Bool arrangeAll)
|
|||||||
/* we reversed the order, so we use next */
|
/* we reversed the order, so we use next */
|
||||||
wwin = wwin->next;
|
wwin = wwin->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wfree(vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ makeMainWindow(WScreen *scr, Window window)
|
|||||||
&wwin->user_flags, &wwin->defined_user_flags, True);
|
&wwin->user_flags, &wwin->defined_user_flags, True);
|
||||||
|
|
||||||
XSelectInput(dpy, window, attr.your_event_mask | PropertyChangeMask
|
XSelectInput(dpy, window, attr.your_event_mask | PropertyChangeMask
|
||||||
| StructureNotifyMask );
|
| StructureNotifyMask);
|
||||||
return wwin;
|
return wwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ wAppMenuMap(WMenu *menu, WWindow *wwin)
|
|||||||
int x, min;
|
int x, min;
|
||||||
|
|
||||||
min = 20; /* Keep at least 20 pixels visible */
|
min = 20; /* Keep at least 20 pixels visible */
|
||||||
if( wwin->frame_x > min ) {
|
if (wwin->frame_x > min) {
|
||||||
x = wwin->frame_x - menu->frame->core->width;
|
x = wwin->frame_x - menu->frame->core->width;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ wClientConfigure(WWindow *wwin, XConfigureRequestEvent *xcre)
|
|||||||
int nx, ny, nwidth, nheight;
|
int nx, ny, nwidth, nheight;
|
||||||
int ofs_x, ofs_y;
|
int ofs_x, ofs_y;
|
||||||
|
|
||||||
/* printf( "configure event: %d %d %d %d\n", xcre->x, xcre->y, xcre->width, xcre->height);*/
|
/* printf("configure event: %d %d %d %d\n", xcre->x, xcre->y, xcre->width, xcre->height);*/
|
||||||
|
|
||||||
if (wwin==NULL) {
|
if (wwin==NULL) {
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -3195,7 +3195,7 @@ setIconTitleBack(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
|||||||
if (scr->icon_title_texture) {
|
if (scr->icon_title_texture) {
|
||||||
wTextureDestroy(scr, (WTexture*)scr->icon_title_texture);
|
wTextureDestroy(scr, (WTexture*)scr->icon_title_texture);
|
||||||
}
|
}
|
||||||
// ?? why is this necessary? color was already parsed and alloc'ed
|
/* // ?? why is this necessary? color was already parsed and alloc'ed */
|
||||||
XQueryColor (dpy, scr->w_colormap, color);
|
XQueryColor (dpy, scr->w_colormap, color);
|
||||||
scr->icon_title_texture = wTextureMakeSolid(scr, color);
|
scr->icon_title_texture = wTextureMakeSolid(scr, color);
|
||||||
|
|
||||||
@@ -3464,6 +3464,7 @@ setKeyGrab(WScreen *scr, WDefaultEntry *entry, WShortKey *shortcut, long index)
|
|||||||
static int
|
static int
|
||||||
setIconPosition(WScreen *scr, WDefaultEntry *entry, void *bar, void *foo)
|
setIconPosition(WScreen *scr, WDefaultEntry *entry, void *bar, void *foo)
|
||||||
{
|
{
|
||||||
|
wScreenUpdateUsableArea(scr);
|
||||||
wArrangeIcons(scr, True);
|
wArrangeIcons(scr, True);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -2646,7 +2646,7 @@ wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
|
|||||||
static int
|
static int
|
||||||
onScreen(WScreen *scr, int x, int y, int sx, int ex, int sy, int ey)
|
onScreen(WScreen *scr, int x, int y, int sx, int ex, int sy, int ey)
|
||||||
{
|
{
|
||||||
WMRect rect = {x, y, ICON_SIZE, ICON_SIZE};
|
WMRect rect = wmkrect(x, y, ICON_SIZE, ICON_SIZE);
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
wGetRectPlacementInfo(scr, rect, &flags);
|
wGetRectPlacementInfo(scr, rect, &flags);
|
||||||
|
|||||||
@@ -1726,7 +1726,7 @@ handleMotionNotify(XEvent *event)
|
|||||||
WScreen *scr = wScreenForRootWindow(event->xmotion.root);
|
WScreen *scr = wScreenForRootWindow(event->xmotion.root);
|
||||||
|
|
||||||
if (wPreferences.scrollable_menus) {
|
if (wPreferences.scrollable_menus) {
|
||||||
WMPoint p = { event->xmotion.x_root, event->xmotion.y_root };
|
WMPoint p = wmkpoint(event->xmotion.x_root, event->xmotion.y_root);
|
||||||
WMRect rect = wGetRectForHead(scr, wGetHeadForPoint(scr, p));
|
WMRect rect = wGetRectForHead(scr, wGetHeadForPoint(scr, p));
|
||||||
|
|
||||||
if (scr->flags.jump_back_pending ||
|
if (scr->flags.jump_back_pending ||
|
||||||
|
|||||||
12
src/kwm.c
12
src/kwm.c
@@ -1401,7 +1401,7 @@ wKWMCheckRootHintChange(WScreen *scr, XPropertyEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ( i == scr->current_workspace % MAX_WORKSPACES)
|
if (i == scr->current_workspace % MAX_WORKSPACES)
|
||||||
wScreenUpdateUsableArea(scr);
|
wScreenUpdateUsableArea(scr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1630,13 +1630,13 @@ wKWMGetUsableArea(WScreen *scr, int head, WArea *area)
|
|||||||
|
|
||||||
ok = getAreaHint(scr->root_win, _XA_KWM_WINDOW_REGION_[region], area);
|
ok = getAreaHint(scr->root_win, _XA_KWM_WINDOW_REGION_[region], area);
|
||||||
|
|
||||||
if ( ok) {
|
if (ok) {
|
||||||
WMRect rect = wGetRectForHead(scr, head);
|
WMRect rect = wGetRectForHead(scr, head);
|
||||||
|
|
||||||
area->x1 = WMAX( area->x1, rect.pos.x);
|
area->x1 = WMAX(area->x1, rect.pos.x);
|
||||||
area->x2 = WMIN( area->x2, rect.pos.x + rect.size.width);
|
area->x2 = WMIN(area->x2, rect.pos.x + rect.size.width);
|
||||||
area->y1 = WMAX( area->y1, rect.pos.y);
|
area->y1 = WMAX(area->y1, rect.pos.y);
|
||||||
area->y2 = WMIN( area->y2, rect.pos.y + rect.size.height);
|
area->y2 = WMIN(area->y2, rect.pos.y + rect.size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
|||||||
22
src/menu.c
22
src/menu.c
@@ -1746,9 +1746,10 @@ isPointNearBoder(WMenu *menu, int x, int y)
|
|||||||
int menuX2 = menu->frame_x + MENUW(menu);
|
int menuX2 = menu->frame_x + MENUW(menu);
|
||||||
int menuY2 = menu->frame_y + MENUH(menu);
|
int menuY2 = menu->frame_y + MENUH(menu);
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
/* XXX: handle screen joins proper !! */
|
int head = wGetHeadForPoint(menu->frame->screen_ptr, wmkpoint(x, y));
|
||||||
WMRect rect = wGetRectForHead(menu->frame->screen_ptr,
|
WMRect rect = wGetRectForHead(menu->frame->screen_ptr, head);
|
||||||
wGetHeadForPoint(menu->frame->screen_ptr, (WMPoint){ x, y}));
|
|
||||||
|
/* XXX: handle screen joins properly !! */
|
||||||
|
|
||||||
if (x >= menuX1 && x <= menuX2 &&
|
if (x >= menuX1 && x <= menuX2 &&
|
||||||
(y < rect.pos.y + MENU_SCROLL_BORDER ||
|
(y < rect.pos.y + MENU_SCROLL_BORDER ||
|
||||||
@@ -1764,17 +1765,16 @@ isPointNearBoder(WMenu *menu, int x, int y)
|
|||||||
|
|
||||||
|
|
||||||
typedef struct _delay {
|
typedef struct _delay {
|
||||||
WWindow *wwin;
|
|
||||||
WMenu *menu;
|
WMenu *menu;
|
||||||
int ox,oy;
|
int ox, oy;
|
||||||
} _delay;
|
} _delay;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_leaving(_delay *dl)
|
leaving(_delay *dl)
|
||||||
{
|
{
|
||||||
wMenuMove(dl->menu, dl->ox, dl->oy, True);
|
wMenuMove(dl->menu, dl->ox, dl->oy, True);
|
||||||
dl->menu->jump_back=NULL;
|
dl->menu->jump_back = NULL;
|
||||||
dl->menu->menu->screen_ptr->flags.jump_back_pending = 0;
|
dl->menu->menu->screen_ptr->flags.jump_back_pending = 0;
|
||||||
wfree(dl);
|
wfree(dl);
|
||||||
}
|
}
|
||||||
@@ -1832,7 +1832,7 @@ wMenuScroll(WMenu *menu, XEvent *event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rect = wGetRectForHead(scr, wGetHeadForPoint(scr, (WMPoint){ x, y }));
|
rect = wGetRectForHead(scr, wGetHeadForPoint(scr, wmkpoint(x, y)));
|
||||||
on_x_edge = x <= rect.pos.x + 1 || x >= rect.pos.x + rect.size.width - 2;
|
on_x_edge = x <= rect.pos.x + 1 || x >= rect.pos.x + rect.size.width - 2;
|
||||||
on_y_edge = y <= rect.pos.y + 1 || y >= rect.pos.y + rect.size.height - 2;
|
on_y_edge = y <= rect.pos.y + 1 || y >= rect.pos.y + rect.size.height - 2;
|
||||||
on_border = on_x_edge || on_y_edge;
|
on_border = on_x_edge || on_y_edge;
|
||||||
@@ -1884,15 +1884,15 @@ wMenuScroll(WMenu *menu, XEvent *event)
|
|||||||
if (jump_back) {
|
if (jump_back) {
|
||||||
_delay *delayer;
|
_delay *delayer;
|
||||||
if (!omenu->jump_back) {
|
if (!omenu->jump_back) {
|
||||||
delayer=wmalloc(sizeof(_delay));
|
delayer = wmalloc(sizeof(_delay));
|
||||||
delayer->menu=omenu;
|
delayer->menu=omenu;
|
||||||
delayer->ox=old_frame_x;
|
delayer->ox=old_frame_x;
|
||||||
delayer->oy=old_frame_y;
|
delayer->oy=old_frame_y;
|
||||||
omenu->jump_back=delayer;
|
omenu->jump_back = delayer;
|
||||||
scr->flags.jump_back_pending = 1;
|
scr->flags.jump_back_pending = 1;
|
||||||
}
|
}
|
||||||
else delayer = omenu->jump_back;
|
else delayer = omenu->jump_back;
|
||||||
WMAddTimerHandler(MENU_JUMP_BACK_DELAY,(WMCallback*)_leaving, delayer);
|
WMAddTimerHandler(MENU_JUMP_BACK_DELAY,(WMCallback*)leaving, delayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,22 +141,18 @@ PlaceIcon(WScreen *scr, int *x_ret, int *y_ret, int head)
|
|||||||
int isize = wPreferences.icon_size;
|
int isize = wPreferences.icon_size;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
WMBagIterator iter;
|
WMBagIterator iter;
|
||||||
/*
|
|
||||||
* Find out screen boundaries.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Allows each head to have miniwindows
|
|
||||||
*/
|
|
||||||
WArea area = wGetUsableAreaForHead(scr, head, NULL, False);
|
WArea area = wGetUsableAreaForHead(scr, head, NULL, False);
|
||||||
WMRect rect = (WMRect){ area.x1, area.y1, area.x2-area.x1, area.y2-area.y1 };
|
|
||||||
|
|
||||||
sx1 = rect.pos.x;
|
/* Find out screen boundaries. */
|
||||||
sy1 = rect.pos.y;
|
|
||||||
sw = rect.size.width;
|
/* Allows each head to have miniwindows */
|
||||||
sh = rect.size.height;
|
|
||||||
sx2 = sx1 + sw;
|
sx1 = area.x1;
|
||||||
sy2 = sy1 + sh;
|
sy1 = area.y1;
|
||||||
|
sx2 = area.x2;
|
||||||
|
sy2 = area.y2;
|
||||||
|
sw = sx2-sx1;
|
||||||
|
sh = sy2-sy1;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (scr->dock) {
|
if (scr->dock) {
|
||||||
@@ -383,7 +379,7 @@ smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
|||||||
sum_isect = calcSumOfCoveredAreas(wwin, test_x, test_y,
|
sum_isect = calcSumOfCoveredAreas(wwin, test_x, test_y,
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
if ( sum_isect < min_isect ) {
|
if (sum_isect < min_isect) {
|
||||||
min_isect = sum_isect;
|
min_isect = sum_isect;
|
||||||
min_isect_x = test_x;
|
min_isect_x = test_x;
|
||||||
min_isect_y = test_y;
|
min_isect_y = test_y;
|
||||||
@@ -411,7 +407,7 @@ smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
|||||||
sum_isect = calcSumOfCoveredAreas(wwin, test_x, test_y,
|
sum_isect = calcSumOfCoveredAreas(wwin, test_x, test_y,
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
if ( sum_isect < min_isect ) {
|
if (sum_isect < min_isect) {
|
||||||
min_isect = sum_isect;
|
min_isect = sum_isect;
|
||||||
min_isect_x = test_x;
|
min_isect_x = test_x;
|
||||||
min_isect_y = test_y;
|
min_isect_y = test_y;
|
||||||
|
|||||||
62
src/screen.c
62
src/screen.c
@@ -624,10 +624,10 @@ wScreenInit(int screen_number)
|
|||||||
|
|
||||||
wInitXinerama(scr);
|
wInitXinerama(scr);
|
||||||
|
|
||||||
scr->usableArea = (WArea *)wmalloc( sizeof(WArea)*wXineramaHeads(scr)); /* XXX: checl NULL */
|
scr->usableArea = (WArea *)wmalloc(sizeof(WArea)*wXineramaHeads(scr));
|
||||||
scr->totalUsableArea = (WArea *)wmalloc( sizeof(WArea)*wXineramaHeads(scr)); /* XXX: */
|
scr->totalUsableArea = (WArea *)wmalloc(sizeof(WArea)*wXineramaHeads(scr));
|
||||||
|
|
||||||
for ( i=0; i<wXineramaHeads(scr); ++i) {
|
for (i=0; i<wXineramaHeads(scr); ++i) {
|
||||||
WMRect rect = wGetRectForHead(scr, i);
|
WMRect rect = wGetRectForHead(scr, i);
|
||||||
scr->usableArea[i].x1 = scr->totalUsableArea[i].x1 = rect.pos.x;
|
scr->usableArea[i].x1 = scr->totalUsableArea[i].x1 = rect.pos.x;
|
||||||
scr->usableArea[i].y1 = scr->totalUsableArea[i].y1 = rect.pos.y;
|
scr->usableArea[i].y1 = scr->totalUsableArea[i].y1 = rect.pos.y;
|
||||||
@@ -839,7 +839,8 @@ wScreenUpdateUsableArea(WScreen *scr)
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* scr->totalUsableArea[] will become the usableArea used for Windowplacement,
|
* scr->totalUsableArea[] will become the usableArea used for Windowplacement,
|
||||||
* scr->usableArea[] will be used for iconplacement, hence no iconyard nor border.
|
* scr->usableArea[] will be used for iconplacement, hence no iconyard nor
|
||||||
|
* border.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@@ -847,25 +848,27 @@ wScreenUpdateUsableArea(WScreen *scr)
|
|||||||
WArea area;
|
WArea area;
|
||||||
int dock_head = scr->xine_info.primary_head;
|
int dock_head = scr->xine_info.primary_head;
|
||||||
|
|
||||||
if ( scr->dock) {
|
if (scr->dock) {
|
||||||
WMRect rect = { scr->dock->x_pos, scr->dock->y_pos, wPreferences.icon_size, wPreferences.icon_size };
|
WMRect rect;
|
||||||
|
rect.pos.x = scr->dock->x_pos;
|
||||||
|
rect.pos.y = scr->dock->y_pos;
|
||||||
|
rect.size.width = wPreferences.icon_size;
|
||||||
|
rect.size.height = wPreferences.icon_size;
|
||||||
dock_head = wGetHeadForRect(scr, rect);
|
dock_head = wGetHeadForRect(scr, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i=0; i<wXineramaHeads(scr); ++i) {
|
for (i=0; i<wXineramaHeads(scr); ++i) {
|
||||||
WMRect rect = wGetRectForHead(scr, i);
|
WMRect rect = wGetRectForHead(scr, i);
|
||||||
scr->totalUsableArea[i] = (WArea){
|
scr->totalUsableArea[i].x1 = rect.pos.x;
|
||||||
rect.pos.x,
|
scr->totalUsableArea[i].y1 = rect.pos.y;
|
||||||
rect.pos.y,
|
scr->totalUsableArea[i].x2 = rect.pos.x + rect.size.width;
|
||||||
rect.pos.x + rect.size.width,
|
scr->totalUsableArea[i].y2 = rect.pos.y + rect.size.height;
|
||||||
rect.pos.y + rect.size.height
|
|
||||||
};
|
|
||||||
|
|
||||||
if ( scr->dock && dock_head==i &&
|
if (scr->dock && dock_head==i &&
|
||||||
(!scr->dock->lowered || wPreferences.no_window_over_dock)) {
|
(!scr->dock->lowered || wPreferences.no_window_over_dock)) {
|
||||||
int offset = wPreferences.icon_size + DOCK_EXTRA_SPACE;
|
int offset = wPreferences.icon_size + DOCK_EXTRA_SPACE;
|
||||||
|
|
||||||
if ( scr->dock->on_right_side) {
|
if (scr->dock->on_right_side) {
|
||||||
scr->totalUsableArea[i].x2 -= offset;
|
scr->totalUsableArea[i].x2 -= offset;
|
||||||
} else {
|
} else {
|
||||||
scr->totalUsableArea[i].x1 += offset;
|
scr->totalUsableArea[i].x1 += offset;
|
||||||
@@ -875,7 +878,7 @@ wScreenUpdateUsableArea(WScreen *scr)
|
|||||||
#ifdef NETWM_HINTS
|
#ifdef NETWM_HINTS
|
||||||
{
|
{
|
||||||
WArea area;
|
WArea area;
|
||||||
if ( wNETWMGetUsableArea(scr, i, &area)) {
|
if (wNETWMGetUsableArea(scr, i, &area)) {
|
||||||
scr->totalUsableArea[i].x1 = WMAX(scr->totalUsableArea[i].x1, area.x1);
|
scr->totalUsableArea[i].x1 = WMAX(scr->totalUsableArea[i].x1, area.x1);
|
||||||
scr->totalUsableArea[i].y1 = WMAX(scr->totalUsableArea[i].y1, area.y1);
|
scr->totalUsableArea[i].y1 = WMAX(scr->totalUsableArea[i].y1, area.y1);
|
||||||
scr->totalUsableArea[i].x2 = WMIN(scr->totalUsableArea[i].x2, area.x2);
|
scr->totalUsableArea[i].x2 = WMIN(scr->totalUsableArea[i].x2, area.x2);
|
||||||
@@ -887,7 +890,7 @@ wScreenUpdateUsableArea(WScreen *scr)
|
|||||||
#ifdef GNOME_STUFF
|
#ifdef GNOME_STUFF
|
||||||
{
|
{
|
||||||
WArea area;
|
WArea area;
|
||||||
if ( wGNOMEGetUsableArea(scr, i, &area)) {
|
if (wGNOMEGetUsableArea(scr, i, &area)) {
|
||||||
scr->totalUsableArea[i].x1 = WMAX(scr->totalUsableArea[i].x1, area.x1);
|
scr->totalUsableArea[i].x1 = WMAX(scr->totalUsableArea[i].x1, area.x1);
|
||||||
scr->totalUsableArea[i].y1 = WMAX(scr->totalUsableArea[i].y1, area.y1);
|
scr->totalUsableArea[i].y1 = WMAX(scr->totalUsableArea[i].y1, area.y1);
|
||||||
scr->totalUsableArea[i].x2 = WMIN(scr->totalUsableArea[i].x2, area.x2);
|
scr->totalUsableArea[i].x2 = WMIN(scr->totalUsableArea[i].x2, area.x2);
|
||||||
@@ -899,7 +902,7 @@ wScreenUpdateUsableArea(WScreen *scr)
|
|||||||
#ifdef KWM_HINTS
|
#ifdef KWM_HINTS
|
||||||
{
|
{
|
||||||
WArea area;
|
WArea area;
|
||||||
if ( wKWMGetUsableArea(scr, i, &area)) {
|
if (wKWMGetUsableArea(scr, i, &area)) {
|
||||||
scr->totalUsableArea[i].x1 = WMAX(scr->totalUsableArea[i].x1, area.x1);
|
scr->totalUsableArea[i].x1 = WMAX(scr->totalUsableArea[i].x1, area.x1);
|
||||||
scr->totalUsableArea[i].y1 = WMAX(scr->totalUsableArea[i].y1, area.y1);
|
scr->totalUsableArea[i].y1 = WMAX(scr->totalUsableArea[i].y1, area.y1);
|
||||||
scr->totalUsableArea[i].x2 = WMIN(scr->totalUsableArea[i].x2, area.x2);
|
scr->totalUsableArea[i].x2 = WMIN(scr->totalUsableArea[i].x2, area.x2);
|
||||||
@@ -911,22 +914,20 @@ wScreenUpdateUsableArea(WScreen *scr)
|
|||||||
scr->usableArea[i] = scr->totalUsableArea[i];
|
scr->usableArea[i] = scr->totalUsableArea[i];
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf( "usableArea[%d]: %d %d %d %d\n", i,
|
printf("usableArea[%d]: %d %d %d %d\n", i,
|
||||||
scr->usableArea[i].x1,
|
scr->usableArea[i].x1, scr->usableArea[i].x2,
|
||||||
scr->usableArea[i].x2,
|
scr->usableArea[i].y1, scr->usableArea[i].y2);
|
||||||
scr->usableArea[i].y1,
|
|
||||||
scr->usableArea[i].y2);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( wPreferences.no_window_over_icons) {
|
if (wPreferences.no_window_over_icons) {
|
||||||
if ( wPreferences.icon_yard & IY_VERT) {
|
if (wPreferences.icon_yard & IY_VERT) {
|
||||||
if ( wPreferences.icon_yard & IY_RIGHT) {
|
if (wPreferences.icon_yard & IY_RIGHT) {
|
||||||
scr->totalUsableArea[i].x1 += wPreferences.icon_size;
|
|
||||||
} else {
|
|
||||||
scr->totalUsableArea[i].x2 -= wPreferences.icon_size;
|
scr->totalUsableArea[i].x2 -= wPreferences.icon_size;
|
||||||
|
} else {
|
||||||
|
scr->totalUsableArea[i].x1 += wPreferences.icon_size;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( wPreferences.icon_yard & IY_TOP) {
|
if (wPreferences.icon_yard & IY_TOP) {
|
||||||
scr->totalUsableArea[i].y1 += wPreferences.icon_size;
|
scr->totalUsableArea[i].y1 += wPreferences.icon_size;
|
||||||
} else {
|
} else {
|
||||||
scr->totalUsableArea[i].y2 -= wPreferences.icon_size;
|
scr->totalUsableArea[i].y2 -= wPreferences.icon_size;
|
||||||
@@ -938,6 +939,7 @@ wScreenUpdateUsableArea(WScreen *scr)
|
|||||||
scr->totalUsableArea[i].x1 = rect.pos.x;
|
scr->totalUsableArea[i].x1 = rect.pos.x;
|
||||||
scr->totalUsableArea[i].x2 = rect.pos.x + rect.size.width;
|
scr->totalUsableArea[i].x2 = rect.pos.x + rect.size.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scr->totalUsableArea[i].y2 - scr->totalUsableArea[i].y1 < rect.size.height/2) {
|
if (scr->totalUsableArea[i].y2 - scr->totalUsableArea[i].y1 < rect.size.height/2) {
|
||||||
scr->totalUsableArea[i].y1 = rect.pos.y;
|
scr->totalUsableArea[i].y1 = rect.pos.y;
|
||||||
scr->totalUsableArea[i].y2 = rect.pos.y + rect.size.height;
|
scr->totalUsableArea[i].y2 = rect.pos.y + rect.size.height;
|
||||||
@@ -946,7 +948,7 @@ wScreenUpdateUsableArea(WScreen *scr)
|
|||||||
tmp_area = (scr->totalUsableArea[i].x2 - scr->totalUsableArea[i].x1) *
|
tmp_area = (scr->totalUsableArea[i].x2 - scr->totalUsableArea[i].x1) *
|
||||||
(scr->totalUsableArea[i].y2 - scr->totalUsableArea[i].y1);
|
(scr->totalUsableArea[i].y2 - scr->totalUsableArea[i].y1);
|
||||||
|
|
||||||
if ( tmp_area > best_area) {
|
if (tmp_area > best_area) {
|
||||||
best_area = tmp_area;
|
best_area = tmp_area;
|
||||||
area = scr->totalUsableArea[i];
|
area = scr->totalUsableArea[i];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
|
|||||||
for(i=0; i<scr->workspace_count; i++)
|
for(i=0; i<scr->workspace_count; i++)
|
||||||
if(scr->workspaces[i]->clip == wapp->app_icon->dock)
|
if(scr->workspaces[i]->clip == wapp->app_icon->dock)
|
||||||
break;
|
break;
|
||||||
assert( i < scr->workspace_count);
|
assert(i < scr->workspace_count);
|
||||||
/*n = i+1;*/
|
/*n = i+1;*/
|
||||||
name = scr->workspaces[i]->name;
|
name = scr->workspaces[i]->name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ wUserMenuGet(WScreen *scr, WWindow *wwin)
|
|||||||
char buffer[100];
|
char buffer[100];
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
if ( wwin->wm_instance && wwin->wm_class ) {
|
if (wwin->wm_instance && wwin->wm_class) {
|
||||||
int len = strlen(wwin->wm_instance)+strlen(wwin->wm_class)+7;
|
int len = strlen(wwin->wm_instance)+strlen(wwin->wm_class)+7;
|
||||||
tmp=wmalloc(len);
|
tmp=wmalloc(len);
|
||||||
snprintf(tmp,len,"%s.%s.menu",wwin->wm_instance,wwin->wm_class);
|
snprintf(tmp,len,"%s.%s.menu",wwin->wm_instance,wwin->wm_class);
|
||||||
|
|||||||
11
src/window.c
11
src/window.c
@@ -773,7 +773,7 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
/* get geometry stuff */
|
/* get geometry stuff */
|
||||||
wClientGetNormalHints(wwin, &wattribs, True, &x, &y, &width, &height);
|
wClientGetNormalHints(wwin, &wattribs, True, &x, &y, &width, &height);
|
||||||
|
|
||||||
/* printf( "wManageWindow: %d %d %d %d\n", x, y, width, height);*/
|
/* printf("wManageWindow: %d %d %d %d\n", x, y, width, height);*/
|
||||||
|
|
||||||
/* get colormap windows */
|
/* get colormap windows */
|
||||||
GetColormapWindows(wwin);
|
GetColormapWindows(wwin);
|
||||||
@@ -1152,10 +1152,10 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
* them. -alfredo
|
* them. -alfredo
|
||||||
*/
|
*/
|
||||||
#if 0
|
#if 0
|
||||||
printf( "xinerama PPosition: x: %d %d\n", x, (scr->scr_width - width)/2);
|
printf("xinerama PPosition: x: %d %d\n", x, (scr->scr_width - width)/2);
|
||||||
printf( "xinerama PPosition: y: %d %d\n", y, (scr->scr_height - height)/2);
|
printf("xinerama PPosition: y: %d %d\n", y, (scr->scr_height - height)/2);
|
||||||
|
|
||||||
if ( (unsigned)(x + (width - scr->scr_width)/2 + 10) < 20 &&
|
if ((unsigned)(x + (width - scr->scr_width)/2 + 10) < 20 &&
|
||||||
(unsigned)(y + (height - scr->scr_height)/2 + 10) < 20) {
|
(unsigned)(y + (height - scr->scr_height)/2 + 10) < 20) {
|
||||||
|
|
||||||
reposition = 1;
|
reposition = 1;
|
||||||
@@ -3005,7 +3005,8 @@ wWindowDeleteSavedStatesForPID(pid_t pid)
|
|||||||
void
|
void
|
||||||
wWindowSetOmnipresent(WWindow *wwin, Bool flag)
|
wWindowSetOmnipresent(WWindow *wwin, Bool flag)
|
||||||
{
|
{
|
||||||
if ( wwin->flags.omnipresent == flag) return;
|
if (wwin->flags.omnipresent == flag)
|
||||||
|
return;
|
||||||
|
|
||||||
wwin->flags.omnipresent = flag;
|
wwin->flags.omnipresent = flag;
|
||||||
WMPostNotificationName(WMNChangedState, wwin, "omnipresent");
|
WMPostNotificationName(WMNChangedState, wwin, "omnipresent");
|
||||||
|
|||||||
@@ -135,17 +135,17 @@ wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
|
|||||||
|
|
||||||
totalArea += a;
|
totalArea += a;
|
||||||
if (a > area) {
|
if (a > area) {
|
||||||
if ( best != -1)
|
if (best != -1)
|
||||||
*flags |= XFLAG_MULTIPLE;
|
*flags |= XFLAG_MULTIPLE;
|
||||||
area = a;
|
area = a;
|
||||||
best = i;
|
best = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( best == -1) {
|
if (best == -1) {
|
||||||
*flags |= XFLAG_DEAD;
|
*flags |= XFLAG_DEAD;
|
||||||
best = wGetHeadForPointerLocation(scr);
|
best = wGetHeadForPointerLocation(scr);
|
||||||
} else if ( totalArea != rw*rh)
|
} else if (totalArea != rw*rh)
|
||||||
*flags |= XFLAG_PARTIAL;
|
*flags |= XFLAG_PARTIAL;
|
||||||
|
|
||||||
return best;
|
return best;
|
||||||
@@ -242,7 +242,7 @@ wGetHeadForPoint(WScreen *scr, WMPoint point, int *flags)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
// paranoia
|
// paranoia
|
||||||
if ( flags == NULL) {
|
if (flags == NULL) {
|
||||||
static int tmp;
|
static int tmp;
|
||||||
flags = &tmp;
|
flags = &tmp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ WArea wGetUsableAreaForHead(WScreen *scr, int head, WArea *totalAreaPtr, Bool no
|
|||||||
|
|
||||||
WMPoint wGetPointToCenterRectInHead(WScreen *scr, int head, int width, int height);
|
WMPoint wGetPointToCenterRectInHead(WScreen *scr, int head, int width, int height);
|
||||||
|
|
||||||
|
Bool wWindowTouchesHead(WWindow *wwin, int head);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user