forked from enlightenment/enlightenment
ok- fixes i did over the weekend... committed :) yay :)
SVN revision: 4479
This commit is contained in:
parent
718be21b4b
commit
aaabd199fa
|
@ -29,5 +29,5 @@ util.c \
|
|||
view.c \
|
||||
e.h
|
||||
|
||||
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm $(INTLLIBS)
|
||||
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm -lc $(INTLLIBS)
|
||||
|
||||
|
|
97
src/border.c
97
src/border.c
|
@ -1131,6 +1131,7 @@ E_Border *
|
|||
e_border_adopt(Window win, int use_client_pos)
|
||||
{
|
||||
E_Border *b;
|
||||
int bw;
|
||||
|
||||
/* create the struct */
|
||||
b = e_border_new();
|
||||
|
@ -1147,35 +1148,21 @@ e_border_adopt(Window win, int use_client_pos)
|
|||
e_window_set_events(b->win.container, XEV_CHILD_CHANGE | XEV_CHILD_REDIRECT);
|
||||
/* add to save set & border of 0 */
|
||||
e_icccm_adopt(win);
|
||||
bw = e_window_get_border_width(win);
|
||||
e_window_set_border_width(win, 0);
|
||||
b->win.client = win;
|
||||
b->current.requested.visible = 1;
|
||||
/* get hints */
|
||||
e_icccm_get_size_info(win, b);
|
||||
e_icccm_get_pos_info(win, b);
|
||||
{
|
||||
int x, y, w, h;
|
||||
int pl, pr, pt, pb;
|
||||
|
||||
x = 0; y = 0; w = 0; h = 0;
|
||||
e_window_get_geometry(win, &x, &y, &w, &h);
|
||||
pl = pr = pt = pb = 0;
|
||||
if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb);
|
||||
if (!b->placed)
|
||||
{
|
||||
/* get x,y location of client */
|
||||
x = rand()%640;
|
||||
y = rand()%480;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = b->current.x + pl;
|
||||
y = b->current.y + pt;
|
||||
}
|
||||
b->current.requested.x = x - pl;
|
||||
b->current.requested.y = y - pt;
|
||||
b->current.requested.w = w + pl + pr;
|
||||
b->current.requested.h = h + pt + pb;
|
||||
b->changed = 1;
|
||||
b->current.requested.x = x;
|
||||
b->current.requested.y = y;
|
||||
b->current.requested.w = w;
|
||||
b->current.requested.h = h;
|
||||
}
|
||||
|
||||
e_icccm_get_mwm_hints(win, b);
|
||||
|
@ -1208,6 +1195,76 @@ e_border_adopt(Window win, int use_client_pos)
|
|||
b->current.requested.y += pt;
|
||||
b->changed = 1;
|
||||
}
|
||||
{
|
||||
int x, y, w, h;
|
||||
int pl, pr, pt, pb;
|
||||
|
||||
pl = pr = pt = pb = 0;
|
||||
if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb);
|
||||
bw *= 2;
|
||||
if (b->client.pos.requested)
|
||||
{
|
||||
switch (b->client.pos.gravity)
|
||||
{
|
||||
case NorthWestGravity:
|
||||
x = b->client.pos.x + pl;
|
||||
y = b->client.pos.y + pt;
|
||||
break;
|
||||
case NorthGravity:
|
||||
x = b->client.pos.x + (bw / 2);
|
||||
y = b->client.pos.y + pt;
|
||||
break;
|
||||
case NorthEastGravity:
|
||||
x = b->client.pos.x - pr + bw;
|
||||
y = b->client.pos.y + pt;
|
||||
break;
|
||||
case EastGravity:
|
||||
x = b->client.pos.x - pr + bw;
|
||||
y = b->client.pos.y + (bw / 2);
|
||||
break;
|
||||
case SouthEastGravity:
|
||||
x = b->client.pos.x - pr + bw;
|
||||
y = b->client.pos.y - pb + bw;
|
||||
break;
|
||||
case SouthGravity:
|
||||
x = b->client.pos.x + (bw / 2);
|
||||
y = b->client.pos.y - pb;
|
||||
break;
|
||||
case SouthWestGravity:
|
||||
x = b->client.pos.x + pl;
|
||||
y = b->client.pos.y - pb;
|
||||
break;
|
||||
case WestGravity:
|
||||
x = b->client.pos.x + pl;
|
||||
y = b->client.pos.y + (bw / 2);
|
||||
break;
|
||||
case CenterGravity:
|
||||
x = b->client.pos.x;
|
||||
y = b->client.pos.y;
|
||||
break;
|
||||
case StaticGravity:
|
||||
x = b->client.pos.x;
|
||||
y = b->client.pos.y;
|
||||
break;
|
||||
case ForgetGravity:
|
||||
x = b->client.pos.x;
|
||||
y = b->client.pos.y;
|
||||
break;
|
||||
default:
|
||||
x = b->client.pos.x + pl;
|
||||
y = b->client.pos.y + pt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x = rand()%600 + pl;
|
||||
y = rand()%400 + pt;
|
||||
}
|
||||
b->current.requested.x = x - pl;
|
||||
b->current.requested.y = y - pt;
|
||||
b->changed = 1;
|
||||
}
|
||||
/* show the client */
|
||||
e_icccm_state_mapped(win);
|
||||
/* fix size so it matches the hints a client asks for */
|
||||
|
|
5
src/e.h
5
src/e.h
|
@ -220,6 +220,11 @@ struct _E_Border
|
|||
int border;
|
||||
int handles;
|
||||
int w, h;
|
||||
struct {
|
||||
int requested;
|
||||
int x, y;
|
||||
int gravity;
|
||||
} pos;
|
||||
} client;
|
||||
|
||||
struct {
|
||||
|
|
29
src/icccm.c
29
src/icccm.c
|
@ -134,6 +134,35 @@ e_icccm_release(Window win)
|
|||
e_window_del_from_save_set(win);
|
||||
}
|
||||
|
||||
void
|
||||
e_icccm_get_pos_info(Window win, E_Border *b)
|
||||
{
|
||||
XSizeHints hint;
|
||||
int mask;
|
||||
|
||||
if (e_window_get_wm_size_hints(win, &hint, &mask))
|
||||
{
|
||||
if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
|
||||
{
|
||||
int x, y, w, h;
|
||||
|
||||
printf("%i %i\n", hint.flags & USPosition, hint.flags & PPosition);
|
||||
b->client.pos.requested = 1;
|
||||
b->client.pos.gravity = NorthWestGravity;
|
||||
if (hint.flags & PWinGravity)
|
||||
b->client.pos.gravity = hint.win_gravity;
|
||||
x = y = w = h = 0;
|
||||
e_window_get_geometry(win, &x, &y, &w, &h);
|
||||
b->client.pos.x = x;
|
||||
b->client.pos.y = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
b->client.pos.requested = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_icccm_get_size_info(Window win, E_Border *b)
|
||||
{
|
||||
|
|
|
@ -306,7 +306,7 @@ e_icon_calulcate_geometry(E_Icon *icon)
|
|||
icon->current.ix = icon->current.x;
|
||||
icon->current.iy = icon->current.y;
|
||||
icon->current.tx = icon->current.x + ((iw - tw) / 2);
|
||||
icon->current.ty = icon->current.y + ih;
|
||||
icon->current.ty = icon->current.y + icon->view->spacing.icon.top + icon->view->spacing.icon.bottom + ih;
|
||||
icon->current.w = iw;
|
||||
icon->current.h = ih + th;
|
||||
icon->current.iw = iw;
|
||||
|
@ -319,7 +319,7 @@ e_icon_calulcate_geometry(E_Icon *icon)
|
|||
icon->current.ix = icon->current.x + ((tw - iw) / 2);
|
||||
icon->current.iy = icon->current.y;
|
||||
icon->current.tx = icon->current.x;
|
||||
icon->current.ty = icon->current.y + ih;
|
||||
icon->current.ty = icon->current.y + icon->view->spacing.icon.top + icon->view->spacing.icon.bottom + ih;
|
||||
icon->current.w = tw;
|
||||
icon->current.h = ih + th;
|
||||
icon->current.iw = iw;
|
||||
|
|
Loading…
Reference in New Issue