--- freeciv.orig/client/gui-gtk/gui_main.c Tue Apr 11 21:53:21 2000 +++ freeciv/client/gui-gtk/gui_main.c Wed Apr 12 20:10:20 2000 @@ -120,7 +120,9 @@ GtkWidget * turn_done_button; GtkWidget * unit_pixmap; +GtkWidget * unit_pixmap_button; GtkWidget * unit_below_pixmap [MAX_NUM_UNITS_BELOW]; +GtkWidget * unit_below_pixmap_button [MAX_NUM_UNITS_BELOW]; GtkWidget * more_arrow_pixmap; gint gtk_interval_id; @@ -134,6 +136,8 @@ GdkWindow * root_window; +int unit_ids[MAX_NUM_UNITS_BELOW]; /* ids of the units displayed on + the left */ enum Display_color_type display_color_type; @@ -273,6 +277,20 @@ return ahbox; } +static void select_pixmap_callback(GtkWidget *w, GdkEvent *ev, int i) +{ + struct unit *punit; + + if (i == -1) /* unit currently selected */ + return; + if (unit_ids[i] == 0) /* no unit displayed at this place */ + return; + punit=find_unit_by_id(unit_ids[i]); + if(punit) { /* should always be true at this point */ + request_new_unit_activity(punit, ACTIVITY_IDLE); + set_unit_focus(punit); + } +} /************************************************************************** ... **************************************************************************/ @@ -426,13 +444,25 @@ gtk_table_set_col_spacings(GTK_TABLE(table), 2); unit_pixmap=gtk_pixcomm_new(root_window, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT); - gtk_table_attach_defaults( GTK_TABLE(table), unit_pixmap, 0, 1, 0, 1 ); gtk_pixcomm_clear(GTK_PIXCOMM(unit_pixmap), TRUE); + unit_pixmap_button=gtk_event_box_new(); + gtk_container_add(GTK_CONTAINER(unit_pixmap_button),unit_pixmap); + gtk_table_attach_defaults( GTK_TABLE(table), unit_pixmap_button, + 0, 1, 0, 1 ); + gtk_signal_connect(GTK_OBJECT(unit_pixmap_button), "button_press_event", + GTK_SIGNAL_FUNC(select_pixmap_callback),(gpointer)(-1)); for (i=0; i