[hackers] [dwm] reverted some resize() changes, reverted setlocale removal || Anselm R Garbe

From: <hg_AT_suckless.org>
Date: Mon, 25 Aug 2008 08:38:34 +0000 (UTC)

changeset: 1343:f4707b7bd3a2
tag: tip
user: Anselm R Garbe <garbeam_AT_gmail.com>
date: Mon Aug 25 09:37:39 2008 +0100
files: dwm.c
description:
reverted some resize() changes, reverted setlocale removal

diff -r a2f37186527c -r f4707b7bd3a2 dwm.c
--- a/dwm.c Sat Aug 23 09:54:55 2008 +0100
+++ b/dwm.c Mon Aug 25 09:37:39 2008 +0100
@@ -24,6 +24,7 @@
  * To understand everything else, start reading main().
  */
 #include <errno.h>
+#include <locale.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -1046,7 +1047,6 @@
 
 void
 resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
- float a;
         XWindowChanges wc;
 
         if(sizehints) {
@@ -1064,11 +1064,10 @@
 
                 /* adjust for aspect limits */
                 if(c->mina > 0 && c->maxa > 0) {
- a = (float) w/h;
- if(a > c->maxa)
+ if(c->maxa < (float)(w / h))
                                 w = h * c->maxa;
- else if(a < c->mina)
- h = w / c->mina;
+ else if(c->mina < (float)(h / w))
+ h = w * c->mina;
                 }
 
                 if(baseismin) { /* increment calculation requires this */
@@ -1712,7 +1711,7 @@
         else if(argc != 1)
                 die("usage: dwm [-v]\n");
 
- if(!XSupportsLocale())
+ if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
                 fprintf(stderr, "warning: no locale support\n");
 
         if(!(dpy = XOpenDisplay(0)))
Received on Mon Aug 25 2008 - 08:38:34 UTC

This archive was generated by hypermail 2.2.0 : Mon Aug 25 2008 - 08:48:07 UTC