Index: gok/gok-keyboard.c
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-keyboard.c,v
retrieving revision 1.127
diff -u -r1.127 gok-keyboard.c
--- gok/gok-keyboard.c	5 Feb 2004 17:18:54 -0000	1.127
+++ gok/gok-keyboard.c	9 Feb 2004 02:44:58 -0000
@@ -58,8 +58,14 @@
 
 /* TODO: i18n */
 #define CORE_KEYBOARD "Keyboard"
-/*#define ALPHA_KEYBOARD "Keyboard" testing hack */
+
+/* #define TEST_GOK_FREQUENCY_BASED_KEY_PLACEMENT */ /* testing hack */
+#ifdef TEST_GOK_FREQUENCY_BASED_KEY_PLACEMENT
+#define ALPHA_KEYBOARD "Keyboard"
+#else
 #define ALPHA_KEYBOARD "Alpha"
+#endif /* TEST_GOK_FREQUENCY_BASED_KEY_PLACEMENT */
+
 #define FREQ_KEYBOARD "Alpha-Frequency"
 
 #define GOK_KEYBOARD_DOCK_BORDERPIX 5
@@ -2623,6 +2629,7 @@
 	gint column;
 	gint countKeys;
 	gint widthFactor;
+	gint diag;
 	
 	if (!force) {
 		if ((pKeyboard->bRequiresLayout == FALSE) || 
@@ -2722,6 +2729,39 @@
 			break;
 			
 		case KEYBOARD_SHAPE_KEYSQUARE:
+#ifdef TEST_GOK_FREQUENCY_BASED_KEY_PLACEMENT
+			/* assume this is the frequency case for testing FIXME */
+			maxKeysPerRow = (gint)sqrt (totalKeys);
+			pKey = pKeyboard->pKeyFirst;
+			/* fill top left triangle of keyboard */
+			for (diag=0; diag <= maxKeysPerRow; diag++) {
+				for (row=0; row <= diag; row++) {
+					if (pKey != NULL) {
+						column = diag - row;
+						pKey->Top = row;
+						pKey->Bottom = row + 1;
+						pKey->Left = column;
+						pKey->Right = column + 1;
+						pKey = pKey->pKeyNext;
+					}
+				}
+			}
+			/* fill bottom right triangle of keyboard */
+			for (diag=1; diag < maxKeysPerRow; diag++) {
+				for (row = diag; row < maxKeysPerRow; row++) {
+					if (pKey != NULL) {
+						column = maxKeysPerRow - row + diag;
+						pKey->Top = row;
+						pKey->Bottom = row + 1;
+						pKey->Left = column;
+						pKey->Right = column + 1;
+						pKey = pKey->pKeyNext;
+					}
+				}
+			}
+			/* FIXME - now bang out required cells */
+			break;
+#endif /* TEST_GOK_FREQUENCY_BASED_KEY_PLACEMENT */
 		default:
 			maxKeysPerRow = (gint)sqrt (totalKeys);
 			if (totalKeys - (maxKeysPerRow * maxKeysPerRow) > 0) {
