[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#598864: unblock: libgnomekbd/2.30.2-1



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: freeze-exception

Hi,

please unblock libgnomekbd for squeeze.

libgnomekbd (2.30.2-1) unstable; urgency=low

  * New upstream translation and bugfix release.
  * Switch to 3.0 source format.
  * 02_layout_crash.patch: dropped, merged upstream.

Upstream changes:
        A couple of translations updated
        Proper location in NA is provided (using the icon name)
        Fixed three crashers

Attached are the upstream code changes.

Cheers,
-- 
 .''`.      Josselin Mouette
: :' :
`. `'  “If you behave this way because you are blackmailed by someone,
  `-    […] I will see what I can do for you.”  -- Jörg Schilling

--- libgnomekbd-2.30.1/libgnomekbd/gkbd-indicator.c	2010-03-28 22:27:04.000000000 +0000
+++ libgnomekbd-2.30.2/libgnomekbd/gkbd-indicator.c	2010-05-05 21:59:51.000000000 +0000
@@ -318,7 +318,7 @@
 				    gchar ** short_group_names,
 				    gchar ** full_group_names)
 {
-	char *layout_name;
+	char *layout_name = NULL;
 	if (group < g_strv_length (short_group_names)) {
 		if (xkl_engine_get_features (engine) &
 		    XKLF_MULTIPLE_LAYOUTS_SUPPORTED) {
@@ -352,7 +352,7 @@
 	}
 
 	if (layout_name == NULL)
-		layout_name = g_strdup ("??");
+		layout_name = g_strdup ("");
 
 	return layout_name;
 }
--- libgnomekbd-2.30.1/libgnomekbd/gkbd-keyboard-drawing.c	2010-03-28 22:14:54.000000000 +0000
+++ libgnomekbd-2.30.2/libgnomekbd/gkbd-keyboard-drawing.c	2010-06-22 20:33:23.000000000 +0000
@@ -1293,14 +1293,19 @@
 			(GFunc) draw_keyboard_item, &data);
 }
 
-static void
+static gboolean
 create_cairo (GkbdKeyboardDrawing * drawing)
 {
-	GtkStateType state = gtk_widget_get_state (GTK_WIDGET (drawing));
+	GtkStateType state;
+	if (drawing == NULL || drawing->pixmap == NULL)
+		return FALSE;
 	drawing->renderContext->cr =
 	    gdk_cairo_create (GDK_DRAWABLE (drawing->pixmap));
+
+	state = gtk_widget_get_state (GTK_WIDGET (drawing));
 	drawing->renderContext->dark_color =
 	    &gtk_widget_get_style (GTK_WIDGET (drawing))->dark[state];
+	return TRUE;
 }
 
 static void
@@ -1333,9 +1338,10 @@
 			    [state], TRUE, 0, 0, allocation.width,
 			    allocation.height);
 
-	create_cairo (drawing);
-	draw_keyboard_to_context (drawing->renderContext, drawing);
-	destroy_cairo (drawing);
+	if (create_cairo (drawing)) {
+		draw_keyboard_to_context (drawing->renderContext, drawing);
+		destroy_cairo (drawing);
+	}
 }
 
 static void
@@ -1498,10 +1504,12 @@
 
 	key->pressed = (event->type == GDK_KEY_PRESS);
 
-	create_cairo (drawing);
-	draw_key (drawing->renderContext, drawing, key);
-	redraw_overlapping_doodads (drawing->renderContext, drawing, key);
-	destroy_cairo (drawing);
+	if (create_cairo (drawing)) {
+		draw_key (drawing->renderContext, drawing, key);
+		redraw_overlapping_doodads (drawing->renderContext,
+					    drawing, key);
+		destroy_cairo (drawing);
+	}
 
 	invalidate_key_region (drawing, key);
 	return FALSE;
@@ -1526,16 +1534,18 @@
 	if (!drawing->xkb)
 		return FALSE;
 
-	create_cairo (drawing);
-	for (i = drawing->xkb->min_key_code;
-	     i <= drawing->xkb->max_key_code; i++)
-		if (drawing->keys[i].pressed) {
-			drawing->keys[i].pressed = FALSE;
-			draw_key (drawing->renderContext, drawing,
-				  drawing->keys + i);
-			invalidate_key_region (drawing, drawing->keys + i);
-		}
-	destroy_cairo (drawing);
+	if (create_cairo (drawing)) {
+		for (i = drawing->xkb->min_key_code;
+		     i <= drawing->xkb->max_key_code; i++)
+			if (drawing->keys[i].pressed) {
+				drawing->keys[i].pressed = FALSE;
+				draw_key (drawing->renderContext, drawing,
+					  drawing->keys + i);
+				invalidate_key_region (drawing,
+						       drawing->keys + i);
+			}
+		destroy_cairo (drawing);
+	}
 
 	return FALSE;
 }
@@ -1838,6 +1848,39 @@
 		    drawing->xkb->max_key_code + 1);
 }
 
+static void
+process_indicators_state_notify (XkbIndicatorNotifyEvent * iev,
+				 GkbdKeyboardDrawing * drawing)
+{
+	/* Good question: should we track indicators when the keyboard is
+	   NOT really taken from the screen */
+	gint i;
+
+	for (i = 0; i <= drawing->xkb->indicators->phys_indicators; i++)
+		if (drawing->physical_indicators[i] != NULL
+		    && (iev->changed & 1 << i)) {
+			gint state = (iev->state & 1 << i) != FALSE;
+
+			if ((state && !drawing->physical_indicators[i]->on)
+			    || (!state
+				&& drawing->physical_indicators[i]->on)) {
+				drawing->physical_indicators[i]->on =
+				    state;
+				if (create_cairo (drawing)) {
+					draw_doodad (drawing->
+						     renderContext,
+						     drawing,
+						     drawing->physical_indicators
+						     [i]);
+					destroy_cairo (drawing);
+				}
+				invalidate_indicator_doodad_region
+				    (drawing,
+				     drawing->physical_indicators[i]);
+			}
+		}
+}
+
 static GdkFilterReturn
 xkb_state_notify_event_filter (GdkXEvent * gdkxev,
 			       GdkEvent * event,
@@ -1879,49 +1922,11 @@
 
 		case XkbIndicatorStateNotify:
 			{
-				/* Good question: should we track indicators when the keyboard is
-				   NOT really taken from the screen */
-				XkbIndicatorNotifyEvent *iev =
-				    &((XkbEvent *) gdkxev)->indicators;
-				gint i;
-
-				for (i = 0;
-				     i <=
-				     drawing->xkb->
-				     indicators->phys_indicators; i++)
-					if (drawing->physical_indicators[i]
-					    != NULL
-					    && (iev->changed & 1 << i)) {
-						gint state =
-						    (iev->state & 1 << i)
-						    != FALSE;
-
-						if ((state
-						     &&
-						     !drawing->physical_indicators
-						     [i]->on) || (!state
-								  &&
-								  drawing->physical_indicators
-								  [i]->on))
-						{
-							drawing->physical_indicators
-							    [i]->on =
-							    state;
-							create_cairo
-							    (drawing);
-							draw_doodad
-							    (drawing->renderContext,
-							     drawing,
-							     drawing->physical_indicators
-							     [i]);
-							destroy_cairo
-							    (drawing);
-							invalidate_indicator_doodad_region
-							    (drawing,
-							     drawing->physical_indicators
-							     [i]);
-						}
-					}
+				process_indicators_state_notify (&
+								 ((XkbEvent
+								   *)
+								  gdkxev)->indicators,
+drawing);
 			}
 			break;
 
--- libgnomekbd-2.30.1/libgnomekbd/gkbd-status.c	2010-04-17 01:09:30.000000000 +0000
+++ libgnomekbd-2.30.2/libgnomekbd/gkbd-status.c	2010-06-22 20:35:03.000000000 +0000
@@ -53,8 +53,17 @@
 	gulong config_changed_handler;
 } gki_globals;
 
+static gchar *settings_signal_names[] = {
+	"notify::gtk-theme-name",
+	"notify::gtk-key-theme-name",
+	"notify::gtk-font-name",
+	"notify::font-options",
+};
+
 struct _GkbdStatusPrivate {
 	gdouble angle;
+	gulong settings_signal_handlers[sizeof (settings_signal_names) /
+					sizeof (settings_signal_names[0])];
 };
 
 /* one instance for ALL widgets */
@@ -81,9 +90,9 @@
 static void
 gkbd_status_set_current_page (GkbdStatus * gki);
 static void
-gkbd_status_cleanup (GkbdStatus * gki);
+gkbd_status_global_cleanup (GkbdStatus * gki);
 static void
-gkbd_status_fill (GkbdStatus * gki);
+gkbd_status_global_fill (GkbdStatus * gki);
 static void
 gkbd_status_set_tooltips (GkbdStatus * gki, const char *str);
 
@@ -96,7 +105,7 @@
 }
 
 void
-gkbd_status_cleanup (GkbdStatus * gki)
+gkbd_status_global_cleanup (GkbdStatus * gki)
 {
 	while (globals.icons) {
 		if (globals.icons->data)
@@ -107,7 +116,7 @@
 }
 
 void
-gkbd_status_fill (GkbdStatus * gki)
+gkbd_status_global_fill (GkbdStatus * gki)
 {
 	int grp;
 	int total_groups = xkl_engine_get_num_groups (globals.engine);
@@ -152,6 +161,7 @@
 	cairo_font_options_t *fo;
 	static GHashTable *ln2cnt_map = NULL;
 
+	xkl_debug (160, "Rendering cairo for group %d\n", group);
 	if (globals.ind_cfg.background_color != NULL &&
 	    globals.ind_cfg.background_color[0] != 0) {
 		if (sscanf
@@ -400,8 +410,8 @@
 void
 gkbd_status_reinit_ui (GkbdStatus * gki)
 {
-	gkbd_status_cleanup (gki);
-	gkbd_status_fill (gki);
+	gkbd_status_global_cleanup (gki);
+	gkbd_status_global_fill (gki);
 
 	gkbd_status_set_current_page (gki);
 }
@@ -626,11 +636,16 @@
 static void
 gkbd_status_init (GkbdStatus * gki)
 {
+	int i;
+
 	if (!g_slist_length (globals.widget_instances))
 		gkbd_status_global_init ();
 
 	gki->priv = g_new0 (GkbdStatusPrivate, 1);
 
+	/* This should give NA a hint about the order */
+	gtk_status_icon_set_name (GTK_STATUS_ICON (gki), "keyboard");
+
 	xkl_debug (100, "Initiating the widget startup process for %p\n",
 		   gki);
 
@@ -642,7 +657,7 @@
 
 	gkbd_status_set_tooltips (gki, NULL);
 
-	gkbd_status_fill (gki);
+	gkbd_status_global_fill (gki);
 	gkbd_status_set_current_page (gki);
 
 	/* append AFTER all initialization work is finished */
@@ -654,37 +669,37 @@
 	g_signal_connect (gki, "activate",
 			  G_CALLBACK (gkbd_status_activate), NULL);
 
-	g_signal_connect_after (gtk_settings_get_default (),
-				"notify::gtk-theme-name",
-				G_CALLBACK (gkbd_status_theme_changed),
-				gki);
-	g_signal_connect_after (gtk_settings_get_default (),
-				"notify::gtk-key-theme-name",
-				G_CALLBACK (gkbd_status_theme_changed),
-				gki);
-	g_signal_connect_after (gtk_settings_get_default (),
-				"notify::gtk-font-name",
-				G_CALLBACK (gkbd_status_theme_changed),
-				gki);
-	g_signal_connect_after (gdk_screen_get_default (),
-				"notify::font-options",
-				G_CALLBACK (gkbd_status_theme_changed),
-				gki);
+	for (i = sizeof (settings_signal_names) /
+	     sizeof (settings_signal_names[0]); --i >= 0;)
+		gki->priv->settings_signal_handlers[i] =
+		    g_signal_connect_after (gtk_settings_get_default (),
+					    settings_signal_names[i],
+					    G_CALLBACK
+					    (gkbd_status_theme_changed),
+					    gki);
 }
 
 static void
 gkbd_status_finalize (GObject * obj)
 {
+	int i;
 	GkbdStatus *gki = GKBD_STATUS (obj);
 	xkl_debug (100,
 		   "Starting the gnome-kbd-status widget shutdown process for %p\n",
 		   gki);
 
+	for (i = sizeof (settings_signal_names) /
+	     sizeof (settings_signal_names[0]); --i >= 0;)
+		g_signal_handler_disconnect (gtk_settings_get_default (),
+					     gki->
+					     priv->settings_signal_handlers
+					     [i]);
+
 	/* remove BEFORE all termination work is finished */
 	globals.widget_instances =
 	    g_slist_remove (globals.widget_instances, gki);
 
-	gkbd_status_cleanup (gki);
+	gkbd_status_global_cleanup (gki);
 
 	xkl_debug (100,
 		   "The instance of gnome-kbd-status successfully finalized\n");

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: