r542 - in trunk/src/target/OM-2007/applications/openmoko-keyboard: layouts src

caowai_song at gta01.hmw-consulting.de caowai_song at gta01.hmw-consulting.de
Fri Jan 12 10:05:12 CET 2007


Author: caowai_song
Date: 2007-01-12 10:04:53 +0100 (Fri, 12 Jan 2007)
New Revision: 542

Added:
   trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/spacekey.png
Modified:
   trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/Makefile.am
   trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml
   trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/testkey.png
   trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui-xft-backend.c
   trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui.c
   trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.c
Log:
Using pictures as the background of the keys.
The minimum size of key relate with the size of backgroud picture.
Using the popup window.


Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/Makefile.am	2007-01-12 02:17:31 UTC (rev 541)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/Makefile.am	2007-01-12 09:04:53 UTC (rev 542)
@@ -1,6 +1,6 @@
 keyboardsdir = $(datadir)/matchbox-keyboard
 keyboards_DATA = keyboard.xml keyboard-extended.xml keyboard-dvorak.xml \
 		 keyboard-us.xml keyboard-ru.xml keyboard-fi.xml        \
-                 keyboard-numpad.xml testkey.png
+                 keyboard-numpad.xml testkey.png spacekey.png
 
 EXTRA_DIST = $(keyboards_DATA)

Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml	2007-01-12 02:17:31 UTC (rev 541)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml	2007-01-12 09:04:53 UTC (rev 542)
@@ -109,18 +109,6 @@
 	  <default display="Bksp" action="backspace"/>
     </key>
 
-    <space width="500" extended="true"/>
-
-    <key width="4000"  extended="true">
-	  <default display="Home" action="home"/>
-    </key>
-    <key width="4000"  extended="true">
-	  <default display="PgUp" action="pageup"/>
-    </key>
-
-    <space width="500" extended="true"/>
-
-
   </row>
 
   <row>
@@ -197,17 +185,6 @@
 	  <background image="testkey.png"/>
     </key>
 
-    <space width="500" extended="true"/>
-
-    <key width="4000"  extended="true">
-	  <default display="End" action="end"/>
-    </key>
-    <key width="4000"  extended="true">
-	  <default display="PgDn" action="pagedown"/>
-    </key>
-
-    <space width="500" extended="true"/>
-
   </row>
   <row>
 
@@ -275,15 +252,6 @@
 	  <default display="Ret" action="return"/>
     </key>
 
-    <space width="500" extended="true"/>
-
-    <space width="4000"  extended="true" />
-
-    <space width="4000"  extended="true" />
-
-    <space width="500" extended="true"/>
-
-
   </row>
   <row>
 
@@ -356,16 +324,6 @@
 	  <default display="Shift" action="modifier:shift"/>                
     </key>
 
-    <space width="500" extended="true"/>
-
-    <space width="4000"  extended="true" />
-
-    <space width="4000"  extended="true" />
-
-    <space width="500" extended="true"/>
-
-
-
  </row>
   <row>
 
@@ -384,8 +342,9 @@
     </key>
 
 
-    <key width="12000">
+    <key>
 	  <default display=" " action="space" />                
+	  <background image="spacekey.png"/>
     </key>
 
     <key>
@@ -406,14 +365,6 @@
 	  <default display="&gt;" action="right" />                
     </key>
 
-    <space width="500" extended="true"/>
-
-    <space width="4000"  extended="true" />
-
-    <space width="4000"  extended="true" />
-
-    <space width="500" extended="true"/>
-
 </row>
 
 </layout>

Added: trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/spacekey.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/spacekey.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/testkey.png
===================================================================
(Binary files differ)

Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui-xft-backend.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui-xft-backend.c	2007-01-12 02:17:31 UTC (rev 541)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui-xft-backend.c	2007-01-12 09:04:53 UTC (rev 542)
@@ -136,6 +136,8 @@
   rect.y      = mb_kbd_key_abs_y(key); 
   rect.width  = mb_kbd_key_width(key);       
   rect.height = mb_kbd_key_height(key);       
+  //fprintf(stderr, "key->alloc_x=%d\n", mb_kbd_key_x(key));
+  //fprintf(stderr, "rect.x=%d,rect.y=%d,rect.width=%d,rect.height=%d\n",rect.x,rect.y,rect.width,rect.height);
 
   /* Hacky clip to work around issues with off by ones in layout code :( */
 

Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui.c	2007-01-12 02:17:31 UTC (rev 541)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui.c	2007-01-12 09:04:53 UTC (rev 542)
@@ -134,6 +134,7 @@
   if (y) *y           = geometry[1];
   if (width)  *width  = geometry[2];
   if (height) *height = geometry[3];
+  fprintf(stderr, "x=%d,y=%d,w=%d,h=%d\n",geometry[0],geometry[1],geometry[2],geometry[3]);
   
   XFree(geometry);
 
@@ -340,6 +341,19 @@
 	    max_h = mb_kbd_image_height (img);
 	}
     }
+  if (mb_kbd_key_get_back_image(key))
+    {
+      MBKeyboardImage *img = mb_kbd_key_get_back_image(key);
+
+      if (mb_kbd_image_width (img) > max_w)
+        max_w = mb_kbd_image_width (img);
+
+      if (mb_kbd_image_height (img) > max_h)
+        max_h = mb_kbd_image_height (img);
+    }
+
+  *width = max_w;
+  *height = max_h;
 }
 
 void
@@ -352,6 +366,8 @@
   int               key_y = 0, key_x = 0; 
   int               row_y, max_row_key_height, max_row_width;
 
+  max_row_key_height = 0;
+
   layout = mb_kbd_get_selected_layout(ui->kbd);
 
   /* Do an initial run to figure out a 'base' size for single glyph keys */
@@ -421,7 +437,9 @@
       row_y += max_row_key_height + mb_kbd_row_spacing(ui->kbd);
 
       row_item = util_list_next(row_item);
+      fprintf(stderr, "the key_x=%d,key_y=%d\n", key_x, key_y);
     }
+  fprintf(stderr, "max_row_key_height=%d,max_row_width=%d\n", max_row_key_height, max_row_width);
 
   *height = row_y; 
 
@@ -450,6 +468,7 @@
 	goto next_row;
 
       free_space = max_row_width - mb_kbd_row_width(row);
+      fprintf(stderr, "free_space=%d, max_row_width=%d, mb_kbd_row_width(row)=%d\n", free_space, max_row_width, mb_kbd_row_width(row));
 
       mb_kbd_row_for_each_key(row, key_item)
 	{
@@ -648,7 +667,8 @@
 	have_matchbox_wm = True;
     }
 
-  win_attr.override_redirect = False; /* Set to true for extreme case */
+  win_attr.override_redirect = True; /* Set to true for extreme case */
+  /*win_attr.override_redirect = False;*/ /* Set to true for extreme case */
   win_attr.event_mask 
     = ButtonPressMask|ButtonReleaseMask|Button1MotionMask|StructureNotifyMask;
 
@@ -660,6 +680,7 @@
 			   CopyFromParent, CopyFromParent, CopyFromParent,
 			   CWOverrideRedirect|CWEventMask,
 			   &win_attr);
+  fprintf(stderr, "ui->xwin_width=%d,ui->xwin_height=%d\n", ui->xwin_width, ui->xwin_height);
 
 
   wm_hints = XAllocWMHints();
@@ -733,12 +754,12 @@
 	       * to avoid the case of mapping and then the wm resizing
 	       * us, causing an ugly repaint. 
 	       */
-	      if (desk_width > ui->xwin_width)
+	      /*if (desk_width > ui->xwin_width)
 		{
 		  mb_kbd_ui_resize(ui, 
 				   desk_width, 
 				   ( desk_width * ui->xwin_height ) / ui->xwin_width);
-		}
+		}*/
 	      
 	      wm_struct_vals[2]  = desk_y + desk_height - ui->xwin_height;
 	      wm_struct_vals[11] = desk_width;
@@ -1017,6 +1038,7 @@
   old_state = mb_kbd_is_extended(ui->kbd);
   new_state = want_extended(ui);
    
+  fprintf(stderr, "########################################################\n");
   if (new_state == old_state) 	/* Not a rotation */
     {
       mb_kbd_ui_resize(ui, width, height); 
@@ -1227,6 +1249,7 @@
   */
   mb_kbd_ui_allocate_ui_layout(ui, 
 			       &ui->base_alloc_width, &ui->base_alloc_height);
+  fprintf(stderr, "ui->base_alloc_width=%d, ui->base_alloc_height=%d\n",ui->base_alloc_width, ui->base_alloc_height);
 
   ui->xwin_width  = ui->base_alloc_width;
   ui->xwin_height = ui->base_alloc_height;

Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.c	2007-01-12 02:17:31 UTC (rev 541)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.c	2007-01-12 09:04:53 UTC (rev 542)
@@ -36,6 +36,7 @@
   MBKeyboard *kb = NULL;
   char       *variant = NULL; 
   Bool        want_embedding = False;
+  Bool        want_small = False;
   int         i;
 
   kb = util_malloc0(sizeof(MBKeyboard));
@@ -59,6 +60,12 @@
 	  continue;
 	}
 
+      if (streq ("-small", argv[i]) || streq ("--small", argv[i])) 
+	{
+	  want_small = True;
+	  continue;
+	}
+
       if (i == (argc-1) && argv[i][0] != '-')
 	variant = argv[i];
       else
@@ -80,6 +87,15 @@
       kb->font_pt_size = 8;
     }
 
+  if (want_small)
+    {
+      kb->key_border   = 1;
+      kb->key_pad      = 0;
+      kb->col_spacing  = 0;
+      kb->row_spacing  = 0;
+      kb->font_pt_size = 10;
+    }
+
   if (!mb_kbd_config_load(kb, variant))
     return NULL;
 





More information about the commitlog mailing list