reverted some resize() changes, reverted setlocale removal
6411aa92
1 file(s) · +5 −6
| 24 | 24 | * To understand everything else, start reading main(). |
|
| 25 | 25 | */ |
|
| 26 | 26 | #include <errno.h> |
|
| 27 | + | #include <locale.h> |
|
| 27 | 28 | #include <stdarg.h> |
|
| 28 | 29 | #include <stdio.h> |
|
| 29 | 30 | #include <stdlib.h> |
|
| 1046 | 1047 | ||
| 1047 | 1048 | void |
|
| 1048 | 1049 | resize(Client *c, int x, int y, int w, int h, Bool sizehints) { |
|
| 1049 | - | float a; |
|
| 1050 | 1050 | XWindowChanges wc; |
|
| 1051 | 1051 | ||
| 1052 | 1052 | if(sizehints) { |
|
| 1064 | 1064 | ||
| 1065 | 1065 | /* adjust for aspect limits */ |
|
| 1066 | 1066 | if(c->mina > 0 && c->maxa > 0) { |
|
| 1067 | - | a = (float) w/h; |
|
| 1068 | - | if(a > c->maxa) |
|
| 1067 | + | if(c->maxa < (float)(w / h)) |
|
| 1069 | 1068 | w = h * c->maxa; |
|
| 1070 | - | else if(a < c->mina) |
|
| 1071 | - | h = w / c->mina; |
|
| 1069 | + | else if(c->mina < (float)(h / w)) |
|
| 1070 | + | h = w * c->mina; |
|
| 1072 | 1071 | } |
|
| 1073 | 1072 | ||
| 1074 | 1073 | if(baseismin) { /* increment calculation requires this */ |
|
| 1712 | 1711 | else if(argc != 1) |
|
| 1713 | 1712 | die("usage: dwm [-v]\n"); |
|
| 1714 | 1713 | ||
| 1715 | - | if(!XSupportsLocale()) |
|
| 1714 | + | if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) |
|
| 1716 | 1715 | fprintf(stderr, "warning: no locale support\n"); |
|
| 1717 | 1716 | ||
| 1718 | 1717 | if(!(dpy = XOpenDisplay(0))) |
|