Index: place.c
===================================================================
RCS file: /cvs/gnome/metacity/src/place.c,v
retrieving revision 1.29
diff -p -r1.29 place.c
*** place.c	2 Oct 2002 02:42:24 -0000	1.29
--- place.c	4 Jan 2003 16:21:55 -0000
***************
*** 1,5 ****
  /* Metacity window placement */
- 
  /* 
   * Copyright (C) 2001 Havoc Pennington
   * 
--- 1,4 ----
*************** fit_rect_in_xinerama (MetaScreen    *scr
*** 370,375 ****
--- 369,375 ----
    int i;
    int best_index;
    int best_overlap;
+   int fluff;
    const MetaXineramaScreenInfo *xsi;
    
    /* Find xinerama with best fit, then
*************** fit_rect_in_xinerama (MetaScreen    *scr
*** 410,420 ****
    g_assert (best_index >= 0);
  
    xsi = &screen->xinerama_infos[best_index];
!   
!   if (rect->x < xsi->x_origin)
!     rect->x = xsi->x_origin;
!   if (rect->y < xsi->y_origin)
!     rect->y = xsi->y_origin;
  
    /* Now return whether we are entirely within the xinerama screen */
    return
--- 410,423 ----
    g_assert (best_index >= 0);
  
    xsi = &screen->xinerama_infos[best_index];
! 
!   if ((rect->x < xsi->x_origin) || (rect->y < xsi->y_origin))
!     {
!       fluff = (xsi->width % rect->width) / 2;
!       rect->x = xsi->x_origin+fluff;
!       fluff = (xsi->height % rect->height) / 4;
!       rect->y = xsi->y_origin+fluff;
!     }
  
    /* Now return whether we are entirely within the xinerama screen */
    return
*************** find_first_fit (MetaWindow *window,
*** 449,454 ****
--- 452,458 ----
     */
    
    int retval;
+   int fluff;
    GList *sorted;
    GList *tmp;
    MetaRectangle rect;
*************** find_first_fit (MetaWindow *window,
*** 467,474 ****
      }
  
    /* Try origin of first Xinerama */
!   rect.x = window->screen->xinerama_infos[0].x_origin;
!   rect.y = window->screen->xinerama_infos[0].y_origin;
  
    if (fit_rect_in_xinerama (window->screen, &rect) &&
        !rectangle_overlaps_some_window (&rect, windows))
--- 471,480 ----
      }
  
    /* Try origin of first Xinerama */
!   fluff = (window->screen->xinerama_infos[0].width % rect.width) / 2;
!   rect.x = window->screen->xinerama_infos[0].x_origin + fluff;
!   fluff = (window->screen->xinerama_infos[0].height % rect.height) / 4;
!   rect.y = window->screen->xinerama_infos[0].y_origin + fluff;
  
    if (fit_rect_in_xinerama (window->screen, &rect) &&
        !rectangle_overlaps_some_window (&rect, windows))
*************** find_first_fit (MetaWindow *window,
*** 540,546 ****
        if (fit_rect_in_xinerama (window->screen, &rect) &&
            !rectangle_overlaps_some_window (&rect, sorted))
          {
!           *new_x = rect.x;
            *new_y = rect.y;
            if (fgeom)
              {
--- 546,552 ----
        if (fit_rect_in_xinerama (window->screen, &rect) &&
            !rectangle_overlaps_some_window (&rect, sorted))
          {
!          *new_x = rect.x;
            *new_y = rect.y;
            if (fgeom)
              {
*************** find_first_fit (MetaWindow *window,
*** 560,572 ****
    i = 1;
    while (i < window->screen->n_xinerama_infos)
      {
!       rect.x = window->screen->xinerama_infos[i].x_origin;
!       rect.y = window->screen->xinerama_infos[i].y_origin;
!       
        if (fit_rect_in_xinerama (window->screen, &rect) &&
            !rectangle_overlaps_some_window (&rect, windows))
          {
!           *new_x = rect.x;
            *new_y = rect.y;
            if (fgeom)
              {
--- 566,580 ----
    i = 1;
    while (i < window->screen->n_xinerama_infos)
      {
!       fluff = (window->screen->xinerama_infos[i].width % rect.width) / 2;
!       rect.x = window->screen->xinerama_infos[i].x_origin + fluff;
!       fluff = (window->screen->xinerama_infos[i].height % rect.height) / 4;
!       rect.y = window->screen->xinerama_infos[i].y_origin + fluff;
!      
        if (fit_rect_in_xinerama (window->screen, &rect) &&
            !rectangle_overlaps_some_window (&rect, windows))
          {
! 	  *new_x = rect.x;
            *new_y = rect.y;
            if (fgeom)
              {
