Advertisement
Guest User

Untitled

a guest
Oct 1st, 2011
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.51 KB | None | 0 0
  1. Index: src/window.cpp
  2. ===================================================================
  3. --- src/window.cpp      (révision 22967)
  4. +++ src/window.cpp      (copie de travail)
  5. @@ -1248,6 +1248,7 @@
  6.  
  7.         int16 default_width  = max(desc->default_width,  sm_width);
  8.         int16 default_height = max(desc->default_height, sm_height);
  9. +       int16 min_y;
  10.  
  11.         if (desc->parent_cls != 0 /* WC_MAIN_WINDOW */ &&
  12.                         (w = FindWindowById(desc->parent_cls, window_number)) != NULL &&
  13. @@ -1266,7 +1267,17 @@
  14.                         return GetToolbarAlignedWindowPosition(default_width);
  15.  
  16.                 case WDP_AUTO: // Find a good automatic position for the window
  17. -                       return GetAutoPlacePosition(default_width, default_height);
  18. +                       // Center on cursor
  19. +                       pt.x = _cursor.draw_pos.x - (default_width / 2);
  20. +                       pt.y = _cursor.draw_pos.y - (default_height / 2);
  21. +                       w = FindWindowById(WC_MAIN_TOOLBAR, 0);
  22. +                       if (w != NULL && (pt.x + default_width) > w->left && pt.x < (w->left + w->width))
  23. +                               min_y = w->height;
  24. +                       else
  25. +                               min_y = 0;
  26. +                       if (pt.y < min_y)
  27. +                               pt.y = min_y;
  28. +                       break;
  29.  
  30.                 case WDP_CENTER: // Centre the window horizontally
  31.                         pt.x = (_screen.width - default_width) / 2;
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement