diff --git a/src/Makefile.am b/src/Makefile.am index faa04424e..a8c658457 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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) diff --git a/src/border.c b/src/border.c index 054d8d813..c5ed0f9be 100644 --- a/src/border.c +++ b/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 */ diff --git a/src/e.h b/src/e.h index 5fa720007..d00621c86 100644 --- a/src/e.h +++ b/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 { diff --git a/src/icccm.c b/src/icccm.c index 33c21b1db..3e9302133 100644 --- a/src/icccm.c +++ b/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) { diff --git a/src/icons.c b/src/icons.c index 5cd2a46a5..89cef5b28 100644 --- a/src/icons.c +++ b/src/icons.c @@ -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;