- w=mode->origgeom.w-realdx1+realdx2;
- h=mode->origgeom.h-realdy1+realdy2;
-
- if(w<=0)
- w=mode->hints.min_width;
- if(h<=0)
- h=mode->hints.min_height;
+ w=maxof(1, mode->origgeom.w-realdx1+realdx2);
+ h=maxof(1, mode->origgeom.h-realdy1+realdy2);
+
+ if(mode->snap_enabled && mode->hints.base_set){
+ w=clamp_up(w, mode->hints.base_width-er, mode->hints.base_width);
+ h=clamp_up(h, mode->hints.base_height-er, mode->hints.base_height);
+ }