Author: bcoudoin Date: Sat Feb 16 14:31:09 2008 New Revision: 3254 URL: http://svn.gnome.org/viewvc/gcompris?rev=3254&view=rev
Log: Improved focus management API Still need to implement it in the python side Modified: branches/gcomprixogoo/src/babymatch-activity/shapegame.c branches/gcomprixogoo/src/boards/menu2.c branches/gcomprixogoo/src/boards/py-mod-utils.c branches/gcomprixogoo/src/canal_lock-activity/canal_lock.c branches/gcomprixogoo/src/click_on_letter-activity/click_on_letter.c branches/gcomprixogoo/src/crane-activity/crane.c branches/gcomprixogoo/src/enumerate-activity/enumerate.c branches/gcomprixogoo/src/gcompris/about.c branches/gcomprixogoo/src/gcompris/bar.c branches/gcomprixogoo/src/gcompris/board_config.c branches/gcomprixogoo/src/gcompris/config.c branches/gcomprixogoo/src/gcompris/file_selector.c branches/gcomprixogoo/src/gcompris/gameutil.c branches/gcomprixogoo/src/gcompris/gameutil.h branches/gcomprixogoo/src/gcompris/gcompris_confirm.c branches/gcomprixogoo/src/gcompris/help.c branches/gcomprixogoo/src/gcompris/images_selector.c branches/gcomprixogoo/src/magic_hat_minus-activity/magic_hat.c branches/gcomprixogoo/src/paratrooper-activity/paratrooper.c branches/gcomprixogoo/src/scalesboard-activity/scale.c branches/gcomprixogoo/src/tangram-activity/gtans_interface.c branches/gcomprixogoo/src/tangram-activity/resources/tangram/Makefile.am branches/gcomprixogoo/src/wordprocessor-activity/wordprocessor.c Modified: branches/gcomprixogoo/src/babymatch-activity/shapegame.c ============================================================================== --- branches/gcomprixogoo/src/babymatch-activity/shapegame.c (original) +++ branches/gcomprixogoo/src/babymatch-activity/shapegame.c Sat Feb 16 14:31:09 2008 @@ -624,14 +624,8 @@ "button_press_event", (GtkSignalFunc) item_event_ok, "previous_shapelist"); - g_signal_connect(previous_shapelist_item, - "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); - g_signal_connect(previous_shapelist_item, - "leave_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(previous_shapelist_item, NULL); + gdk_pixbuf_unref(pixmap); pixmap = gc_skin_pixmap_load("button_forward.png"); @@ -645,12 +639,7 @@ g_signal_connect(next_shapelist_item, "button_press_event", (GtkSignalFunc) item_event_ok, "next_shapelist"); - g_signal_connect(next_shapelist_item, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); - g_signal_connect(next_shapelist_item, "leave_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(next_shapelist_item, NULL); gdk_pixbuf_unref(pixmap); g_object_set (next_shapelist_item, "visibility", GOO_CANVAS_ITEM_INVISIBLE, NULL); @@ -793,12 +782,7 @@ shape->name, shape->shapelistgroup_index, current_shapelistgroup_index); setup_item(item, icon_shape); - g_signal_connect(item, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); - g_signal_connect(item, "leave_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); } } } @@ -1529,12 +1513,12 @@ /* get the ZOOMY coord of the shape */ zoomy = xmlGetProp_Double(xmlnode, BAD_CAST "zoomy", 1); - /* get the POSITION of the shape */ + /* get the POSITION of the shape : DEPRECATED */ /* Position in the xml means: * 0 = BOTTOM * 1 or more = TOP */ - position = (guint) xmlGetProp_Double(xmlnode, BAD_CAST "position", 0); + position = 0; /* Back to the user locale */ gc_locale_set(locale); @@ -1653,7 +1637,6 @@ { GList *shape_list_init = NULL; xmlNodePtr node; - GList *list; GooCanvasItem *item; int list_length, i; @@ -1692,18 +1675,6 @@ g_object_set (next_shapelist_item, "visibility", GOO_CANVAS_ITEM_VISIBLE, NULL); current_shapelistgroup_index = 0; } - - /* Loop through all the shapes and */ - /* Arrange the order (depth) of the shapes on the canvas */ - /* Depending on the xml given definition in the position property */ - for(list = shape_list; list != NULL; list = list->next) - { - Shape *shape = list->data; - - goo_canvas_item_lower(shape->item, NULL); - //FIXMEif(shape->position>=1) - //goo_canvas_item_raise(shape->item, ABS(shape->position)); - } } Modified: branches/gcomprixogoo/src/boards/menu2.c ============================================================================== --- branches/gcomprixogoo/src/boards/menu2.c (original) +++ branches/gcomprixogoo/src/boards/menu2.c Sat Feb 16 14:31:09 2008 @@ -319,9 +319,7 @@ g_signal_connect (item, "leave_notify_event", (GtkSignalFunc) on_leave_notify, menuitems); - g_signal_connect(item, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); } } @@ -549,9 +547,7 @@ g_signal_connect (menu_button, "leave_notify_event", (GtkSignalFunc) on_leave_notify, menuitems); - g_signal_connect(menu_button, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(menu_button, NULL); } @@ -799,11 +795,7 @@ (GtkSignalFunc) item_event, menuitems); - g_signal_connect(item, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); - - + gc_item_focus_init(item, NULL); i++; } Modified: branches/gcomprixogoo/src/boards/py-mod-utils.c ============================================================================== --- branches/gcomprixogoo/src/boards/py-mod-utils.c (original) +++ branches/gcomprixogoo/src/boards/py-mod-utils.c Sat Feb 16 14:31:09 2008 @@ -100,8 +100,8 @@ /* gint gc_item_focus_event(GooCanvasItem *item, - GdkEvent *event, - GooCanvasItem *dest_item); + GdkEvent *event, + GooCanvasItem *dest_item); */ static PyObject* py_gc_item_focus_event(PyObject* self, PyObject* args) Modified: branches/gcomprixogoo/src/canal_lock-activity/canal_lock.c ============================================================================== --- branches/gcomprixogoo/src/canal_lock-activity/canal_lock.c (original) +++ branches/gcomprixogoo/src/canal_lock-activity/canal_lock.c Sat Feb 16 14:31:09 2008 @@ -277,9 +277,8 @@ g_signal_connect(tuxboat_item, "button-press-event", (GtkSignalFunc) item_event, NULL); - g_signal_connect(tuxboat_item, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(tuxboat_item, NULL); + tuxboat_width = gdk_pixbuf_get_width(pixmap); gdk_pixbuf_unref(pixmap); Modified: branches/gcomprixogoo/src/click_on_letter-activity/click_on_letter.c ============================================================================== --- branches/gcomprixogoo/src/click_on_letter-activity/click_on_letter.c (original) +++ branches/gcomprixogoo/src/click_on_letter-activity/click_on_letter.c Sat Feb 16 14:31:09 2008 @@ -430,7 +430,7 @@ (GtkSignalFunc) item_event, GINT_TO_POINTER(i)); g_signal_connect(buttons[i], "button_press_event", (GtkSignalFunc) item_event, GINT_TO_POINTER(i)); - // g_signal_connect(GTK_OBJECT(buttons[i]), "enter_notify_event", (GtkSignalFunc) gc_item_focus_event, NULL); + gc_item_focus_init(buttons[i], NULL); } @@ -516,16 +516,12 @@ if (selected_button != NULL && selected_button != button) { button_pixmap = gc_pixmap_load("click_on_letter/wagon-yellow.png"); - /* Warning changing the image needs to update pixbuf_ref for the focus usage */ - gc_item_focus_free(selected_button, NULL); g_object_set(selected_button, "pixbuf", button_pixmap, NULL); gdk_pixbuf_unref(button_pixmap); } if (selected_button != button) { button_pixmap_selected = gc_pixmap_load("click_on_letter/wagon-green.png"); - /* Warning changing the image needs to update pixbuf_ref for the focus usage */ - gc_item_focus_free(button, NULL); g_object_set(button, "pixbuf", button_pixmap_selected, NULL); selected_button = button; gdk_pixbuf_unref(button_pixmap_selected); Modified: branches/gcomprixogoo/src/crane-activity/crane.c ============================================================================== --- branches/gcomprixogoo/src/crane-activity/crane.c (original) +++ branches/gcomprixogoo/src/crane-activity/crane.c Sat Feb 16 14:31:09 2008 @@ -555,9 +555,7 @@ NULL); g_signal_connect(item_arrow, "button_press_event", (GtkSignalFunc) arrow_event, GINT_TO_POINTER(i)); - g_signal_connect(item_arrow, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item_arrow, NULL); gdk_pixbuf_unref( arrow[i].pixmap); } Modified: branches/gcomprixogoo/src/enumerate-activity/enumerate.c ============================================================================== --- branches/gcomprixogoo/src/enumerate-activity/enumerate.c (original) +++ branches/gcomprixogoo/src/enumerate-activity/enumerate.c Sat Feb 16 14:31:09 2008 @@ -460,9 +460,7 @@ g_signal_connect(item, "button-press-event", (GtkSignalFunc) item_event_focus, GINT_TO_POINTER(i)); - g_signal_connect(item, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); answer_item[i] = \ Modified: branches/gcomprixogoo/src/gcompris/about.c ============================================================================== --- branches/gcomprixogoo/src/gcompris/about.c (original) +++ branches/gcomprixogoo/src/gcompris/about.c Sat Feb 16 14:31:09 2008 @@ -249,9 +249,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_ok, "ok"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); gdk_pixbuf_unref(pixmap); @@ -276,9 +274,7 @@ g_signal_connect(item2, "button_press_event", (GtkSignalFunc) item_event_ok, "ok"); - g_signal_connect(item2, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - item); + gc_item_focus_init(item2, item); pixmap = gc_skin_pixmap_load("gcompris-about.png"); Modified: branches/gcomprixogoo/src/gcompris/bar.c ============================================================================== --- branches/gcomprixogoo/src/gcompris/bar.c (original) +++ branches/gcomprixogoo/src/gcompris/bar.c Sat Feb 16 14:31:09 2008 @@ -253,8 +253,6 @@ pixmap = gc_skin_pixmap_load(str); g_free(str); - /* Warning changing the image needs to free the focus first */ - gc_item_focus_free(level_item, NULL); g_object_set (level_item, "pixbuf", pixmap, @@ -286,8 +284,6 @@ return; } - /* Warning changing the image needs to update pixbuf_ref for the focus usage */ - gc_item_focus_free(repeat_item, NULL); g_object_set (repeat_item, "pixbuf", pixmap, NULL); @@ -628,10 +624,5 @@ (GtkSignalFunc) item_event_bar, name); - g_signal_connect(item, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); - g_signal_connect(item, "leave_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); } Modified: branches/gcomprixogoo/src/gcompris/board_config.c ============================================================================== --- branches/gcomprixogoo/src/gcompris/board_config.c (original) +++ branches/gcomprixogoo/src/gcompris/board_config.c Sat Feb 16 14:31:09 2008 @@ -87,6 +87,7 @@ Confcallback(NULL); Confcallback = NULL; } + gc_bar_hide(FALSE); g_free(label_markup); } @@ -130,15 +131,21 @@ Confcallback = callback; hash_conf = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + gc_bar_hide(TRUE); + /* Creating a config window will cause our main window to loose focus, this tells the main window to ignore the next focus out event (and thus stay in fullscreen mode if we're fullscreen). */ /* main configuration window */ + /* FIXME MODAL NO MORE WORK: ONCE THE DIALOG IS REMOVED, THE BAR + EVENT NO MORE WORKS + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + */ conf_window = \ GTK_WINDOW(gtk_dialog_new_with_buttons ("GCompris", GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET(gc_board_get_current()->canvas))), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_APPLY, Modified: branches/gcomprixogoo/src/gcompris/config.c ============================================================================== --- branches/gcomprixogoo/src/gcompris/config.c (original) +++ branches/gcomprixogoo/src/gcompris/config.c Sat Feb 16 14:31:09 2008 @@ -260,9 +260,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_ok, "fullscreen"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); goo_canvas_text_new (rootitem, @@ -302,9 +300,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_ok, "music"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); goo_canvas_text_new (rootitem, @@ -329,9 +325,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_ok, "effect"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); goo_canvas_text_new (rootitem, @@ -453,9 +447,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_ok, "ok"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); goo_canvas_text_new (rootitem, _("OK"), @@ -478,9 +470,7 @@ g_signal_connect(item2, "button_press_event", (GtkSignalFunc) item_event_ok, "ok"); - g_signal_connect(item2, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - item); + gc_item_focus_init(item2, item); gdk_pixbuf_unref(pixmap); @@ -563,9 +553,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_ok, eventname_previous); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); gdk_pixbuf_unref(pixmap); @@ -579,9 +567,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_ok, eventname_next); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); gdk_pixbuf_unref(pixmap); } @@ -753,8 +739,6 @@ gc_fullscreen_set(properties->fullscreen); - /* Warning changing the image needs to update pixbuf_ref for the focus usage */ - gc_item_focus_free(item, NULL); g_object_set (item, "pixbuf", (properties->fullscreen ? pixmap_checked : pixmap_unchecked), NULL); @@ -763,8 +747,6 @@ else if(!strcmp((char *)data, "music")) { properties->music = (properties->music ? 0 : 1); - /* Warning changing the image needs to update pixbuf_ref for the focus usage */ - gc_item_focus_free(item, NULL); g_object_set (item, "pixbuf", (properties->music ? pixmap_checked : pixmap_unchecked), NULL); @@ -780,8 +762,6 @@ else if(!strcmp((char *)data, "effect")) { properties->fx = (properties->fx ? 0 : 1); - /* Warning changing the image needs to update pixbuf_ref for the focus usage */ - gc_item_focus_free(item, NULL); g_object_set (item, "pixbuf", (properties->fx ? pixmap_checked : pixmap_unchecked), NULL); Modified: branches/gcomprixogoo/src/gcompris/file_selector.c ============================================================================== --- branches/gcomprixogoo/src/gcompris/file_selector.c (original) +++ branches/gcomprixogoo/src/gcompris/file_selector.c Sat Feb 16 14:31:09 2008 @@ -261,9 +261,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_file_selector, "/cancel/"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); item = goo_canvas_text_new (rootitem, _("CANCEL"), @@ -277,9 +275,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_file_selector, "/cancel/"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - item); + gc_item_focus_init(item, NULL); // OK item = goo_canvas_image_new (rootitem, @@ -291,9 +287,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_file_selector, "/ok/"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); item = goo_canvas_text_new (rootitem, (mode==MODE_LOAD ? _("LOAD") : _("SAVE")), @@ -307,9 +301,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_file_selector, "/ok/"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - item); + gc_item_focus_init(item, NULL); gdk_pixbuf_unref(pixmap); @@ -507,9 +499,7 @@ (GtkSignalFunc) item_event_file_selector, allfilename); } - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); g_object_set_data_full (G_OBJECT (item), "allfilename", allfilename, g_free); Modified: branches/gcomprixogoo/src/gcompris/gameutil.c ============================================================================== --- branches/gcomprixogoo/src/gcompris/gameutil.c (original) +++ branches/gcomprixogoo/src/gcompris/gameutil.c Sat Feb 16 14:31:09 2008 @@ -175,48 +175,67 @@ } /** - * Free the highlight image from our image_focus system + * Init an item so that it has a focus + * Optionnaly, provide a target_item that will be focused + * by events on source_item. * - * It must be called before assigning a new image to an item that - * already has a focus enabled with gc_item_focus_event(). */ -void -gc_item_focus_free(GooCanvasItem *item, void *none) +#define GAP 4 +void gc_item_focus_init(GooCanvasItem *source_item, + GooCanvasItem *target_item) { + GooCanvasItem *highlight_item; + GooCanvasBounds bounds; + + if(!target_item) + target_item = source_item; + + goo_canvas_item_get_bounds(target_item, &bounds); + + highlight_item = g_object_get_data (G_OBJECT(target_item), + "highlight_item"); + + /* Create the highlight_item */ + if(!highlight_item) + highlight_item = + goo_canvas_rect_new (goo_canvas_item_get_parent(target_item), + bounds.x1 - GAP, + bounds.y1 - GAP, + bounds.x2 - bounds.x1 + GAP*2, + bounds.y2 - bounds.y1 + GAP*2, + "stroke_color_rgba", 0xFFFFFFFFL, + "fill_color_rgba", 0xFF000090L, + "line-width", (double) 2, + "radius-x", (double) 10, + "radius-y", (double) 10, + NULL); + + g_object_set_data (G_OBJECT(target_item), "highlight_item", + highlight_item); + goo_canvas_item_lower(highlight_item, target_item); + g_object_set (highlight_item, + "visibility", GOO_CANVAS_ITEM_INVISIBLE, + NULL); + + g_signal_connect(source_item, "enter_notify_event", + (GtkSignalFunc) gc_item_focus_event, + target_item); + g_signal_connect(source_item, "leave_notify_event", + (GtkSignalFunc) gc_item_focus_event, + target_item); } /** * Set the focus of the given image (highlight or not) * */ -#define GAP 4 void gc_item_focus_set(GooCanvasItem *item, gboolean focus) { GooCanvasItem *highlight_item; highlight_item = g_object_get_data (G_OBJECT(item), "highlight_item"); - if(!highlight_item) - { - GooCanvasBounds bounds; - goo_canvas_item_get_bounds(item, &bounds); - - /* Create the highlight_item */ - highlight_item = \ - goo_canvas_rect_new (goo_canvas_item_get_parent(item), - bounds.x1 - GAP, - bounds.y1 - GAP, - bounds.x2 - bounds.x1 + GAP*2, - bounds.y2 - bounds.y1 + GAP*2, - "stroke_color_rgba", 0xFFFFFFFFL, - "fill_color_rgba", 0xFF000090L, - "line-width", (double) 2, - "radius-x", (double) 10, - "radius-y", (double) 10, - NULL); - g_object_set_data (G_OBJECT(item), "highlight_item", highlight_item); - goo_canvas_item_lower(highlight_item, item); - } + g_assert(highlight_item); switch (focus) { @@ -244,10 +263,10 @@ gint gc_item_focus_event(GooCanvasItem *item, GooCanvasItem *target, GdkEvent *event, - GooCanvasItem *dest_item) + GooCanvasItem *target_item) { - if(dest_item != NULL) - item = dest_item; + if(target_item != NULL) + item = target_item; switch (event->type) { @@ -462,10 +481,6 @@ goo_canvas_item_translate(item, x, y); goo_canvas_item_scale(item, ratio, ratio); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); - gdk_pixbuf_unref(pixmap); return(stars_group); Modified: branches/gcomprixogoo/src/gcompris/gameutil.h ============================================================================== --- branches/gcomprixogoo/src/gcompris/gameutil.h (original) +++ branches/gcomprixogoo/src/gcompris/gameutil.h Sat Feb 16 14:31:09 2008 @@ -44,8 +44,9 @@ GdkPixbuf *gc_pixmap_load(const gchar *filename, ...); RsvgHandle *gc_rsvg_load(const gchar *format, ...); +void gc_item_focus_init(GooCanvasItem *source_item, + GooCanvasItem *target_item); void gc_item_focus_set(GooCanvasItem *item, gboolean focus); -void gc_item_focus_free(GooCanvasItem *item, void *none); gint gc_item_focus_event(GooCanvasItem *item, GooCanvasItem *target, GdkEvent *event, GooCanvasItem *dest_item); Modified: branches/gcomprixogoo/src/gcompris/gcompris_confirm.c ============================================================================== --- branches/gcomprixogoo/src/gcompris/gcompris_confirm.c (original) +++ branches/gcomprixogoo/src/gcompris/gcompris_confirm.c Sat Feb 16 14:31:09 2008 @@ -156,7 +156,7 @@ gchar *no_text, ConfirmCallBack iscb) { - GooCanvasItem *item, *item2; + GooCanvasItem *item; GdkPixbuf *pixmap = NULL; GdkPixbuf *pixmap_cross = NULL; GdkPixbuf *pixmap_stick = NULL; @@ -247,9 +247,7 @@ (GtkSignalFunc) button_event, "/no/"); - g_signal_connect(no_button, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(no_button, NULL); // CANCEL CROSS no_cross = goo_canvas_image_new (rootitem, @@ -264,9 +262,7 @@ g_signal_connect(no_cross, "button_press_event", (GtkSignalFunc) button_event, "/no/"); - g_signal_connect(no_cross, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(no_cross, no_button); goo_canvas_text_new (rootitem, @@ -292,9 +288,7 @@ (GtkSignalFunc) button_event, "/yes/"); - g_signal_connect(yes_button, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(yes_button, NULL); // OK stick yes_stick = goo_canvas_image_new (rootitem, @@ -309,20 +303,17 @@ g_signal_connect(yes_stick, "button_press_event", (GtkSignalFunc) button_event, "/yes/"); - g_signal_connect(yes_stick, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); - + gc_item_focus_init(yes_stick, yes_button); - item2 = goo_canvas_text_new (rootitem, - yes_text, - (gdouble) button_x + gdk_pixbuf_get_width(pixmap) + button_x_int , - (gdouble) button_y + button_h/3 + 20, - -1, - GTK_ANCHOR_WEST, - "font", gc_skin_font_subtitle, - "fill-color-rgba", gc_skin_get_color("gcompris/helpfg"), - NULL); + goo_canvas_text_new (rootitem, + yes_text, + (gdouble) button_x + gdk_pixbuf_get_width(pixmap) + button_x_int , + (gdouble) button_y + button_h/3 + 20, + -1, + GTK_ANCHOR_WEST, + "font", gc_skin_font_subtitle, + "fill-color-rgba", gc_skin_get_color("gcompris/helpfg"), + NULL); confirm_displayed = TRUE; Modified: branches/gcomprixogoo/src/gcompris/help.c ============================================================================== --- branches/gcomprixogoo/src/gcompris/help.c (original) +++ branches/gcomprixogoo/src/gcompris/help.c Sat Feb 16 14:31:09 2008 @@ -167,6 +167,7 @@ g_signal_connect(item_prerequisite, "button_press_event", (GtkSignalFunc) item_event_help, "prerequisite"); + gc_item_focus_init(item_prerequisite, NULL); item_prerequisite_text = \ goo_canvas_text_new (rootitem, @@ -195,6 +196,7 @@ g_signal_connect(item_goal, "button_press_event", (GtkSignalFunc) item_event_help, "goal"); + gc_item_focus_init(item_goal, NULL); item_goal_text = goo_canvas_text_new (rootitem, _("Goal"), @@ -222,6 +224,7 @@ g_signal_connect(item_manual, "button_press_event", (GtkSignalFunc) item_event_help, "manual"); + gc_item_focus_init(item_manual, NULL); item_manual_text = goo_canvas_text_new (rootitem, _("Manual"), @@ -249,6 +252,7 @@ g_signal_connect(item_credit, "button_press_event", (GtkSignalFunc) item_event_help, "credit"); + gc_item_focus_init(item_credit, NULL); item_credit_text = goo_canvas_text_new (rootitem, _("Credit"), @@ -344,9 +348,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_help, "ok"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); item2 = goo_canvas_text_new (rootitem, _("OK"), @@ -360,9 +362,7 @@ g_signal_connect(item2, "button_press_event", (GtkSignalFunc) item_event_help, "ok"); - g_signal_connect(item2, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - item); + gc_item_focus_init(item2, item); gdk_pixbuf_unref(pixmap); gc_bar_hide(TRUE); @@ -405,8 +405,6 @@ if(item_selected) { pixmap = gc_skin_pixmap_load("button_up.png"); - /* Warning changing the image needs to update pixbuf_ref for the focus usage */ - gc_item_focus_free(item_selected, NULL); g_object_set(item_selected, "pixbuf", pixmap, NULL); @@ -418,8 +416,6 @@ } pixmap = gc_skin_pixmap_load("button_up_selected.png"); - /* Warning changing the image needs to update pixbuf_ref for the focus usage */ - gc_item_focus_free(item, NULL); g_object_set(item, "pixbuf", pixmap, NULL); Modified: branches/gcomprixogoo/src/gcompris/images_selector.c ============================================================================== --- branches/gcomprixogoo/src/gcompris/images_selector.c (original) +++ branches/gcomprixogoo/src/gcompris/images_selector.c Sat Feb 16 14:31:09 2008 @@ -307,9 +307,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_images_selector, "/ok/"); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); item2 = goo_canvas_text_new (rootitem, _("OK"), @@ -323,9 +321,7 @@ g_signal_connect(item2, "button_press_event", (GtkSignalFunc) item_event_images_selector, "/ok/"); - g_signal_connect(item2, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - item); + gc_item_focus_init(item2, item); gdk_pixbuf_unref(pixmap); } @@ -398,9 +394,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_images_selector, imagename); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); ix += IMAGE_WIDTH + IMAGE_GAP; if(ix >= DRAWING_AREA_X2 - DRAWING_AREA_X1 - IMAGE_GAP) @@ -453,9 +447,7 @@ g_signal_connect(item, "button_press_event", (GtkSignalFunc) item_event_imageset_selector, imagename); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); isy += LIST_IMAGE_HEIGHT + IMAGE_GAP; Modified: branches/gcomprixogoo/src/magic_hat_minus-activity/magic_hat.c ============================================================================== --- branches/gcomprixogoo/src/magic_hat_minus-activity/magic_hat.c (original) +++ branches/gcomprixogoo/src/magic_hat_minus-activity/magic_hat.c Sat Feb 16 14:31:09 2008 @@ -526,8 +526,7 @@ "button_press_event", (GtkSignalFunc) hat_event, NULL); - g_signal_connect(item, "button_press_event", - (GtkSignalFunc) gc_item_focus_event, NULL); + gc_item_focus_init(item, NULL); } } Modified: branches/gcomprixogoo/src/paratrooper-activity/paratrooper.c ============================================================================== --- branches/gcomprixogoo/src/paratrooper-activity/paratrooper.c (original) +++ branches/gcomprixogoo/src/paratrooper-activity/paratrooper.c Sat Feb 16 14:31:09 2008 @@ -338,9 +338,7 @@ g_signal_connect(planeitem, "button-press-event", (GtkSignalFunc) item_event, NULL); - g_signal_connect(planeitem, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(planeitem, NULL); g_object_unref(svg_handle); windspeed = (3 + rand() % (100 * gcomprisBoard->level) / 100); @@ -406,9 +404,6 @@ g_signal_connect(paratrooperItem.paratrooper, "button-press-event", (GtkSignalFunc) item_event, NULL); - g_signal_connect(paratrooperItem.paratrooper, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); paratrooperItem.instruct = \ goo_canvas_text_new (boardRootItem, @@ -591,6 +586,7 @@ "rsvg-handle", svg_handle, NULL); g_object_unref(svg_handle); + gc_item_focus_init(paratrooperItem.paratrooper, NULL); goo_canvas_item_get_bounds(planeitem, &bounds); Modified: branches/gcomprixogoo/src/scalesboard-activity/scale.c ============================================================================== --- branches/gcomprixogoo/src/scalesboard-activity/scale.c (original) +++ branches/gcomprixogoo/src/scalesboard-activity/scale.c Sat Feb 16 14:31:09 2008 @@ -572,8 +572,7 @@ new_item->y); gdk_pixbuf_unref(pixmap); - g_signal_connect(new_item->item, "enter_notify_event", - (GtkSignalFunc)gc_item_focus_event, NULL); + gc_item_focus_init(new_item->item, NULL); g_signal_connect(new_item->item, "button_press_event", (GtkSignalFunc)gc_drag_event, new_item); g_signal_connect(new_item->item, "button_release_event", Modified: branches/gcomprixogoo/src/tangram-activity/gtans_interface.c ============================================================================== --- branches/gcomprixogoo/src/tangram-activity/gtans_interface.c (original) +++ branches/gcomprixogoo/src/tangram-activity/gtans_interface.c Sat Feb 16 14:31:09 2008 @@ -117,18 +117,13 @@ (GtkSignalFunc) on_arrow_clicked, (gpointer) FALSE); - g_signal_connect(previous_figure, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(previous_figure, NULL); g_signal_connect(next_figure, "button_press_event", (GtkSignalFunc) on_arrow_clicked, (gpointer) TRUE); - g_signal_connect(next_figure, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); - + gc_item_focus_init(next_figure, NULL); pixmap_show = gc_pixmap_load("tangram/gtans_show.png"); @@ -154,13 +149,9 @@ (GtkSignalFunc) on_show_clicked, NULL); - g_signal_connect(outline_figure, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(outline_figure, NULL); - g_signal_connect(show_figure, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(show_figure, NULL); pixmap_symetry = gc_pixmap_load("tangram/tool-flip.png"); @@ -175,9 +166,7 @@ (GtkSignalFunc) on_symetry_clicked, NULL); - g_signal_connect(symetry, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(symetry, NULL); /* rotation buttons */ @@ -231,34 +220,25 @@ (GtkSignalFunc) on_rotation_clicked, (gpointer) 0); - g_signal_connect(r_rot_s, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(r_rot_s, NULL); g_signal_connect(l_rot_s, "button_press_event", (GtkSignalFunc) on_rotation_clicked, (gpointer) 1); - g_signal_connect(l_rot_s, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(l_rot_s, NULL); g_signal_connect(r_rot_b, "button_press_event", (GtkSignalFunc) on_rotation_clicked, (gpointer) 2); - g_signal_connect(r_rot_b, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(r_rot_b, NULL); g_signal_connect(l_rot_b, "button_press_event", (GtkSignalFunc) on_rotation_clicked, (gpointer) 3); - g_signal_connect(l_rot_b, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); - + gc_item_focus_init(l_rot_b, NULL); } Modified: branches/gcomprixogoo/src/tangram-activity/resources/tangram/Makefile.am ============================================================================== --- branches/gcomprixogoo/src/tangram-activity/resources/tangram/Makefile.am (original) +++ branches/gcomprixogoo/src/tangram-activity/resources/tangram/Makefile.am Sat Feb 16 14:31:09 2008 @@ -7,6 +7,7 @@ gtans_outline.png \ gtans_rotate-left.png \ gtans_rotate.png \ - gtans_show.png + gtans_show.png \ + tool-flip.png EXTRA_DIST = $(img_DATA) Modified: branches/gcomprixogoo/src/wordprocessor-activity/wordprocessor.c ============================================================================== --- branches/gcomprixogoo/src/wordprocessor-activity/wordprocessor.c (original) +++ branches/gcomprixogoo/src/wordprocessor-activity/wordprocessor.c Sat Feb 16 14:31:09 2008 @@ -371,9 +371,8 @@ gdk_pixbuf_unref(pixmap); g_signal_connect(item, "button_press_event", (GtkSignalFunc) save_event, buffer); - g_signal_connect(item, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); + /* * The load button @@ -388,9 +387,8 @@ gdk_pixbuf_unref(pixmap); g_signal_connect(item, "button_press_event", (GtkSignalFunc) load_event, buffer); - g_signal_connect(item, "enter_notify_event", - (GtkSignalFunc) gc_item_focus_event, - NULL); + gc_item_focus_init(item, NULL); + y += 45; /* _______________________________________________ SVN-commits-list mailing list (read only) http://mail.gnome.org/mailman/listinfo/svn-commits-list Want to limit the commits to a few modules? Go to above URL, log in to edit your options and select the modules ('topics') you want. Module maintainer? It is possible to set the reply-to to your development mailing list. Email [EMAIL PROTECTED] if interested.