> I think you forgot the patch? :-)

Indeed ^_^ (yet I'm almost sure to have attached it... strangeness
strikes in unexpected places sometimes...)

So, here it is (again)
I also attach the icons. The diff file does contains "stuff" (GIT
binary patch) about it but when I checked and applied the patch to test,
the icons were not created... I must confess my ignorance in this
matter, maybe it needs some special applied-by-git way of patching or
something (oh, and the icons are the same for fairh and fairv, because
right now I don't find a graphical way to differentiate the two)

Chúc sức khỏe,
Gưenhael
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6c1fc8..fe20a11 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,6 +72,8 @@ set(AWE_SRCS
     ${SOURCE_DIR}/common/xscreen.c
     ${SOURCE_DIR}/common/xutil.c
     ${SOURCE_DIR}/layouts/fibonacci.c
+    ${SOURCE_DIR}/layouts/fairh.c
+    ${SOURCE_DIR}/layouts/fairv.c
     ${SOURCE_DIR}/layouts/floating.c
     ${SOURCE_DIR}/layouts/magnifier.c
     ${SOURCE_DIR}/layouts/max.c
diff --git a/awesomerc.lua.in b/awesomerc.lua.in
index ff2d959..1636a78 100644
--- a/awesomerc.lua.in
+++ b/awesomerc.lua.in
@@ -30,7 +30,9 @@ layouts =
     "max",
     "spiral",
     "dwindle",
-    "floating"
+    "floating",
+    "fairh",
+    "fairv",
 }
 
 -- Table of clients that should be set floating. The index may be either
diff --git a/icons/layouts/fairh.png b/icons/layouts/fairh.png
new file mode 100644
index 0000000000000000000000000000000000000000..2ed2167fa4f0e8323a7fe55495cb2a73032b881a
GIT binary patch
literal 184
[EMAIL PROTECTED](olHy`uVBq!ia0vp^4j|0P3?wHke>@jRF%}28J29*~C-V}>VGHmHah*QB
[EMAIL PROTECTED]@Q5sCVBi)8VMc~ob0mO*>?NMQ
zuIx8B<d}^tnQUy=1BK)~T^vI+&L{uiXXTmE!_LFg!!99l!(AZR#KeO~j6v$fqKgfu
[EMAIL PROTECTED]

literal 0
HcmV?d00001

diff --git a/icons/layouts/fairhw.png b/icons/layouts/fairhw.png
new file mode 100644
index 0000000000000000000000000000000000000000..5c37d254df32000e312091c130796faeae3c4a96
GIT binary patch
literal 337
[EMAIL PROTECTED](olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|*pj^6U4S$Y
z{B+)352QE?JR*x37`TN&[EMAIL PROTECTED]&IZksCb7lcgppayVYeb22er|4R
zUI~M9QEFmIYKlU6W=V#EyQgnJcq5-UP|[EMAIL PROTECTED]<w?{uwFQF_xJsXO>=pg
zxy1A`?!Dh)@WCTRWkzV|MGJ2e|[EMAIL PROTECTED]<(cyHF37<B<<
z28IKC4#$-n`GBT^z&7K}Am)M9#`W)CfJK0W!|f$+HweC%D|[EMAIL PROTECTED]
oA6!)WeJU-tuI=lNa)-}<7!DlQE&QrlF9=fa>FVdQ&[EMAIL PROTECTED];s5{u

literal 0
HcmV?d00001

diff --git a/icons/layouts/fairv.png b/icons/layouts/fairv.png
new file mode 100644
index 0000000000000000000000000000000000000000..2ed2167fa4f0e8323a7fe55495cb2a73032b881a
GIT binary patch
literal 184
[EMAIL PROTECTED](olHy`uVBq!ia0vp^4j|0P3?wHke>@jRF%}28J29*~C-V}>VGHmHah*QB
[EMAIL PROTECTED]@Q5sCVBi)8VMc~ob0mO*>?NMQ
zuIx8B<d}^tnQUy=1BK)~T^vI+&L{uiXXTmE!_LFg!!99l!(AZR#KeO~j6v$fqKgfu
[EMAIL PROTECTED]

literal 0
HcmV?d00001

diff --git a/icons/layouts/fairvw.png b/icons/layouts/fairvw.png
new file mode 100644
index 0000000000000000000000000000000000000000..5c37d254df32000e312091c130796faeae3c4a96
GIT binary patch
literal 337
[EMAIL PROTECTED](olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|*pj^6U4S$Y
z{B+)352QE?JR*x37`TN&[EMAIL PROTECTED]&IZksCb7lcgppayVYeb22er|4R
zUI~M9QEFmIYKlU6W=V#EyQgnJcq5-UP|[EMAIL PROTECTED]<w?{uwFQF_xJsXO>=pg
zxy1A`?!Dh)@WCTRWkzV|MGJ2e|[EMAIL PROTECTED]<(cyHF37<B<<
z28IKC4#$-n`GBT^z&7K}Am)M9#`W)CfJK0W!|f$+HweC%D|[EMAIL PROTECTED]
oA6!)WeJU-tuI=lNa)-}<7!DlQE&QrlF9=fa>FVdQ&[EMAIL PROTECTED];s5{u

literal 0
HcmV?d00001

diff --git a/layouts/fairh.c b/layouts/fairh.c
new file mode 100644
index 0000000..468e1f9
--- /dev/null
+++ b/layouts/fairh.c
@@ -0,0 +1,75 @@
+/*
+ * fairh.c - fairh layout
+ *
+ * Copyright © 2008 Gwenhael Le Moine <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include "screen.h"
+#include "tag.h"
+#include "client.h"
+#include "layouts/fairh.h"
+
+
+extern awesome_t globalconf;
+
+void layout_fairh(int screen)
+{
+  int x_divisions = 1, x_divisions_last_line, y_divisions, x, y, n = 0;
+  client_t *c;
+  area_t geometry, area;
+
+  geometry = area = screen_area_get(&globalconf.screens[screen].geometry,
+				    globalconf.screens[screen].statusbar,
+				    &globalconf.screens[screen].padding);
+  for( c = globalconf.clients ; c ; c = c->next )
+    if(IS_TILED(c, screen))
+      ++n;
+
+	if ( n != 0 ) {
+		while(x_divisions*x_divisions < n)
+			++x_divisions;
+		y_divisions = ( x_divisions * ( x_divisions - 1 ) >= n ) ? x_divisions - 1 : x_divisions;
+
+		x_divisions_last_line = n - ( x_divisions * ( y_divisions - 1 ) );
+
+		x = y = n = 0;
+		for( c = globalconf.clients ; c ; c = c->next ) {
+			if( IS_TILED(c, screen) ) {
+				++n;
+
+				geometry.height = ( area.height / y_divisions ) - ( 2 * c->border );
+				if ( ( ( y + 1 ) == y_divisions ) && ( x_divisions_last_line ) )
+					geometry.width = ( area.width / x_divisions_last_line ) - ( 2 * c->border );
+				else
+					geometry.width = ( area.width / x_divisions ) - ( 2 * c->border );
+      
+				geometry.x = area.x + geometry.width * x;
+				geometry.y = area.y + geometry.height * y;
+      
+				client_resize( c, geometry, c->honorsizehints );
+
+				if ( x == x_divisions - 1 ) {
+					x = 0;
+					++y;
+				}
+				else
+					++x;
+			}
+		}
+	}
+}
diff --git a/layouts/fairh.h b/layouts/fairh.h
new file mode 100644
index 0000000..32c8268
--- /dev/null
+++ b/layouts/fairh.h
@@ -0,0 +1,30 @@
+/*
+ * fairh.h - fairh layout header
+ *
+ * Copyright © 2008 Gwenhael Le Moine <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef AWESOME_FAIRH_H
+#define AWESOME_FAIRH_H
+
+#include "layout.h"
+
+layout_t layout_fairh;
+
+#endif
+// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
diff --git a/layouts/fairv.c b/layouts/fairv.c
new file mode 100644
index 0000000..4211a28
--- /dev/null
+++ b/layouts/fairv.c
@@ -0,0 +1,80 @@
+/*
+ * fairv.c - fairv layout
+ *
+ * Copyright © 2008 Gwenhael Le Moine <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include "screen.h"
+#include "tag.h"
+#include "client.h"
+#include "layouts/fairv.h"
+
+
+extern awesome_t globalconf;
+
+void layout_fairv(int screen)
+{
+  int x_divisions, y_divisions_last_column, y_divisions = 1, x, y, n = 0;
+  client_t *c;
+  area_t geometry, area;
+
+  geometry = area = screen_area_get(&globalconf.screens[screen].geometry,
+																		globalconf.screens[screen].statusbar,
+																		&globalconf.screens[screen].padding);
+
+  for( c = globalconf.clients ; c ; c = c->next )
+    if( IS_TILED( c, screen ) )
+      ++n;
+	
+	if ( n != 0 ) {
+		while( y_divisions * y_divisions < n )
+			++y_divisions;
+		
+		x_divisions = ( y_divisions * ( y_divisions - 1 ) >= n ) ?
+			y_divisions - 1 :
+			y_divisions;
+		
+		y_divisions_last_column = n - ( ( x_divisions - 1 ) * y_divisions );
+
+		x = y = n = 0;
+		for( c = globalconf.clients ; c ; c = c->next ) {
+			if( IS_TILED(c, screen) ) {
+				++n;
+
+				geometry.width = ( area.width / x_divisions ) - ( 2 * c->border );
+
+				if ( ( ( x + 1 ) == x_divisions ) && ( y_divisions_last_column ) )
+					geometry.height = ( area.height / y_divisions_last_column ) - ( 2 * c->border );
+				else
+					geometry.height = ( area.height / y_divisions ) - ( 2 * c->border );
+      
+				geometry.x = area.x + geometry.width * x;
+				geometry.y = area.y + geometry.height * y;
+      
+				client_resize( c, geometry, c->honorsizehints );
+
+				if( y == y_divisions - 1 ) {
+					y = 0;
+					++x;
+				}
+				else
+					++y;
+			}
+		}
+	}
+}
diff --git a/layouts/fairv.h b/layouts/fairv.h
new file mode 100644
index 0000000..f5f4dfd
--- /dev/null
+++ b/layouts/fairv.h
@@ -0,0 +1,30 @@
+/*
+ * fairv.h - fairv layout header
+ *
+ * Copyright © 2008 Gwenhael Le Moine <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef AWESOME_FAIRV_H
+#define AWESOME_FAIRV_H
+
+#include "layout.h"
+
+layout_t layout_fairv;
+
+#endif
+// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
diff --git a/tag.c b/tag.c
index a892b6d..43c44c5 100644
--- a/tag.c
+++ b/tag.c
@@ -30,6 +30,8 @@
 #include "layouts/max.h"
 #include "layouts/floating.h"
 #include "layouts/fibonacci.h"
+#include "layouts/fairh.h"
+#include "layouts/fairv.h"
 
 #include "layoutgen.h"

<<attachment: fairh.png>>

<<attachment: fairhw.png>>

<<attachment: fairv.png>>

<<attachment: fairvw.png>>

Reply via email to