654 _last_z_window++; |
654 _last_z_window++; |
655 } |
655 } |
656 |
656 |
657 CallWindowEventNP(w, WE_CREATE); |
657 CallWindowEventNP(w, WE_CREATE); |
658 |
658 |
659 /* Try to make windows smaller when our window is too small */ |
659 /* Try to make windows smaller when our window is too small. |
660 if (min_width != def_width || min_height != def_height) { |
660 * w->(width|height) is normally the same as min_(width|height), |
|
661 * but this way the GUIs can be made a little more dynamic; |
|
662 * one can use the same spec for multiple windows and those |
|
663 * can then determine the real minimum size of the window. */ |
|
664 if (w->width != def_width || w->height != def_height) { |
661 /* Think about the overlapping toolbars when determining the minimum window size */ |
665 /* Think about the overlapping toolbars when determining the minimum window size */ |
662 int free_height = _screen.height; |
666 int free_height = _screen.height; |
663 const Window *wt = FindWindowById(WC_STATUS_BAR, 0); |
667 const Window *wt = FindWindowById(WC_STATUS_BAR, 0); |
664 if (wt != NULL) free_height -= wt->height; |
668 if (wt != NULL) free_height -= wt->height; |
665 wt = FindWindowById(WC_MAIN_TOOLBAR, 0); |
669 wt = FindWindowById(WC_MAIN_TOOLBAR, 0); |
666 if (wt != NULL) free_height -= wt->height; |
670 if (wt != NULL) free_height -= wt->height; |
667 |
671 |
668 int enlarge_x = max(min(def_width - min_width, _screen.width - min_width), 0); |
672 int enlarge_x = max(min(def_width - w->width, _screen.width - w->width), 0); |
669 int enlarge_y = max(min(def_height - min_height, free_height - min_height), 0); |
673 int enlarge_y = max(min(def_height - w->height, free_height - w->height), 0); |
670 |
674 |
671 /* X and Y has to go by step.. calculate it. |
675 /* X and Y has to go by step.. calculate it. |
672 * The cast to int is necessary else x/y are implicitly casted to |
676 * The cast to int is necessary else x/y are implicitly casted to |
673 * unsigned int, which won't work. */ |
677 * unsigned int, which won't work. */ |
674 if (w->resize.step_width > 1) enlarge_x -= enlarge_x % (int)w->resize.step_width; |
678 if (w->resize.step_width > 1) enlarge_x -= enlarge_x % (int)w->resize.step_width; |