--- gnome-control-center/capplets/keyboard/ChangeLog-bak	Fri May 10 23:30:06 2002
+++ gnome-control-center/capplets/keyboard/ChangeLog	Sun May 12 17:22:38 2002
@@ -0,0 +1,6 @@
+2002-05-12  Pier Luigi Fiorini  <plfiorini@supereva.it>
+
+	* gnome-keyboard-properties.glade: Added a frame for NumLock
+	preferences.
+	* gnome-keyboard-properties.c
+
--- gnome-control-center/capplets/keyboard/gnome-keyboard-properties.glade-bak	Fri May 10 23:30:06 2002
+++ gnome-control-center/capplets/keyboard/gnome-keyboard-properties.glade	Sun May 12 17:53:55 2002
@@ -79,10 +79,85 @@
 	      <property name="spacing">4</property>
 
 	      <child>
+		<widget class="GtkFrame" id="frame6">
+		  <property name="visible">True</property>
+		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
+		  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox8">
+		      <property name="border_width">8</property>
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">8</property>
+
+		      <child>
+			<widget class="GtkImage" id="numlock_image">
+			  <property name="visible">True</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkCheckButton" id="numlock_toggle">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="label" translatable="yes">_Activate NumLock at startup</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</property>
+			  <property name="active">False</property>
+			  <property name="inconsistent">False</property>
+			  <property name="draw_indicator">True</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label19">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">NumLock</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="type">label_item</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+
+	      <child>
 		<widget class="GtkFrame" id="frame3">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">Repeat Rate</property>
 		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
 		  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 		  <child>
@@ -166,6 +241,7 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="mnemonic_widget">repeat_delay_omenu</property>
 				</widget>
 				<packing>
 				  <property name="left_attach">0</property>
@@ -190,6 +266,7 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="mnemonic_widget">repeat_speed_omenu</property>
 				</widget>
 				<packing>
 				  <property name="left_attach">0</property>
@@ -214,61 +291,25 @@
 				      <child>
 					<widget class="GtkMenuItem" id="convertwidget2">
 					  <property name="visible">True</property>
-					  <child>
-					    <widget class="GtkAccelLabel" id="convertwidget6">
-					      <property name="label" translatable="yes">Very long</property>
-					      <property name="xalign">0.0</property>
-					      <property name="accel-widget">convertwidget2</property>
-					      <property name="use-underline">yes</property>
-					      <property name="visible">yes</property>
-					    </widget> 
-					  </child> 
-					</widget> 
+					</widget>
 				      </child>
 
 				      <child>
 					<widget class="GtkMenuItem" id="convertwidget3">
 					  <property name="visible">True</property>
-					  <child>
-					    <widget class="GtkAccelLabel" id="convertwidget7">
-					      <property name="label" translatable="yes">Long</property>
-					      <property name="xalign">0.0</property>
-					      <property name="accel-widget">convertwidget3</property>
-					      <property name="use-underline">yes</property>
-					      <property name="visible">yes</property>
-					    </widget> 
-					  </child> 
-					</widget> 
+					</widget>
 				      </child>
 
 				      <child>
 					<widget class="GtkMenuItem" id="convertwidget4">
 					  <property name="visible">True</property>
-					  <child>
-					    <widget class="GtkAccelLabel" id="convertwidget8">
-					      <property name="label" translatable="yes">Medium</property>
-					      <property name="xalign">0.0</property>
-					      <property name="accel-widget">convertwidget4</property>
-					      <property name="use-underline">yes</property>
-					      <property name="visible">yes</property>
-					    </widget> 
-					  </child> 
-					</widget> 
+					</widget>
 				      </child>
 
 				      <child>
 					<widget class="GtkMenuItem" id="convertwidget5">
 					  <property name="visible">True</property>
-					  <child>
-					    <widget class="GtkAccelLabel" id="convertwidget9">
-					      <property name="label" translatable="yes">Short</property>
-					      <property name="xalign">0.0</property>
-					      <property name="accel-widget">convertwidget5</property>
-					      <property name="use-underline">yes</property>
-					      <property name="visible">yes</property>
-					    </widget> 
-					  </child> 
-					</widget> 
+					</widget>
 				      </child>
 				    </widget>
 				  </child>
@@ -295,60 +336,24 @@
 				      <child>
 					<widget class="GtkMenuItem" id="convertwidget11">
 					  <property name="visible">True</property>
-					  <child>
-					    <widget class="GtkAccelLabel" id="convertwidget15">
-					      <property name="label" translatable="yes">Very fast</property>
-					      <property name="xalign">0.0</property>
-					      <property name="accel-widget">convertwidget11</property>
-					      <property name="use-underline">yes</property>
-					      <property name="visible">yes</property>
-					    </widget> 
-					  </child> 
 					</widget>
 				      </child>
 
 				      <child>
 					<widget class="GtkMenuItem" id="convertwidget12">
 					  <property name="visible">True</property>
-					  <child>
-					    <widget class="GtkAccelLabel" id="convertwidget16">
-					      <property name="label" translatable="yes">Fast</property>
-					      <property name="xalign">0.0</property>
-					      <property name="accel-widget">convertwidget12</property>
-					      <property name="use-underline">yes</property>
-					      <property name="visible">yes</property>
-					    </widget> 
-					  </child> 
 					</widget>
 				      </child>
 
 				      <child>
 					<widget class="GtkMenuItem" id="convertwidget13">
 					  <property name="visible">True</property>
-					  <child>
-					    <widget class="GtkAccelLabel" id="convertwidget17">
-					      <property name="label" translatable="yes">Medium</property>
-					      <property name="xalign">0.0</property>
-					      <property name="accel-widget">convertwidget13</property>
-					      <property name="use-underline">yes</property>
-					      <property name="visible">yes</property>
-					    </widget> 
-					  </child> 
 					</widget>
 				      </child>
 
 				      <child>
 					<widget class="GtkMenuItem" id="convertwidget14">
 					  <property name="visible">True</property>
-					  <child>
-					    <widget class="GtkAccelLabel" id="convertwidget18">
-					      <property name="label" translatable="yes">Slow</property>
-					      <property name="xalign">0.0</property>
-					      <property name="accel-widget">convertwidget14</property>
-					      <property name="use-underline">yes</property>
-					      <property name="visible">yes</property>
-					    </widget> 
-					  </child> 
 					</widget>
 				      </child>
 				    </widget>
@@ -379,6 +384,25 @@
 		      </child>
 		    </widget>
 		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label1">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Repeat Rate</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="type">label_item</property>
+		    </packing>
+		  </child>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
@@ -390,8 +414,8 @@
 	      <child>
 		<widget class="GtkFrame" id="frame4">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">Cursor</property>
 		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
 		  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 		  <child>
@@ -499,9 +523,6 @@
 				      <property name="yalign">0.5</property>
 				      <property name="xpad">0</property>
 				      <property name="ypad">0</property>
-				      <accessibility>
-					<atkrelation target="cursor_blink_time_scale" type="label-for"/>
-				      </accessibility>
 				    </widget>
 				    <packing>
 				      <property name="padding">0</property>
@@ -520,12 +541,6 @@
 				      <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
 				      <property name="inverted">False</property>
 				      <property name="adjustment">1000 100 2500 200 200 0</property>
-				      <accessibility>
-					<atkrelation target="slow_label" type="labelled-by"/>
-					<atkrelation target="set_cursor_label" type="labelled-by"/>
-					<atkrelation target="fast_label" type="labelled-by"/>
-					<atkrelation target="cursor_label" type="labelled-by"/>
-				      </accessibility>
 				    </widget>
 				    <packing>
 				      <property name="padding">0</property>
@@ -547,9 +562,6 @@
 				      <property name="yalign">0.5</property>
 				      <property name="xpad">0</property>
 				      <property name="ypad">0</property>
-				      <accessibility>
-					<atkrelation target="cursor_blink_time_scale" type="label-for"/>
-				      </accessibility>
 				    </widget>
 				    <packing>
 				      <property name="padding">0</property>
@@ -585,9 +597,6 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
-			      <accessibility>
-				<atkrelation target="cursor_blink_time_scale" type="label-for"/>
-			      </accessibility>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -604,6 +613,25 @@
 		      </child>
 		    </widget>
 		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label5">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Cursor</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="type">label_item</property>
+		    </packing>
+		  </child>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
@@ -615,8 +643,8 @@
 	      <child>
 		<widget class="GtkFrame" id="frame5">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">Accessibility</property>
 		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
 		  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 		  <child>
@@ -690,6 +718,25 @@
 		      </child>
 		    </widget>
 		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label6">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Accessibility</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="type">label_item</property>
+		    </packing>
+		  </child>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
@@ -733,8 +780,8 @@
 	      <child>
 		<widget class="GtkFrame" id="frame1">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">Keyclick Volume</property>
 		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
 		  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 		  <child>
@@ -935,6 +982,25 @@
 		      </child>
 		    </widget>
 		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label17">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Keyclick Volume</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="type">label_item</property>
+		    </packing>
+		  </child>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
@@ -946,8 +1012,8 @@
 	      <child>
 		<widget class="GtkFrame" id="frame2">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">Keyboard Bell</property>
 		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
 		  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 		  <child>
@@ -1130,6 +1196,25 @@
 			</packing>
 		      </child>
 		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label18">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Keyboard Bell</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="type">label_item</property>
+		    </packing>
 		  </child>
 		</widget>
 		<packing>
--- gnome-control-center/capplets/keyboard/Makefile.am-bak	Wed Apr 10 08:08:02 2002
+++ gnome-control-center/capplets/keyboard/Makefile.am	Sun May 12 17:28:25 2002
@@ -12,6 +12,7 @@
 
 iconsdir   = $(GNOMECC_PIXMAPS_DIR)
 icons_DATA = keyboard-capplet.png	\
+	keyboard-numlock.png		\
 	keyboard-repeat.png		\
 	keyboard-cursor.png		\
 	keyboard-volume.png		\
--- gnome-control-center/capplets/keyboard/gnome-keyboard-properties.c-bak	Fri May 10 23:30:06 2002
+++ gnome-control-center/capplets/keyboard/gnome-keyboard-properties.c	Sun May 12 17:27:55 2002
@@ -256,6 +256,9 @@
 
 	/* load all the images */
 	program = gnome_program_get ();
+	filename = gnome_program_locate_file (program, GNOME_FILE_DOMAIN_APP_PIXMAP, "keyboard-numlock.png", TRUE, NULL);
+	gtk_image_set_from_file (GTK_IMAGE (WID ("numlock_image")), filename);
+	g_free (filename);
 	filename = gnome_program_locate_file (program, GNOME_FILE_DOMAIN_APP_PIXMAP, "keyboard-repeat.png", TRUE, NULL);
 	gtk_image_set_from_file (GTK_IMAGE (WID ("repeat_image")), filename);
 	g_free (filename);
@@ -268,6 +271,10 @@
 	filename = gnome_program_locate_file (program, GNOME_FILE_DOMAIN_APP_PIXMAP, "keyboard-bell.png", TRUE, NULL);
 	gtk_image_set_from_file (GTK_IMAGE (WID ("bell_image")), filename);
 	g_free (filename);
+
+	peditor = gconf_peditor_new_boolean
+		(changeset, "/desktop/gnome/peripherals/keyboard/numlock", WID ("numlock_toggle"), NULL);
+	gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("numlock_toggle"));
 
 	peditor = gconf_peditor_new_boolean
 		(changeset, "/desktop/gnome/peripherals/keyboard/repeat", WID ("repeat_toggle"), NULL);
--- gnome-control-center/gnome-settings-daemon/gnome-settings-keyboard.c-bak	Thu Apr 25 06:59:10 2002
+++ gnome-control-center/gnome-settings-daemon/gnome-settings-keyboard.c	Sun May 12 17:53:42 2002
@@ -38,7 +38,6 @@
 #endif
 #ifdef HAVE_X11_EXTENSIONS_XKB_H
 #include <X11/XKBlib.h>
-#endif
 
 #ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
 static gboolean
@@ -75,11 +74,46 @@
 #endif
 
 static void
+setup_numlock (gboolean on)
+{
+#ifdef HAVE_X11_EXTENTIONS_XKB_H
+	XkbDescPtr xkb;
+	guint mask;
+	gint i;
+
+	if ((xkb = XkbGetKeyboard (GDK_DISPLAY (), XkbAllComponentsMask, XkbUseCoreKbd)) != NULL) {
+		if (!xkb || !xkb->names)
+			return;
+
+		for (i = 0; i < XkbNumVirtualMods; i++) {
+			char *mod = XGetAtomName (xkb->dpy, xkb->names->vmods[i]);
+			if (mod != NULL && g_strcmp ("NumLock", mod) == 0) {
+				XkbVirtualModsToReal (xkb, 1 << i, &mask);
+			}
+		}
+		mask = 0;
+
+		XkbFreeKeyboard (xkb, 0, True);
+	}
+
+	if (mask == 0)
+		return;
+
+	if (on)
+		XkbLockModifiers (GDK_DISPLAY (), XkbUseCoreKbd, mask, mask);
+	else
+		XkbLockModifiers (GDK_DISPLAY (), XkbUseCoreKbd, mask, 0);
+#else
+	return;
+#endif
+}
+
+static void
 apply_settings (void)
 {
 	GConfClient *client;
 
-	gboolean repeat, click;
+	gboolean numlock, repeat, click;
 	int rate, delay;
 	int click_volume, bell_volume, bell_pitch, bell_duration;
 
@@ -87,6 +121,7 @@
 
 	client = gconf_client_get_default ();
 
+	numlock	      = gconf_client_get_bool  (client, "/desktop/gnome/peripherals/keyboard/numlock",	     NULL);
 	repeat        = gconf_client_get_bool  (client, "/desktop/gnome/peripherals/keyboard/repeat",        NULL);
 	click         = gconf_client_get_bool  (client, "/desktop/gnome/peripherals/keyboard/click",         NULL);
 	rate          = gconf_client_get_int   (client, "/desktop/gnome/peripherals/keyboard/rate",          NULL);
@@ -97,6 +132,9 @@
 	bell_duration = gconf_client_get_int   (client, "/desktop/gnome/peripherals/keyboard/bell_duration", NULL);
 
 	gdk_error_trap_push ();
+
+	setup_numlock (numlock);
+
         if (repeat) {
 		gboolean rate_set = FALSE;
 
--- gnome-control-center/gnome-settings-daemon/ChangeLog-bak	Tue Apr 30 11:45:05 2002
+++ gnome-control-center/gnome-settings-daemon/ChangeLog	Sun May 12 17:50:38 2002
@@ -0,0 +1,5 @@
+2002-05-12  Pier Luigi Fiorini  <plfiorini@supereva.it>
+
+	* gnome-settings-keyboard.c (numlock_setup): Activate/deactivate numlock.
+	* gnome-settings-keyboard.c (apply_settings): NumLock stuff.
+
