Send commitlog mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r1156 - in trunk/src/target/gsm: include/libgsmd src/libgsmd
src/util ([EMAIL PROTECTED])
2. r1157 - in
trunk/src/target/OM-2007/applications/openmoko-mainmenu: . src
([EMAIL PROTECTED])
3. r1158 - in
trunk/src/target/OM-2007/applications/openmoko-keyboard: layouts
src ([EMAIL PROTECTED])
--- Begin Message ---
Author: tony_guan
Date: 2007-02-28 08:04:28 +0100 (Wed, 28 Feb 2007)
New Revision: 1156
Modified:
trunk/src/target/gsm/include/libgsmd/misc.h
trunk/src/target/gsm/src/libgsmd/Makefile.am
trunk/src/target/gsm/src/util/libgsmd-tool.c
trunk/src/target/gsm/src/util/shell.c
Log:
resolved bug 108, please varify it. thks.
Modified: trunk/src/target/gsm/include/libgsmd/misc.h
===================================================================
--- trunk/src/target/gsm/include/libgsmd/misc.h 2007-02-28 02:53:26 UTC (rev
1155)
+++ trunk/src/target/gsm/include/libgsmd/misc.h 2007-02-28 07:04:28 UTC (rev
1156)
@@ -1,5 +1,5 @@
-#ifndef _LIBGSMD_H
-#define _LIBGSMD_H
+#ifndef _MISC_LIBGSMD_H
+#define _MISC_LIBGSMD_H
/* libgsmd.h - Library API for gsmd, the GSM Daemon
* (C) 2006 by Harald Welte <[EMAIL PROTECTED]>
@@ -25,19 +25,19 @@
extern int lgsm_netreg_register(struct lgsm_handle *lh, int oper);
-enum lgsm_info_type {
+typedef enum _lgsm_info_type {
LGSM_INFO_TYPE_NONE = 0,
LGSM_INFO_TYPE_MANUF = 1,
LGSM_INFO_TYPE_MODEL = 2,
LGSM_INFO_TYPE_REVISION = 3,
LGSM_INFO_TYPE_SERIAL = 4,
LGSM_INFO_TYPE_IMSI = 5,
-};
+}lgsm_info_type;
/* Get some information about the handset */
extern int lgsm_get_info(struct lgsm_handle *lh,
- enum lgsm_info_type type,
- char *ret_string, u_int16_t len);
+ lgsm_info_type type,
+ char *ret_string, unsigned int* len);
/* Authenticate to SIM Card using specified null-terminated pin */
extern int lgsm_pin_auth(struct lgsm_handle *lh, const char *pin);
Modified: trunk/src/target/gsm/src/libgsmd/Makefile.am
===================================================================
--- trunk/src/target/gsm/src/libgsmd/Makefile.am 2007-02-28 02:53:26 UTC
(rev 1155)
+++ trunk/src/target/gsm/src/libgsmd/Makefile.am 2007-02-28 07:04:28 UTC
(rev 1156)
@@ -5,6 +5,6 @@
lib_LTLIBRARIES = libgsmd.la
libgsmd_la_LDFLAGS = -Wc,-nostartfiles -version-info $(LIBVERSION)
-libgsmd_la_SOURCES = libgsmd.c libgsmd_input.c libgsmd_voicecall.c
libgsmd_passthrough.c libgsmd_event.c libgsmd_phone.c libgsmd_network.c
+libgsmd_la_SOURCES = libgsmd.c libgsmd_input.c libgsmd_voicecall.c
libgsmd_passthrough.c libgsmd_event.c libgsmd_phone.c libgsmd_network.c
libgsmd_device.c
noinst_HEADERS = lgsm_internals.h
Modified: trunk/src/target/gsm/src/util/libgsmd-tool.c
===================================================================
--- trunk/src/target/gsm/src/util/libgsmd-tool.c 2007-02-28 02:53:26 UTC
(rev 1155)
+++ trunk/src/target/gsm/src/util/libgsmd-tool.c 2007-02-28 07:04:28 UTC
(rev 1156)
@@ -95,11 +95,14 @@
printf("libgsm-tool - (C) 2006 by Harald Welte\n"
"This program is Free Software and has ABSOLUTELY NO
WARRANTY\n\n");
+
while (1) {
int c, option_index = 0;
c = getopt_long(argc, argv, "vVhm:p:", opts, &option_index);
if (c == -1)
+ {
break;
+ }
switch (c) {
case 'v':
Modified: trunk/src/target/gsm/src/util/shell.c
===================================================================
--- trunk/src/target/gsm/src/util/shell.c 2007-02-28 02:53:26 UTC (rev
1155)
+++ trunk/src/target/gsm/src/util/shell.c 2007-02-28 07:04:28 UTC (rev
1156)
@@ -48,6 +48,7 @@
"\to\tPower Off\n"
"\tR\tRegister Netowrk\n"
"\tT\tSend DTMF Tone\n"
+ "\tI\tDevice Infor\n"
"\tq\tQuit\n"
);
}
@@ -58,6 +59,7 @@
char buf[STDIN_BUF_SIZE+1];
char rbuf[STDIN_BUF_SIZE+1];
int rlen = sizeof(rbuf);
+
fd_set readset;
lgsm_register_handler(lgsmh, GSMD_MSG_PASSTHROUGH, &pt_msghandler);
@@ -136,9 +138,68 @@
continue;
printf("DTMF: %c\n", buf[1]);
lgsm_voice_dtmf(lgsmh, buf[1]);
- } else {
+ } else if (buf[0] == 'I') {
+ //FIXME: sometimes, lgsm_get_info returns directly, and
sometimes the result just gets lost.
+ static int
infoindex=LGSM_INFO_TYPE_NONE;//information
+ infoindex=infoindex%LGSM_INFO_TYPE_IMSI+1;
+ rlen = sizeof(rbuf);
+ switch(infoindex){
+ case LGSM_INFO_TYPE_MANUF:
+
+
if(lgsm_get_info(lgsmh,LGSM_INFO_TYPE_MANUF,rbuf,&rlen))
+ {
+ printf("manufacturer:%s\n",rbuf);
+ }
+ else
+ printf("manufacturer information
error!\n");
+ break;
+
+ case LGSM_INFO_TYPE_MODEL:
+
if(lgsm_get_info(lgsmh,LGSM_INFO_TYPE_MODEL,rbuf,&rlen))
+ {
+ printf("model:%s\n",rbuf);
+ }
+ else
+ printf("model error!\n");
+ break;
+
+ case LGSM_INFO_TYPE_REVISION:
+
if(lgsm_get_info(lgsmh,LGSM_INFO_TYPE_REVISION,rbuf,&rlen))
+ {
+ printf("revision:%s\n",rbuf);
+ }
+ else
+ printf("revision information error!\n");
+ break;
+
+ case LGSM_INFO_TYPE_IMSI:
+
if(lgsm_get_info(lgsmh,LGSM_INFO_TYPE_IMSI,rbuf,&rlen))
+ {
+ printf("imei:%s\n",rbuf);
+ }
+ else
+ printf("imei information error!\n");
+ break;
+ case LGSM_INFO_TYPE_SERIAL:
+
if(lgsm_get_info(lgsmh,LGSM_INFO_TYPE_SERIAL,rbuf,&rlen))
+ {
+ printf("sn:%s\n",rbuf);
+ }
+ else
+ printf("sn information error!\n");
+ break;
+ default:
+ printf("something is wrong!\n");
+ }
+
+
+
+ }
+ else {
printf("Unknown command `%s'\n", buf);
}
}
}
}
+
+
--- End Message ---
--- Begin Message ---
Author: zhiyong_sun
Date: 2007-02-28 08:26:23 +0100 (Wed, 28 Feb 2007)
New Revision: 1157
Added:
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/dbus-conn.c
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/dbus-conn.h
Modified:
trunk/src/target/OM-2007/applications/openmoko-mainmenu/configure.ac
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/Makefile.am
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/callbacks.c
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/callbacks.h
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/main.c
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/main.h
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c
Log:
add dbus message send function: when one item was selected, its name will be
sent to footer
Modified: trunk/src/target/OM-2007/applications/openmoko-mainmenu/configure.ac
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/configure.ac
2007-02-28 07:04:28 UTC (rev 1156)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/configure.ac
2007-02-28 07:26:23 UTC (rev 1157)
@@ -13,12 +13,15 @@
# base deps
PKG_CHECK_MODULES(OPENMOKO, openmoko-libs >= 0.0.1,,
AC_MSG_ERROR([*** Required OpenMoko Libraries >= 0.0.1 not
installed ***]))
-
PKG_CHECK_MODULES(LIBMB, libmb >= 1.8,,
AC_MSG_ERROR([*** You need to install libmatchbox >= 1.8***]))
+PKG_CHECK_MODULES(DBUSGLIB, dbus-glib-1,,
+ AC_MSG_ERROR([*** Required dbus-glib-1 not installed ***]))
+PKG_CHECK_MODULES(DBUS, dbus-1,,
+ AC_MSG_ERROR([*** Required dbus-1 not installed ***]))
-LIBS="$LIBS $OPENMOKO_LIBS $LIBMB_LIBS"
-CFLAGS="$CFLAGS $OPENMOKO_CFLAGS $LIBMB_CFLAGS"
+LIBS="$LIBS $OPENMOKO_LIBS $LIBMB_LIBS $DBUSGLIB_LIBS $DBUS_LIBS"
+CFLAGS="$CFLAGS $OPENMOKO_CFLAGS $LIBMB_CFLAGS $DBUSGLIB_CFLAGS $DBUS_CFALGS"
# output stuff
AC_OUTPUT([
Modified:
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/Makefile.am
2007-02-28 07:04:28 UTC (rev 1156)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/Makefile.am
2007-02-28 07:26:23 UTC (rev 1157)
@@ -7,7 +7,7 @@
openmoko_mainmenu_SOURCES = main.c \
mainmenu.c mokoiconview.c\
mokodesktop.c mokodesktop_item.c\
- callbacks.c app-history.c
+ callbacks.c app-history.c dbus-conn.c
openmoko_mainmenu_LDADD = @OPENMOKO_LIBS@ @LIBMB_LIBS@
Modified:
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/callbacks.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/callbacks.c
2007-02-28 07:04:28 UTC (rev 1156)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/callbacks.c
2007-02-28 07:26:23 UTC (rev 1157)
@@ -35,100 +35,111 @@
void
moko_wheel_bottom_press_cb (GtkWidget *self, MokoMainmenuApp *mma)
{
- if (mma->mm->current->type != ITEM_TYPE_ROOT)
- {
- mma->mm->current = mokodesktop_item_get_parent(mma->mm->current);
- moko_main_menu_update_content (mma->mm, mma->mm->current);
- gtk_window_present (mma->window);
- }
- else
- {
- gtk_widget_hide (GTK_WIDGET (mma->wheel));
- gtk_widget_hide (GTK_WIDGET (mma->toolbox));
- gtk_widget_hide (GTK_WIDGET (mma->window));
- }
+ if (mma->mm->current->type != ITEM_TYPE_ROOT)
+ {
+ mma->mm->current = mokodesktop_item_get_parent(mma->mm->current);
+ moko_main_menu_update_content (mma->mm, mma->mm->current);
+ gtk_window_present (mma->window);
+ }
+ else
+ {
+ gtk_widget_hide (GTK_WIDGET (mma->wheel));
+ gtk_widget_hide (GTK_WIDGET (mma->toolbox));
+ gtk_widget_hide (GTK_WIDGET (mma->window));
+ }
}
void
moko_wheel_left_up_press_cb (GtkWidget *self, MokoMainmenuApp *mma)
{
- g_signal_emit_by_name (G_OBJECT(mma->mm->icon_view), "move-cursor",
GTK_MOVEMENT_DISPLAY_LINES, -1);
+ g_signal_emit_by_name (G_OBJECT(mma->mm->icon_view), "move-cursor",
GTK_MOVEMENT_DISPLAY_LINES, -1);
//gtk_window_present (mma->window);
//gtk_widget_grab_focus (mma->mm->icon_view);
-
}
void
moko_wheel_right_down_press_cb (GtkWidget *self, MokoMainmenuApp *mma)
{
//gtk_widget_grab_focus (mma->mm->icon_view);
- g_signal_emit_by_name (G_OBJECT(mma->mm->icon_view), "move-cursor",
GTK_MOVEMENT_DISPLAY_LINES, 1);
+ g_signal_emit_by_name (G_OBJECT(mma->mm->icon_view), "move-cursor",
GTK_MOVEMENT_DISPLAY_LINES, 1);
}
-void
-moko_up_btn_cb (GtkButton *button, MokoMainMenu *mm)
-{
- gtk_widget_grab_focus (mm->icon_view);
- g_signal_emit_by_name (G_OBJECT(mm->icon_view), "move-cursor",
GTK_MOVEMENT_DISPLAY_LINES, -1);
-}
-
-void
-moko_down_btn_cb (GtkButton *button, MokoMainMenu *mm)
-{
- gtk_widget_grab_focus (mm->icon_view);
- g_signal_emit_by_name (G_OBJECT(mm->icon_view), "move-cursor",
GTK_MOVEMENT_DISPLAY_LINES, 1);
-}
-
void
-moko_icon_view_item_acitvated_cb(GtkIconView *icon_view,
- GtkTreePath *path,
MokoMainmenuApp *mma)
+moko_icon_view_item_acitvated_cb(MokoIconView *icon_view,
+ GtkTreePath *path, MokoMainmenuApp *mma)
{
- g_debug ("call moko_item_acitvated_cb");
- MokoDesktopItem *select_item = mokodesktop_item_get_child (mma->mm->current);
- gint index, i;
+ g_debug ("call moko_item_acitvated_cb");
+ MokoDesktopItem *select_item = mokodesktop_item_get_child
(mma->mm->current);
+ gint index, i;
- index = moko_icon_view_get_cursor_positon (icon_view);
+ index = moko_icon_view_get_cursor_positon (icon_view);
- for (i = 1; i < index; i++)
- {
- select_item = mokodesktop_item_get_next_sibling (select_item);
- }
+ for (i = 1; i < index; i++)
+ {
+ select_item = mokodesktop_item_get_next_sibling (select_item);
+ }
- g_debug ("select_item name %s TYPE is %d", select_item->name,
select_item->type);
+ g_debug ("select_item name %s TYPE is %d", select_item->name,
select_item->type);
- if (select_item->type == ITEM_TYPE_FOLDER)
- {
- mma->mm->current = select_item;
- g_debug ("current name %s------------------", mma->mm->current->name);
- moko_main_menu_update_content (mma->mm, select_item);
- }
- else if (select_item->type == ITEM_TYPE_DOTDESKTOP_ITEM ||select_item->type
== ITEM_TYPE_APP)
- {
- switch (fork())
+ if (select_item->type == ITEM_TYPE_FOLDER)
{
- case 0:
- mb_exec((char *)select_item->data);
- fprintf(stderr, "exec failed, cleaning up child\n");
- exit(1);
- case -1:
- fprintf(stderr, "can't fork\n");
- break;
+ mma->mm->current = select_item;
+ g_debug ("current name %s------------------", mma->mm->current->name);
+ moko_main_menu_update_content (mma->mm, select_item);
}
- char path[512];
- snprintf (path, 512, "%s/%s", PIXMAP_PATH, select_item->icon_name);
- g_debug ("-------select_item path: %s", path);
- moko_hisory_app_fill(mma->history, path);
- }
+ else if (select_item->type == ITEM_TYPE_DOTDESKTOP_ITEM
||select_item->type == ITEM_TYPE_APP)
+ {
+ switch (fork())
+ {
+ case 0:
+ mb_exec((char *)select_item->data);
+ fprintf(stderr, "exec failed, cleaning up child\n");
+ exit(1);
+ case -1:
+ fprintf(stderr, "can't fork\n");
+ break;
+ }
+
+ char path[512];
+ snprintf (path, 512, "%s/%s", PIXMAP_PATH, select_item->icon_name);
+ g_debug ("-------select_item path: %s", path);
+ moko_hisory_app_fill (mma->history, path);
+ }
-moko_icon_view_selection_changed_cb(mma->mm->icon_view, mma);
-
+ moko_icon_view_selection_changed_cb (mma->mm->icon_view, mma);
}
void
-moko_icon_view_selection_changed_cb(GtkIconView *iconview,
- MokoMainmenuApp
*mma)
+moko_icon_view_selection_changed_cb(MokoIconView *iconview,
+ MokoMainmenuApp *mma)
{
+ GList *selected_item;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeModel *icon_view_model;
+ gchar *text;
+
+ selected_item = moko_icon_view_get_selected_items (iconview);
+ if (!selected_item)
+ g_debug ("Can't get selected item");
+ else
+ {
+ icon_view_model = moko_icon_view_get_model (iconview);
+ gtk_tree_model_get_iter (icon_view_model, &iter, selected_item->data);
+
+ gtk_tree_model_get (icon_view_model, &iter,
+ TEXT_COLUMN , &text,
+ -1);
+
+ moko_dbus_send_message (text);
+
+ g_list_foreach (selected_item, gtk_tree_path_free, NULL);
+ g_list_free (selected_item);
+ if (text)
+ free (text);
+ }
+
moko_main_menu_update_item_total_label (mma->mm);
}
Modified:
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/callbacks.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/callbacks.h
2007-02-28 07:04:28 UTC (rev 1156)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/callbacks.h
2007-02-28 07:26:23 UTC (rev 1157)
@@ -34,13 +34,13 @@
void moko_down_btn_cb (GtkButton *button, MokoMainMenu *mm);
-void moko_item_select_cb(GtkIconView *icon_view,
+void moko_item_select_cb(MokoIconView *icon_view,
GtkTreePath *path, MokoMainmenuApp *mma);
-void moko_icon_view_item_acitvated_cb(GtkIconView *iconview,
+void moko_icon_view_item_acitvated_cb(MokoIconView *iconview,
GtkTreePath *path, MokoMainmenuApp *mma);
-void moko_icon_view_selection_changed_cb(GtkIconView *iconview,
+void moko_icon_view_selection_changed_cb(MokoIconView *iconview,
MokoMainmenuApp *mma);
#endif /*_MAIN_MENU_CALLBACKS_H*/
Added: trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/dbus-conn.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/dbus-conn.c
2007-02-28 07:04:28 UTC (rev 1156)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/dbus-conn.c
2007-02-28 07:26:23 UTC (rev 1157)
@@ -0,0 +1,73 @@
+/**
+ * @file dbus-conn.c
+ * @brief dbus connection and message send for openmoko mainmenu
+ *
+ * Authored by Sun Zhiyong <[EMAIL PROTECTED]>
+ *
+ * Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * 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 Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ *
+ */
+#include "dbus-conn.h"
+
+static DBusConnection *bus;
+static DBusError error;
+
+gboolean
+moko_dbus_connect_init (void)
+{
+ /* Get a connection to the session bus */
+ dbus_error_init (&error);
+ bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
+
+ if (!bus)
+ {
+ g_warning ("Failed to connect to the D-BUS daemon: %s", error.message);
+ return FALSE;
+ }
+
+ if (dbus_error_is_set (&error))
+ {
+ fprintf(stdout, "Connection Error (%s)\n", error.message);
+ dbus_error_free (&error);
+ }
+
+ return TRUE;
+}
+
+gboolean
+moko_dbus_send_message (const char *str)
+{
+ DBusMessage *message;
+ //char *str = "openmoko taskmanager";
+
+ /* Create a new signal on the "org.openmoko.dbus.TaskManager" interface,
+ * from the object "/org/openmoko/footer". */
+ message = dbus_message_new_signal ("/org/openmoko/footer",
+ "org.openmoko.dbus.TaskManager",
"push_statusbar_message");
+ /* Append the string "openmoko taskmanager" to the signal */
+ dbus_message_append_args (message,
+ DBUS_TYPE_STRING, &str,
+ DBUS_TYPE_INVALID);
+ /* Send the signal */
+ dbus_connection_send (bus, message, NULL);
+
+ /* Free the signal now we have finished with it */
+ dbus_message_unref (message);
+
+ /* Tell the user we send a signal */
+ g_print("send signal\n");
+
+ /* Return TRUE to tell the event loop we want to be called again */
+ return TRUE;
+}
Added: trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/dbus-conn.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/dbus-conn.h
2007-02-28 07:04:28 UTC (rev 1156)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/dbus-conn.h
2007-02-28 07:26:23 UTC (rev 1157)
@@ -0,0 +1,35 @@
+/**
+ * @file dbus-conn.h
+ * @brief dbus connection and message send for openmoko mainmenu
+ *
+ * Authored by Sun Zhiyong <[EMAIL PROTECTED]>
+ *
+ * Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * 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 Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ *
+ */
+#ifndef MOKO_DBUS_MESSAGE_SEND_H
+#define MOKO_DBUS_MESSAGE_SEND_H
+#include <glib.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#define DBUS_API_SUBJECT_TO_CHANGE
+
+gboolean moko_dbus_connect_init (void);
+
+gboolean moko_send_message (const char *str);
+
+#endif /*MOKO_DBUS_MESSAGE_SEND_H*/
Modified: trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/main.c
2007-02-28 07:04:28 UTC (rev 1156)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/main.c
2007-02-28 07:26:23 UTC (rev 1157)
@@ -125,13 +125,21 @@
g_debug ("test");
mma = g_malloc0 (sizeof (MokoMainmenuApp));
- if (!mma) {
+ if (!mma)
+ {
fprintf (stderr, "openmoko-mainmenu application initialize FAILED");
exit (0);
- }
+ }
memset (mma, 0, sizeof (MokoMainmenuApp));
+
+ if (!moko_dbus_connect_init ())
+ {
+ g_error ("Failed to initial dbus connection.");
+ exit (0);
+ }
gtk_init( &argc, &argv );
+
/* application object */
mma->app = MOKO_APPLICATION(moko_application_get_instance());
g_set_application_name( "OpenMoko Main Menu" );
Modified: trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/main.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/main.h
2007-02-28 07:04:28 UTC (rev 1156)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/main.h
2007-02-28 07:26:23 UTC (rev 1157)
@@ -30,6 +30,7 @@
#include "mainmenu.h"
#include "app-history.h"
+#include "dbus-conn.h"
typedef struct _MokoMainmenuApp MokoMainmenuApp;
Modified: trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c
2007-02-28 07:04:28 UTC (rev 1156)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c
2007-02-28 07:26:23 UTC (rev 1157)
@@ -192,7 +192,7 @@
*/
static gboolean
moko_fill_model(GtkListStore *store, const char* icon_path,
- const char* icon_name,
MokoDesktopItem *item)
+ const char* icon_name, MokoDesktopItem *item)
{
if (!icon_path && !icon_name)
return FALSE;
@@ -234,12 +234,13 @@
moko_main_menu_clear(MokoMainMenu *mm)
{
if (mm->top_item)
- {
- /* Free Lists (free .directory and .desktop files) */
- mokodesktop_item_folder_contents_free(mm->top_item, mm->top_item);
- /* Free Root item */
- mokodesktop_item_free(mm->top_item);
- }
+ {
+ /* Free Lists (free .directory and .desktop files) */
+ mokodesktop_item_folder_contents_free(mm->top_item, mm->top_item);
+ /* Free Root item */
+ mokodesktop_item_free(mm->top_item);
+ }
+
if (mm) g_free (mm);
}
@@ -256,50 +257,50 @@
gboolean
moko_main_menu_update_content (MokoMainMenu *mm, MokoDesktopItem *item)
{
- MokoDesktopItem *item_new;
- gint count = 0;
- char total_item[6];
- //g_debug("mokodesktop: item [%d][%s][%s]\n", item->type, item->name,
item->icon_name);
+ MokoDesktopItem *item_new;
+ gint count = 0;
+ char total_item[6];
+ //g_debug("mokodesktop: item [%d][%s][%s]\n", item->type, item->name,
item->icon_name);
- item_new = item->item_child;
- //g_debug("mokodesktop: item [%d][%s][%s]\n", item_new->type,
item_new->name, item_new->icon_name);
- // g_debug ("test");
+ item_new = item->item_child;
+ //g_debug("mokodesktop: item [%d][%s][%s]\n", item_new->type,
item_new->name, item_new->icon_name);
+ // g_debug ("test");
- if (item->type == ITEM_TYPE_ROOT)
- {
+ if (item->type == ITEM_TYPE_ROOT)
+ {
moko_set_label_content (mm->section_name, "Main Menu");
- }
- else if (item->type == ITEM_TYPE_FOLDER)
- {
- moko_set_label_content (mm->section_name, item->name);
- }
- else
+ }
+ else if (item->type == ITEM_TYPE_FOLDER)
+ {
+ moko_set_label_content (mm->section_name, item->name);
+ }
+ else
return FALSE; // neither ROOT nor FOLDER
- if (mm->list_store)
+ if (mm->list_store)
gtk_list_store_clear (mm->list_store);
- mokodesktop_items_enumerate_siblings(item->item_child, item_new)
- {
- count +=1;
+ mokodesktop_items_enumerate_siblings(item->item_child, item_new)
+ {
+ count +=1;
- if (access (item_new->icon_name, 0) == 0)
- {
- moko_fill_model(mm->list_store, item_new->icon_name, item_new->name,
item_new);
- }
- else
- {
- char path[512];
- snprintf (path, 512, "%s/%s", PIXMAP_PATH, item_new->icon_name);
+ if (access (item_new->icon_name, 0) == 0)
+ {
+ moko_fill_model(mm->list_store, item_new->icon_name,
item_new->name, item_new);
+ }
+ else
+ {
+ char path[512];
+ snprintf (path, 512, "%s/%s", PIXMAP_PATH, item_new->icon_name);
- if (access (path, 0) == 0)
- moko_fill_model(mm->list_store, path, item_new->name, item_new);
- else
- {
- snprintf (path, 512, "%s/%s", PKGDATADIR, "default-app-icon.xpm");
- moko_fill_model(mm->list_store, path, item_new->name, item_new);
- }
- }
+ if (access (path, 0) == 0)
+ moko_fill_model(mm->list_store, path, item_new->name,
item_new);
+ else
+ {
+ snprintf (path, 512, "%s/%s", PKGDATADIR,
"default-app-icon.xpm");
+ moko_fill_model(mm->list_store, path, item_new->name, item_new);
+ }
+ }
}
snprintf (total_item, 6, "00/%.2d", count);
@@ -318,17 +319,17 @@
void
moko_main_menu_update_item_total_label (MokoMainMenu *mm)
{
- gint total = 0, cursor = 0;
- char item_total[6];
+ gint total = 0, cursor = 0;
+ char item_total[6];
- total = moko_icon_view_get_total_items (mm->icon_view);
- cursor = moko_icon_view_get_cursor_positon (mm->icon_view);
+ total = moko_icon_view_get_total_items (mm->icon_view);
+ cursor = moko_icon_view_get_cursor_positon (mm->icon_view);
- if (cursor <0)
+ if (cursor <0)
return;
- snprintf (item_total, 6, "%.2d/%.2d", cursor, total);
- moko_set_label_content (mm->item_total, item_total);
+ snprintf (item_total, 6, "%.2d/%.2d", cursor, total);
+ moko_set_label_content (mm->item_total, item_total);
}
/**
--- End Message ---
--- Begin Message ---
Author: caowai_song
Date: 2007-02-28 09:20:02 +0100 (Wed, 28 Feb 2007)
New Revision: 1158
Modified:
trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/config-parser.c
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-key.c
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-layout.c
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
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.h
Log:
1. Add background picture to the keyboard
2. Display normal picture or pushed picture for each keys
Modified:
trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml
===================================================================
---
trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml
2007-02-28 07:26:23 UTC (rev 1157)
+++
trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml
2007-02-28 08:20:02 UTC (rev 1158)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<keyboard>
<options>
@@ -6,367 +6,172 @@
</options>
<layout id="defualt keyboard">
+ <background image="bg_keypad.png" />
-<!--
<row>
- <key>
- <default display="ヂ" />
- </key>
- <key>
- <default display="Ӫ" />
- </key>
- <key width="1500">
- <default display="Ω" />
- </key>
- <space width="1500" />
- <key fill="true">
- <default display="⠿" />
- </key>
- </row>
--->
- <row>
-
- <space width="500" extended="true"/>
-
- <key fill="true">
- <default display="Esc" action="escape" />
- <background image="testkey.png"/>
- </key>
-<!--
<key>
- <default display="image:/usr/share/pixmaps/sync_icon.png" action="a"/>
- </key>
--->
- <key>
- <default display="`" />
- <background image="testkey.png"/>
+ <default display="Q" />
+ <normalimage image="key_cap_Q.png"/>
+ <pushimage image="key_cap_Q_p.png"/>
</key>
<key>
- <default display="1" />
- <shifted display="!" />
- <background image="testkey.png"/>
+ <default display="W" />
+ <normalimage image="key_cap_W.png"/>
+ <pushimage image="key_cap_W_p.png"/>
</key>
<key>
- <default display="2" />
- <shifted display='"' />
- <mod1 display="½" />
- <background image="testkey.png"/>
+ <default display="E" />
+ <normalimage image="key_cap_E.png"/>
+ <pushimage image="key_cap_E_p.png"/>
</key>
<key>
- <default display="3" />
- <shifted display="£" />
- <mod1 display="¾" />
- <background image="testkey.png"/>
+ <default display="R" />
+ <normalimage image="key_cap_R.png"/>
+ <pushimage image="key_cap_R_p.png"/>
</key>
<key>
- <default display="4" />
- <shifted display="$" />
- <background image="testkey.png"/>
+ <default display="T" />
+ <normalimage image="key_cap_T.png"/>
+ <pushimage image="key_cap_T_p.png"/>
</key>
<key>
- <default display="5" />
- <shifted display="%" />
- <background image="testkey.png"/>
+ <default display="Y" />
+ <normalimage image="key_cap_Y.png"/>
+ <pushimage image="key_cap_Y_p.png"/>
</key>
<key>
- <default display="6" />
- <shifted display="^" />
- <background image="testkey.png"/>
+ <default display="U" />
+ <normalimage image="key_cap_U.png"/>
+ <pushimage image="key_cap_U_p.png"/>
</key>
<key>
- <default display="7" />
- <shifted display="&" />
- <background image="testkey.png"/>
+ <default display="I" />
+ <normalimage image="key_cap_I.png"/>
+ <pushimage image="key_cap_I_p.png"/>
</key>
<key>
- <default display="8" />
- <shifted display="*" />
- <background image="testkey.png"/>
+ <default display="O" />
+ <normalimage image="key_cap_O.png"/>
+ <pushimage image="key_cap_O_p.png"/>
</key>
<key>
- <default display="9" />
- <shifted display="(" />
- <background image="testkey.png"/>
+ <default display="P" />
+ <normalimage image="key_cap_P.png"/>
+ <pushimage image="key_cap_P_p.png"/>
</key>
- <key>
- <default display="0" />
- <shifted display=")" />
- <background image="testkey.png"/>
- </key>
- <key>
- <default display="-" />
- <shifted display="_" />
- <background image="testkey.png"/>
- </key>
- <key>
- <default display="=" />
- <shifted display="+" />
- <background image="testkey.png"/>
- </key>
- <key fill="true">
- <default display="Bksp" action="backspace"/>
- </key>
-
</row>
<row>
- <space width="500" extended="true"/>
-
- <key fill="true">
- <default display="Tab" action="tab"/>
+ <key>
+ <default display="A" />
+ <normalimage image="key_cap_A.png"/>
+ <pushimage image="key_cap_A_p.png"/>
</key>
- <key obey-caps='true'>
- <default display="q" />
- <shifted display="Q" />
- <background image="testkey.png"/>
+ <key>
+ <default display="S" />
+ <normalimage image="key_cap_S.png"/>
+ <pushimage image="key_cap_S_p.png"/>
</key>
- <key obey-caps='true'>
- <default display="w" />
- <shifted display="W" />
- <background image="testkey.png"/>
+ <key>
+ <default display="D" />
+ <normalimage image="key_cap_D.png"/>
+ <pushimage image="key_cap_D_p.png"/>
</key>
- <key obey-caps='true'>
- <mod1 display="ë" />
- <default display="e" />
- <shifted display="E" />
- <background image="testkey.png"/>
+ <key>
+ <default display="F" />
+ <normalimage image="key_cap_F.png"/>
+ <pushimage image="key_cap_F_p.png"/>
</key>
- <key obey-caps='true'>
- <default display="r" />
- <shifted display="R" />
- <background image="testkey.png"/>
+ <key>
+ <default display="G" />
+ <normalimage image="key_cap_G.png"/>
+ <pushimage image="key_cap_G_p.png"/>
</key>
- <key obey-caps='true'>
- <default display="t" />
- <shifted display="T" />
- <background image="testkey.png"/>
+ <key>
+ <default display="H" />
+ <normalimage image="key_cap_H.png"/>
+ <pushimage image="key_cap_H_p.png"/>
</key>
- <key obey-caps='true'>
- <default display="y" />
- <shifted display="Y" />
- <background image="testkey.png"/>
+ <key>
+ <default display="J" />
+ <normalimage image="key_cap_J.png"/>
+ <pushimage image="key_cap_J_p.png"/>
</key>
- <key obey-caps='true'>
- <default display="u" />
- <shifted display="U" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="i" />
- <shifted display="I" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="o" />
- <shifted display="O" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="p" />
- <shifted display="P" />
- <background image="testkey.png"/>
- </key>
<key>
- <default display="{" />
- <shifted display="[" />
- <background image="testkey.png"/>
+ <default display="K" />
+ <normalimage image="key_cap_K.png"/>
+ <pushimage image="key_cap_K_p.png"/>
</key>
<key>
- <default display="}" />
- <shifted display="]" />
- <background image="testkey.png"/>
+ <default display="L" />
+ <normalimage image="key_cap_L.png"/>
+ <pushimage image="key_cap_L_p.png"/>
</key>
- <key fill="true">
- <default display="\" />
- <shifted display="|" />
- <background image="testkey.png"/>
- </key>
</row>
<row>
- <space width="500" extended="true"/>
-
- <key fill="true">
- <default display="Caps" action="modifier:caps"/>
- </key>
- <key obey-caps='true'>
- <default display="a" />
- <shifted display="A" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="s" />
- <shifted display="S" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="d" />
- <shifted display="D" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="f" />
- <shifted display="F" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="g" />
- <shifted display="G" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="h" />
- <shifted display="H" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="j" />
- <shifted display="J" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="k" />
- <shifted display="K" />
- <background image="testkey.png"/>
- </key>
- <key obey-caps='true'>
- <default display="l" />
- <shifted display="L" />
- <background image="testkey.png"/>
- </key>
<key>
- <default display=";" />
- <shifted display=":" />
- <background image="testkey.png"/>
+ <default display="Z" />
+ <normalimage image="key_cap_Z.png"/>
+ <pushimage image="key_cap_Z_p.png"/>
</key>
<key>
- <default display="#" />
- <shifted display="~" />
- <background image="testkey.png"/>
+ <default display="X" />
+ <normalimage image="key_cap_X.png"/>
+ <pushimage image="key_cap_X_p.png"/>
</key>
- <key fill="true">
- <default display="Ret" action="return"/>
- </key>
-
- </row>
- <row>
-
- <space width="500" extended="true"/>
-
- <key fill="true">
- <default display="Shift" action="modifier:shift"/>
- </key>
-
- <key obey-caps='true'>
- <default display="z" />
- <shifted display="Z" />
- <background image="testkey.png"/>
- </key>
-
- <key obey-caps='true'>
- <default display="x" />
- <shifted display="X" />
- <background image="testkey.png"/>
- </key>
-
- <key obey-caps='true'>
- <default display="c" />
- <shifted display="C" />
- <background image="testkey.png"/>
- </key>
-
- <key obey-caps='true'>
- <default display="v" />
- <shifted display="V" />
- <background image="testkey.png"/>
- </key>
-
- <key obey-caps='true'>
- <default display="b" />
- <shifted display="B" />
- <background image="testkey.png"/>
- </key>
-
- <key obey-caps='true'>
- <default display="n" />
- <shifted display="N" />
- <background image="testkey.png"/>
- </key>
-
- <key obey-caps='true'>
- <default display="m" />
- <shifted display="M" />
- <background image="testkey.png"/>
- </key>
-
<key>
- <default display="," />
- <shifted display="<" />
- <background image="testkey.png"/>
+ <default display="C" />
+ <normalimage image="key_cap_C.png"/>
+ <pushimage image="key_cap_C_p.png"/>
</key>
<key>
- <default display="." />
- <shifted display=">" />
- <background image="testkey.png"/>
+ <default display="V" />
+ <normalimage image="key_cap_V.png"/>
+ <pushimage image="key_cap_V_p.png"/>
</key>
<key>
- <default display="/" />
- <shifted display="?" />
- <background image="testkey.png"/>
+ <default display="B" />
+ <normalimage image="key_cap_B.png"/>
+ <pushimage image="key_cap_B_p.png"/>
</key>
-
-
- <key fill="true">
- <default display="Shift" action="modifier:shift"/>
- </key>
-
- </row>
- <row>
-
- <space width="500" extended="true"/>
-
<key>
- <default display="äëö" action="modifier:mod1"/>
+ <default display="N" />
+ <normalimage image="key_cap_N.png"/>
+ <pushimage image="key_cap_N_p.png"/>
</key>
-
- <key fill="true">
- <default display="Ctrl" action="modifier:ctrl"/>
- </key>
-
<key>
- <default display="Alt" action="modifier:alt"/>
+ <default display="M" />
+ <normalimage image="key_cap_M.png"/>
+ <pushimage image="key_cap_M_p.png"/>
</key>
+ </row>
- <key>
- <default display=" " action="space" />
- <background image="spacekey.png"/>
- </key>
+ <row>
- <key>
- <default display="@" />
- <shifted display="'" />
- </key>
<key>
- <default display="^" action="up" />
+ <default display=" " action="space" />
+ <normalimage image="key_comm_space.png"/>
+ <pushimage image="key_comm_space_p.png"/>
</key>
<key>
- <default display="V" action="down" />
+ <default display=" " action="backspace" />
+ <normalimage image="key_comm_backspace.png"/>
+ <pushimage image="key_comm_backspace_p.png"/>
</key>
<key>
- <default display="<" action="left" />
+ <default display=" " action="return" />
+ <normalimage image="key_comm_enter.png"/>
+ <pushimage image="key_comm_enter_p.png"/>
</key>
- <key>
- <default display=">" action="right" />
- </key>
+ </row>
-</row>
-
</layout>
Modified:
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/config-parser.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/config-parser.c
2007-02-28 07:26:23 UTC (rev 1157)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/config-parser.c
2007-02-28 08:20:02 UTC (rev 1158)
@@ -315,10 +315,24 @@
MBKeyboardImage *img;
const char *val;
char buf[512];
+ Bool pushimage;
+ if (streq(tag, "normalimage"))
+ {
+ pushimage = False;
+ }
+ else if (streq(tag, "pushimage"))
+ {
+ pushimage = True;
+ }
+ else
+ {
+ set_error(state, "Unknown background image");
+ return;
+ }
+
if ((val = attr_get_val("image", attr)) == NULL)
{
- fprintf(stderr, "image=%s\n", val);
set_error(state, "Attribute 'image' is required");
return;
}
@@ -339,7 +353,10 @@
if (img == NULL)
fprintf(stderr, "load img fail\n");
- mb_kbd_key_set_back_image(state->current_key, img);
+ if (pushimage)
+ mb_kbd_key_set_normal_image(state->current_key, img);
+ else
+ mb_kbd_key_set_push_image(state->current_key, img);
}
static void
@@ -556,15 +573,44 @@
mb_kbd_key_set_fill(state->current_key, True);
}
- /*FIXME: It is only temporary code */
- //img = mb_kbd_image_new(state->keyboard, "/root/.matchbox/match.png");
- //if(!img)
- //fprintf(stderr, "can not find /root/.matchbox/match.png\n");
- //mb_kbd_key_set_back_image(state->current_key, img);
-
mb_kbd_row_append_key(state->current_row, state->current_key);
}
+static void
+config_handle_layout_background(MBKeyboardConfigState *state,
+ const char **attr)
+{
+ MBKeyboardImage *img;
+ const char *val;
+ char buf[512];
+
+ if ((val = attr_get_val("image", attr)) == NULL)
+ {
+ set_error(state, "Backgroud Attribute 'image' is required");
+ return;
+ }
+
+ if (val[0] != '/')
+ {
+ snprintf(buf, 512, "%s/%s", PKGDATADIR, val);
+
+ if (!util_file_readable(buf))
+ snprintf(buf, 512, "%s/.matchbox/%s", getenv("HOME"), val);
+
+ img = mb_kbd_image_new (state->keyboard, buf);
+ }
+ else
+ {
+ img = mb_kbd_image_new (state->keyboard, val);
+ }
+
+ if (img == NULL)
+ fprintf(stderr, "load img fail\n");
+
+ mb_kbd_layout_set_background(state->current_layout, img);
+
+}
+
static void
config_xml_start_cb(void *data, const char *tag, const char **attr)
{
@@ -587,7 +633,8 @@
config_handle_key_tag(state, attr);
mb_kbd_key_set_blank(state->current_key, True);
}
- else if (streq(tag, "background"))
+ else if (streq(tag, "normalimage")
+ || streq(tag, "pushimage"))
{
config_handle_key_background_tag(state, tag, attr);
}
@@ -600,6 +647,10 @@
{
config_handle_key_subtag(state, tag, attr);
}
+ else if (streq(tag, "background"))
+ {
+ config_handle_layout_background(state, attr);
+ }
if (state->error)
{
Modified:
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-key.c
===================================================================
---
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-key.c
2007-02-28 07:26:23 UTC (rev 1157)
+++
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-key.c
2007-02-28 08:20:02 UTC (rev 1158)
@@ -72,7 +72,8 @@
boolean is_blank; /* 'blank' keys are spacers */
boolean extended; /* only show in landscape */
- MBKeyboardImage *back_image; /* The background image */
+ MBKeyboardImage *normal_image; /* The normal image */
+ MBKeyboardImage *push_image; /* The push down image */
MBKeyboardStateType sets_kbdstate; /* needed */
};
@@ -100,18 +101,30 @@
}
void
-mb_kbd_key_set_back_image(MBKeyboardKey *key, MBKeyboardImage *image)
+mb_kbd_key_set_normal_image(MBKeyboardKey *key, MBKeyboardImage *image)
{
- key->back_image = image;
+ key->normal_image = image;
}
MBKeyboardImage *
-mb_kbd_key_get_back_image(MBKeyboardKey *key)
+mb_kbd_key_get_normal_image(MBKeyboardKey *key)
{
- return key->back_image;
+ return key->normal_image;
}
void
+mb_kbd_key_set_push_image(MBKeyboardKey *key, MBKeyboardImage *image)
+{
+ key->push_image = image;
+}
+
+MBKeyboardImage *
+mb_kbd_key_get_push_image(MBKeyboardKey *key)
+{
+ return key->push_image;
+}
+
+void
mb_kbd_key_set_obey_caps(MBKeyboardKey *key, boolean obey)
{
key->obeys_caps = obey;
Modified:
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-layout.c
===================================================================
---
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-layout.c
2007-02-28 07:26:23 UTC (rev 1157)
+++
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-layout.c
2007-02-28 08:20:02 UTC (rev 1158)
@@ -23,6 +23,7 @@
{
MBKeyboard *kbd;
char *id;
+ MBKeyboardImage *background;
List *rows;
};
@@ -41,6 +42,19 @@
}
void
+mb_kbd_layout_set_background(MBKeyboardLayout *layout,
+ MBKeyboardImage *background)
+{
+ layout->background = background;
+}
+
+MBKeyboardImage *
+mb_kbd_layout_get_background(MBKeyboardLayout *layout)
+{
+ return layout->background;
+}
+
+void
mb_kbd_layout_append_row(MBKeyboardLayout *layout,
MBKeyboardRow *row)
{
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-02-28 07:26:23 UTC (rev 1157)
+++
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui-xft-backend.c
2007-02-28 08:20:02 UTC (rev 1158)
@@ -147,13 +147,10 @@
if (rect.y + rect.height >= mb_kbd_ui_x_win_height(ui))
rect.height = mb_kbd_ui_x_win_height(ui) - rect.y - 1;
- /* clear it */
-
- XSetForeground(xdpy, xft_backend->xgc, WhitePixel(xdpy, xscreen));
-
- XFillRectangles(xdpy, backbuffer, xft_backend->xgc, &rect, 1);
-
- image = mb_kbd_key_get_back_image(key);
+ if (mb_kbd_key_is_held(kbd, key))
+ image = mb_kbd_key_get_push_image(key);
+ else
+ image = mb_kbd_key_get_normal_image(key);
if(image)
{
int w, h;
@@ -169,6 +166,12 @@
}
else
{
+ /* clear it */
+
+ XSetForeground(xdpy, xft_backend->xgc, WhitePixel(xdpy, xscreen));
+
+ XFillRectangles(xdpy, backbuffer, xft_backend->xgc, &rect, 1);
+
/* draw 'main border' */
XSetForeground(xdpy, xft_backend->xgc, xft_backend->xcol_c5c5c5.pixel);
@@ -245,6 +248,7 @@
state = MBKeyboardKeyStateNormal;
}
+/*
if (mb_kbd_key_get_face_type(key, state) == MBKeyboardKeyFaceGlyph)
{
const char *face_str = mb_kbd_key_get_glyph_face(key, state);
@@ -293,32 +297,52 @@
XftDrawPicture (xft_backend->xft_backbuffer),
0, 0, 0, 0, x, y, w, h);
}
+*/
}
void
mb_kbd_ui_xft_pre_redraw(MBKeyboardUI *ui)
{
MBKeyboardUIBackendXft *xft_backend = NULL;
+ MBKeyboardImage *image;
xft_backend = (MBKeyboardUIBackendXft*)mb_kbd_ui_backend(ui);
+ image =
mb_kbd_layout_get_background(mb_kbd_get_selected_layout(mb_kbd_ui_kbd(ui)));
+
/* Background */
- XSetForeground(mb_kbd_ui_x_display(ui),
- xft_backend->xgc, xft_backend->xcol_f4f4f4.pixel);
+ if (image == NULL)
+ {
+ XSetForeground(mb_kbd_ui_x_display(ui),
+ xft_backend->xgc, xft_backend->xcol_f4f4f4.pixel);
- XFillRectangle(mb_kbd_ui_x_display(ui),
- mb_kbd_ui_backbuffer(ui),
- xft_backend->xgc,
- 0, 0,
- mb_kbd_ui_x_win_width(ui),
- mb_kbd_ui_x_win_height(ui));
+ XFillRectangle(mb_kbd_ui_x_display(ui),
+ mb_kbd_ui_backbuffer(ui),
+ xft_backend->xgc,
+ 0, 0,
+ mb_kbd_ui_x_win_width(ui),
+ mb_kbd_ui_x_win_height(ui));
- XSetForeground(mb_kbd_ui_x_display(ui),
- xft_backend->xgc,
- BlackPixel(mb_kbd_ui_x_display(ui),
- mb_kbd_ui_x_screen(ui)));
+ XSetForeground(mb_kbd_ui_x_display(ui),
+ xft_backend->xgc,
+ BlackPixel(mb_kbd_ui_x_display(ui),
+ mb_kbd_ui_x_screen(ui)));
+ }
+ else
+ {
+ int w, h;
+ w = mb_kbd_image_width (image);
+ h = mb_kbd_image_height (image);
+ XRenderComposite(mb_kbd_ui_x_display(ui),
+ PictOpOver,
+ mb_kbd_image_render_picture(image),
+ None,
+ XftDrawPicture(xft_backend->xft_backbuffer),
+ 0, 0, 0, 0, 0, 0, w, h);
+ }
+
}
static int
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-02-28 07:26:23 UTC (rev 1157)
+++
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui.c
2007-02-28 08:20:02 UTC (rev 1158)
@@ -134,7 +134,6 @@
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);
@@ -341,9 +340,9 @@
max_h = mb_kbd_image_height (img);
}
}
- if (mb_kbd_key_get_back_image(key))
+ if (mb_kbd_key_get_normal_image(key))
{
- MBKeyboardImage *img = mb_kbd_key_get_back_image(key);
+ MBKeyboardImage *img = mb_kbd_key_get_normal_image(key);
if (mb_kbd_image_width (img) > max_w)
max_w = mb_kbd_image_width (img);
@@ -437,9 +436,7 @@
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;
@@ -468,7 +465,6 @@
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)
{
@@ -524,6 +520,23 @@
}
*width = max_row_width;
+
+ if (mb_kbd_layout_get_background(layout) != NULL)
+ {
+ MBKeyboardImage *img;
+ int img_wid;
+ int img_hei;
+
+ img = mb_kbd_layout_get_background(layout);
+ img_wid = mb_kbd_image_width(img);
+ img_hei = mb_kbd_image_height(img);
+
+ if (img_wid > *width)
+ *width = img_wid;
+
+ if (img_hei > *height)
+ *height = img_hei;
+ }
}
void
@@ -667,8 +680,8 @@
have_matchbox_wm = True;
}
- win_attr.override_redirect = True; /* Set to true for extreme case */
- /*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;
@@ -680,7 +693,6 @@
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();
@@ -1038,7 +1050,6 @@
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);
@@ -1249,7 +1260,6 @@
*/
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-02-28 07:26:23 UTC (rev 1157)
+++
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.c
2007-02-28 08:20:02 UTC (rev 1158)
@@ -89,11 +89,11 @@
if (want_small)
{
- kb->key_border = 1;
+ kb->key_border = 0;
kb->key_pad = 0;
kb->col_spacing = 0;
kb->row_spacing = 0;
- kb->font_pt_size = 10;
+ kb->font_pt_size = 12;
}
if (!mb_kbd_config_load(kb, variant))
Modified:
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.h
===================================================================
---
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.h
2007-02-28 07:26:23 UTC (rev 1157)
+++
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.h
2007-02-28 08:20:02 UTC (rev 1158)
@@ -341,6 +341,13 @@
mb_kbd_layout_new(MBKeyboard *kbd, const char *id);
void
+mb_kbd_layout_set_background(MBKeyboardLayout *layout,
+ MBKeyboardImage *background);
+
+MBKeyboardImage *
+mb_kbd_layout_get_background(MBKeyboardLayout *layout);
+
+void
mb_kbd_layout_append_row(MBKeyboardLayout *layout,
MBKeyboardRow *row);
@@ -392,12 +399,18 @@
mb_kbd_key_new(MBKeyboard *kbd);
void
-mb_kbd_key_set_back_image(MBKeyboardKey *key, MBKeyboardImage *image);
+mb_kbd_key_set_normal_image(MBKeyboardKey *key, MBKeyboardImage *image);
MBKeyboardImage *
-mb_kbd_key_get_back_image(MBKeyboardKey *key);
+mb_kbd_key_get_normal_image(MBKeyboardKey *key);
void
+mb_kbd_key_set_push_image(MBKeyboardKey *key, MBKeyboardImage *image);
+
+MBKeyboardImage *
+mb_kbd_key_get_push_image(MBKeyboardKey *key);
+
+void
mb_kbd_key_set_obey_caps(MBKeyboardKey *key, boolean obey);
boolean
--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog