Using hardware keys with S60 and Maemo Platform
(→Comparison) |
(→Comparison) |
||
| Line 5: | Line 5: | ||
Both S60 Platform and Maemo Platform devices have a number of hardware keys for developers to use. The number of keys available varies between different devices. Both platforms have devices with full QWERTY keyboard. For example the E90 Communicator and the Nokia N810 Internet Tablet. | Both S60 Platform and Maemo Platform devices have a number of hardware keys for developers to use. The number of keys available varies between different devices. Both platforms have devices with full QWERTY keyboard. For example the E90 Communicator and the Nokia N810 Internet Tablet. | ||
| − | [[Image:Nokia_E90.png]] [[Image:Nokia_N810.png]] | + | [[Image:Nokia_E90.png]] |
| + | Nokia E90 Communicator | ||
| + | |||
| + | [[Image:Nokia_N810.png]] | ||
| + | Nokia N810 Internet Tablet | ||
== S60 Platform == | == S60 Platform == | ||
Revision as of 13:02, 15 November 2007
Comparison
Both S60 Platform and Maemo Platform devices have a number of hardware keys for developers to use. The number of keys available varies between different devices. Both platforms have devices with full QWERTY keyboard. For example the E90 Communicator and the Nokia N810 Internet Tablet.
S60 Platform
Maemo Platform
typedef struct _AppData AppData;
struct _AppData
{
HildonProgram *program; /* handle to application */
HildonWindow *window; /* handle to app's window */
osso_context_t *osso; /* handle to osso */
};
/* Creates and initialises a main_view */
MainView* interface_main_view_new( AppData *data )
{
/* Zero memory with g_new0 */
MainView* result = g_new0( MainView, 1 );
...
/* Add hardware button listener to application */
g_signal_connect(G_OBJECT(result->data->window),
"key_press_event", G_CALLBACK(callback_key_press), result);
...
}
/* Callback for hardware keys */
gboolean callback_key_press(GtkWidget * widget, GdkEventKey * event, gpointer data)
{
switch (event->keyval) {
case GDK_Up:
callback_up( NULL, data );
return TRUE;
case GDK_Down:
callback_down( NULL, data );
return TRUE;
case GDK_Left:
callback_left( NULL, data );
return TRUE;
case GDK_Right:
callback_right( NULL, data );
return TRUE;
case GDK_Return:
callback_reset( NULL, data );
return TRUE;
case GDK_F6:
callback_fullscreen( NULL, data );
return TRUE;
case GDK_F7: /* "Increase (zoom in)" */
return FALSE;
case GDK_F8: /* "Decrease (zoom out)" */
return FALSE;
case GDK_Escape: /* "Cancel/Close" */
return FALSE;
}
return FALSE;
}




