This commit was generated by cvs2svn to compensate for changes in r158,
[gnokii.git] / xgnokii / xgnokii_xkeyb.c
index 3ecf9f6..42fc7f8 100644 (file)
@@ -3,14 +3,20 @@
   X G N O K I I
 
   A Linux/Unix GUI for Nokia mobile phones.
+  Copyright (C) 1999 Pavel Janík ml., Hugh Blemings
+  & Ján Derfiòák <ja@mail.upjs.sk>.
 
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
+  Last modification: Sun May 14 2000
+  Modified by Jan Derfinak
+
 */
 
 #include <string.h>
 #include <gtk/gtk.h>
 #include "misc.h"
+#include "fbus-6110.h"
 #include "xgnokii_common.h"
 #include "xgnokii.h"
 #include "xgnokii_lowlevel.h"
@@ -30,79 +36,79 @@ static ErrorDialog errorDialog = {NULL, NULL};
 static ButtonT *button = NULL;
 
 static ButtonT button_6110[30] = {
-  { 103,  91, 114, 107, PHONEKEY_POWER          }, /* Power */
-  {  28, 240,  54, 263, PHONEKEY_MENU           }, /* Menu */
-  {  84, 240, 110, 263, PHONEKEY_NAMES          }, /* Names */
-  {  58, 245,  82, 258, PHONEKEY_UP             }, /* Up */
-  {  55, 263,  85, 276, PHONEKEY_DOWN           }, /* Down */
-  {  22, 271,  50, 289, PHONEKEY_GREEN          }, /* Green */
-  {  91, 271, 115, 289, PHONEKEY_RED            }, /* Red */
-  {  18, 294,  44, 310, PHONEKEY_1              }, /* 1 */
-  {  56, 294,  85, 310, PHONEKEY_2              }, /* 2 */
-  {  98, 294, 121, 310, PHONEKEY_3              }, /* 3 */
-  {  18, 317,  44, 333, PHONEKEY_4              }, /* 4 */
-  {  56, 317,  85, 333, PHONEKEY_5              }, /* 5 */
-  {  98, 317, 121, 333, PHONEKEY_6              }, /* 6 */
-  {  18, 342,  44, 356, PHONEKEY_7              }, /* 7 */
-  {  56, 342,  85, 356, PHONEKEY_8              }, /* 8 */
-  {  98, 342, 121, 356, PHONEKEY_9              }, /* 9 */
-  {  18, 365,  44, 380, PHONEKEY_ASTERISK       }, /* * */
-  {  56, 365,  85, 380, PHONEKEY_0              }, /* 0 */
-  {  98, 365, 121, 380, PHONEKEY_HASH           }, /* # */
-  {   1, 138,  10, 150, PHONEKEY_INCREASEVOLUME }, /* Volume + */
-  {   1, 165,  10, 176, PHONEKEY_DECREASEVOLUME }, /* Volume - */
+  { 103,  91, 114, 107, 0x0d }, /* Power */
+  {  28, 240,  54, 263, 0x19 }, /* Menu */
+  {  84, 240, 110, 263, 0x1a }, /* Names */
+  {  58, 245,  82, 258, 0x17 }, /* Up */
+  {  55, 263,  85, 276, 0x18 }, /* Down */
+  {  22, 271,  50, 289, 0x0e }, /* Green */
+  {  91, 271, 115, 289, 0x0f }, /* Red */
+  {  18, 294,  44, 310, 0x01 }, /* 1 */
+  {  56, 294,  85, 310, 0x02 }, /* 2 */
+  {  98, 294, 121, 310, 0x03 }, /* 3 */
+  {  18, 317,  44, 333, 0x04 }, /* 4 */
+  {  56, 317,  85, 333, 0x05 }, /* 5 */
+  {  98, 317, 121, 333, 0x06 }, /* 6 */
+  {  18, 342,  44, 356, 0x07 }, /* 7 */
+  {  56, 342,  85, 356, 0x08 }, /* 8 */
+  {  98, 342, 121, 356, 0x09 }, /* 9 */
+  {  18, 365,  44, 380, 0x0c }, /* * */
+  {  56, 365,  85, 380, 0x0a }, /* 0 */
+  {  98, 365, 121, 380, 0x0b }, /* # */
+  {   1, 138,  10, 150, 0x10 } , /* Volume + */
+  {   1, 165,  10, 176, 0x11 } , /* Volume - */
   {   0,   0,   0,   0, 0x00 }
 };
 
 static ButtonT button_6150[30] = {
-  {  99,  78, 114,  93, PHONEKEY_POWER          }, /* Power */
-  {  20, 223,  49, 245, PHONEKEY_MENU           }, /* Menu */
-  {  90, 223, 120, 245, PHONEKEY_NAMES          }, /* Names */
-  {  59, 230,  83, 247, PHONEKEY_UP             }, /* Up */
-  {  56, 249,  84, 265, PHONEKEY_DOWN           }, /* Down */
-  {  14, 254,  51, 273, PHONEKEY_GREEN          }, /* Green */
-  {  90, 255, 126, 273, PHONEKEY_RED            }, /* Red */
-  {  18, 281,  53, 299, PHONEKEY_1              }, /* 1 */
-  {  55, 280,  86, 299, PHONEKEY_2              }, /* 2 */
-  {  90, 281, 122, 299, PHONEKEY_3              }, /* 3 */
-  {  18, 303,  53, 323, PHONEKEY_4              }, /* 4 */
-  {  55, 303,  87, 323, PHONEKEY_5              }, /* 5 */
-  {  90, 303, 122, 323, PHONEKEY_6              }, /* 6 */
-  {  18, 327,  53, 346, PHONEKEY_7              }, /* 7 */
-  {  53, 327,  87, 346, PHONEKEY_8              }, /* 8 */
-  {  90, 327, 122, 346, PHONEKEY_9              }, /* 9 */
-  {  18, 349,  53, 370, PHONEKEY_ASTERISK       }, /* * */
-  {  56, 349,  87, 370, PHONEKEY_0              }, /* 0 */
-  {  98, 349, 122, 370, PHONEKEY_HASH           }, /* # */
-  {   2, 131,  10, 147, PHONEKEY_INCREASEVOLUME }, /* Volume + */
-  {   2, 155,  10, 173, PHONEKEY_DECREASEVOLUME }, /* Volume - */
+  {  99,  78, 114,  93, 0x0d }, /* Power */
+  {  20, 223,  49, 245, 0x19 }, /* Menu */
+  {  90, 223, 120, 245, 0x1a }, /* Names */
+  {  59, 230,  83, 247, 0x17 }, /* Up */
+  {  56, 249,  84, 265, 0x18 }, /* Down */
+  {  14, 254,  51, 273, 0x0e }, /* Green */
+  {  90, 255, 126, 273, 0x0f }, /* Red */
+  {  18, 281,  53, 299, 0x01 }, /* 1 */
+  {  55, 280,  86, 299, 0x02 }, /* 2 */
+  {  90, 281, 122, 299, 0x03 }, /* 3 */
+  {  18, 303,  53, 323, 0x04 }, /* 4 */
+  {  55, 303,  87, 323, 0x05 }, /* 5 */
+  {  90, 303, 122, 323, 0x06 }, /* 6 */
+  {  18, 327,  53, 346, 0x07 }, /* 7 */
+  {  53, 327,  87, 346, 0x08 }, /* 8 */
+  {  90, 327, 122, 346, 0x09 }, /* 9 */
+  {  18, 349,  53, 370, 0x0c }, /* * */
+  {  56, 349,  87, 370, 0x0a }, /* 0 */
+  {  98, 349, 122, 370, 0x0b }, /* # */
+  {   2, 131,  10, 147, 0x10 }, /* Volume + */
+  {   2, 155,  10, 173, 0x11 }, /* Volume - */
   {   0,   0,   0,   0, 0x00 }
 };
 
 static ButtonT button_5110[30] = {
-  { 100,  85, 114,  99, PHONEKEY_POWER    }, /* Power */
-  {  50, 240,  85, 265, PHONEKEY_MENU     }, /* Menu */
-  {  20, 240,  45, 260, PHONEKEY_NAMES    }, /* Names */
-  { 100, 240, 117, 258, PHONEKEY_UP       }, /* Up */
-  {  93, 267, 112, 287, PHONEKEY_DOWN     }, /* Down */
-  {  14, 294,  44, 312, PHONEKEY_1        }, /* 1 */
-  {  54, 294,  83, 312, PHONEKEY_2        }, /* 2 */
-  {  94, 294, 122, 312, PHONEKEY_3        }, /* 3 */
-  {  14, 320,  44, 338, PHONEKEY_4        }, /* 4 */
-  {  54, 320,  83, 338, PHONEKEY_5        }, /* 5 */
-  {  94, 320, 122, 338, PHONEKEY_6        }, /* 6 */
-  {  14, 345,  44, 363, PHONEKEY_7        }, /* 7 */
-  {  54, 345,  83, 363, PHONEKEY_8        }, /* 8 */
-  {  94, 345, 122, 363, PHONEKEY_9        }, /* 9 */
-  {  18, 374,  49, 389, PHONEKEY_ASTERISK }, /* * */
-  {  53, 371,  82, 387, PHONEKEY_0        }, /* 0 */
-  {  96, 374, 119, 389, PHONEKEY_HASH     }, /* # */
+  { 100,  85, 114,  99, 0x0d }, /* Power */
+  {  50, 240,  85, 265, 0x19 }, /* Menu */
+  {  20, 240,  45, 260, 0x1a }, /* Names */
+  { 100, 240, 117, 258, 0x17 }, /* Up */
+  {  93, 267, 112, 287, 0x18 }, /* Down */
+  {  14, 294,  44, 312, 0x01 }, /* 1 */
+  {  54, 294,  83, 312, 0x02 }, /* 2 */
+  {  94, 294, 122, 312, 0x03 }, /* 3 */
+  {  14, 320,  44, 338, 0x04 }, /* 4 */
+  {  54, 320,  83, 338, 0x05 }, /* 5 */
+  {  94, 320, 122, 338, 0x06 }, /* 6 */
+  {  14, 345,  44, 363, 0x07 }, /* 7 */
+  {  54, 345,  83, 363, 0x08 }, /* 8 */
+  {  94, 345, 122, 363, 0x09 }, /* 9 */
+  {  18, 374,  49, 389, 0x0c }, /* * */
+  {  53, 371,  82, 387, 0x0a }, /* 0 */
+  {  96, 374, 119, 389, 0x0b }, /* # */
   {   0,   0,   0,   0, 0x00 }
 };
 
 static inline void Help1 (GtkWidget *w, gpointer data)
 {
-  gchar *indx = g_strdup_printf ("/%s/gnokii/xgnokii/xkeyb/index.htm", xgnokiiConfig.locale);
+  gchar *indx = g_strdup_printf ("/help/%s/windows/xkeyb/index.html", xgnokiiConfig.locale);
   Help (w, indx);
   g_free (indx);
 }
@@ -184,7 +190,7 @@ void GUI_ShowXkeyb (void)
 
 static gint ButtonEvent (GtkWidget *widget, GdkEventButton *event)
 {
-  unsigned char req[] = {0x00,0x00};
+  unsigned char req[] = {FB61_FRAME_HEADER, 0x42, 0x01, 0x00, 0x01};
   register gint i = 0;
 
   if (button == NULL)
@@ -194,9 +200,9 @@ static gint ButtonEvent (GtkWidget *widget, GdkEventButton *event)
     return TRUE;
 
   if (event->type == GDK_BUTTON_PRESS) 
-    req[0] = PRESSPHONEKEY;
+    req[4] = 0x01;
   else if (event->type == GDK_BUTTON_RELEASE)
-    req[0] = RELEASEPHONEKEY;
+    req[4] = 0x02;
   else
     return TRUE;
 
@@ -210,7 +216,7 @@ static gint ButtonEvent (GtkWidget *widget, GdkEventButton *event)
     {
       PhoneEvent *e = g_malloc (sizeof (PhoneEvent));
       
-      req[1]=button[i].code;
+      req[5]=button[i].code;
       e->event = Event_SendKeyStroke;
       e->data = g_memdup (req, sizeof (req));
       GUI_InsertEvent (e);
@@ -251,6 +257,7 @@ void GUI_CreateXkeybWindow (void)
 
   InitMainMenu ();
   GUI_XkeybWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_wmclass (GTK_WINDOW (GUI_XkeybWindow), "XkeybWindow", "Xgnokii");
   gtk_window_set_title (GTK_WINDOW (GUI_XkeybWindow), _("XGnokii Keyboard"));
   //gtk_widget_set_usize (GTK_WIDGET (GUI_XkeybWindow), 436, 220);
   gtk_signal_connect (GTK_OBJECT (GUI_XkeybWindow), "delete_event",