#include typedef struct button_info_t { double x1; double y1; double x2; double y2; char *name; unsigned int id; }button_info_t; static const button_info_t g_button_info[] = { { 18.000000,37.000000,34.000000,46.000000,"MUTE",0x0F}, { 86.000000,31.000000,108.000000,44.000000,"POWER",0x0A}, { 18.000000,62.000000,38.000000,74.000000,"1",0x01}, { 50.000000,60.000000,72.000000,69.000000,"2",0x02}, { 85.000000,60.000000,103.000000,70.000000,"3",0x03}, { 17.000000,83.000000,39.000000,95.000000,"4",0x04}, { 52.000000,81.000000,72.000000,93.000000,"5",0x05}, { 85.000000,82.000000,105.000000,96.000000,"6",0x06}, { 19.000000,106.000000,36.000000,120.000000,"7",0x07}, { 49.000000,105.000000,69.000000,119.000000,"8",0x08}, { 82.000000,107.000000,102.000000,116.000000,"9",0x09}, { 21.000000,131.000000,36.000000,142.000000,"-",0x13}, { 51.000000,130.000000,71.000000,140.000000,"0",0x00}, { 80.000000,131.000000,102.000000,143.000000,"PRE-CH",0x38}, { 19.000000,156.000000,36.000000,166.000000,"VOL+",0x0D}, { 49.000000,152.000000,68.000000,164.000000,"INFO",0x33}, { 80.000000,153.000000,102.000000,166.000000,"CH+",0x0B}, { 18.000000,181.000000,33.000000,189.000000,"VOL-",0x0E}, { 48.000000,185.000000,69.000000,200.000000,"UP",0x34}, { 84.000000,179.000000,100.000000,190.000000,"CH-",0x0C}, { 20.000000,210.000000,42.000000,226.000000,"LEFT",0x36}, { 52.000000,213.000000,69.000000,224.000000,"OK",0x11}, { 79.000000,211.000000,102.000000,226.000000,"RIGHT",0x37}, { 47.000000,238.000000,71.000000,252.000000,"DOWN",0x35}, { 21.000000,251.000000,37.000000,263.000000,"EPG",0x30}, { 83.000000,251.000000,99.000000,260.000000,"MENU",0x19}, }; int g_button_into_num = sizeof(g_button_info)/sizeof(g_button_info[0]); extern pc_post_user_io_event(char* name,unsigned int id); void gtk_remote_clicked(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { #if 0 static gboolean odd = FALSE; if (odd) g_print(",%f,%f,\"OK\"},\n",event->x,event->y); else g_print(" { %f,%f",event->x,event->y); odd = !odd; #else int i; for (i = 0; i < g_button_into_num; ++i) { if ((event->x > g_button_info[i].x1) && (event->x < g_button_info[i].x2) && (event->y > g_button_info[i].y1) && (event->y < g_button_info[i].y2)) { g_print("%s\n",g_button_info[i].name); pc_post_user_io_event(g_button_info[i].name,g_button_info[i].id); break; } } #endif }