[metacity] window placement in xinerama mode



I believe there is a small bug in metacity (at least up to 2.5), when
multiple screens are connected to the machine.
The windows (gnome-terminal,...) are always placed on the screen 0.

The following patches fixes this behavior. I have kept the modification
minimal to make the patch clearer, there are some style fixes to do.

regards,
Emmanuel, GtkAda team

*** ../place.c	Tue Feb  4 23:33:25 2003
--- src/place.c	Tue Feb  4 23:20:08 2003
***************
*** 435,442 ****
                  MetaFrameGeometry *fgeom,
                  /* visible windows on relevant workspaces */
                  GList      *windows,
!                 int         x,
!                 int         y,
                  int        *new_x,
                  int        *new_y)
  {
--- 435,441 ----
                  MetaFrameGeometry *fgeom,
                  /* visible windows on relevant workspaces */
                  GList      *windows,
! 		const MetaXineramaScreenInfo* current_xinerama,
                  int        *new_x,
                  int        *new_y)
  {
***************
*** 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))
--- 466,473 ----
      }
  
    /* Try origin of first Xinerama */
!   rect.x = current_xinerama->x_origin;
!   rect.y = current_xinerama->y_origin;
  
    if (fit_rect_in_xinerama (window->screen, &rect) &&
        !rectangle_overlaps_some_window (&rect, windows))
***************
*** 556,583 ****
        tmp = tmp->next;
      }  
  
!   /* Origin of each Xinerama screen which isn't the first */
!   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)
!             {
!               *new_x += fgeom->left_width;
!               *new_y += fgeom->top_height;
!             }
!       
!           retval = TRUE;
!           
!           goto out;
!         }
        ++i;
      }
    
--- 555,585 ----
        tmp = tmp->next;
      }  
  
!   /* Origin of each Xinerama screen which isn't the current */
!   i = 0;
    while (i < window->screen->n_xinerama_infos)
      {
!       if (window->screen->xinerama_infos[i].number !=
current_xinerama->number)
! 	{
! 	  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)
! 		{
! 		  *new_x += fgeom->left_width;
! 		  *new_y += fgeom->top_height;
! 		}
! 	      
! 	      retval = TRUE;
! 	      
! 	      goto out;
! 	    }
! 	}
        ++i;
      }
    
***************
*** 839,845 ****
    x = xi->x_origin;
    y = xi->y_origin;
  
!   if (find_first_fit (window, fgeom, windows, x, y, &x, &y))
      goto done;
    
    find_next_cascade (window, fgeom, windows, x, y, &x, &y);
--- 841,847 ----
    x = xi->x_origin;
    y = xi->y_origin;
  
!   if (find_first_fit (window, fgeom, windows, xi, &x, &y))
      goto done;
    
    find_next_cascade (window, fgeom, windows, x, y, &x, &y);





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]