2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001 Sun Microsystems Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
26 #include <X11/XKBlib.h> /* AccessX control defs */
31 static XkbDescPtr xkb;
38 } AccessXControlStruct;
41 gui_exit(GtkButton *notused, void *alsonotused)
47 toggle_xkb_control (GtkButton *toggle_button, AccessXControlStruct *control_struct)
49 gboolean is_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle_button));
50 XkbChangeEnabledControls (GDK_DISPLAY(), XkbUseCoreKbd, control_struct->mask,
51 is_active ? control_struct->mask : 0);
55 toggle_xkb_notify_control (GtkButton *toggle_button, AccessXControlStruct *control_struct)
57 gboolean is_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle_button));
58 unsigned short mask, always_off_mask;
59 XkbChangeEnabledControls (GDK_DISPLAY(), XkbUseCoreKbd, XkbAccessXFeedbackMask | XkbAudibleBellMask,
60 XkbAccessXFeedbackMask | XkbAudibleBellMask);
62 mask = XkbAX_TwoKeysMask | XkbAX_LatchToLockMask | XkbAX_DumbBellFBMask;
63 always_off_mask = XkbAX_SKPressFBMask | XkbAX_SKReleaseFBMask;
66 xkb->ctrls->ax_options |= (control_struct->mask | mask);
68 xkb->ctrls->ax_options &= (~control_struct->mask);
70 xkb->ctrls->ax_options &= ~always_off_mask;
72 XkbSetControls (GDK_DISPLAY(), XkbAccessXFeedbackMask, xkb);
76 toggle_accessx (GtkButton *toggle_button, void *unused)
78 gboolean is_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle_button));
79 XkbChangeEnabledControls (GDK_DISPLAY(), XkbUseCoreKbd, XkbAllBooleanCtrlsMask,
80 (is_active) ? xkb->ctrls->enabled_ctrls : 0);
81 /*if (is_active/) XkbSetControls (GDK_DISPLAY(), XkbAllBooleanCtrlsMask, xkb);*/
85 set_accessx_control_value (GtkRange *range_control, AccessXControlStruct *control_struct)
87 *(control_struct->val) = (short int) gtk_range_get_value (range_control);
88 XkbSetControls (GDK_DISPLAY(), control_struct->mask, xkb);
94 int opcode, xkb_event_code, error, result, major, minor;
96 result = XkbQueryExtension (GDK_DISPLAY(), &opcode, &xkb_event_code, &error, &major, &minor);
97 if (result != True) return False;
99 xkb = XkbGetMap(GDK_DISPLAY(), 0, XkbUseCoreKbd);
100 if ((int)xkb == BadAlloc || xkb == NULL)
106 status = XkbGetControls(GDK_DISPLAY(), XkbAllControlsMask, xkb);
107 if (status != Success)
109 XkbFreeKeyboard(xkb, XkbAllControlsMask, True);
116 XkbFreeKeyboard(xkb, XkbAllControlsMask, True);
125 static AccessXControlStruct *control_struct_new (unsigned int mask,
130 AccessXControlStruct *control = g_new0 (AccessXControlStruct, 1);
131 control->mask = mask;
132 control->val = val_ptr;
133 control->label = label;
134 control->val_label = val_label;
141 GtkWidget *hbox, *outer_vbox, *vbox, *label, *button, *range, *frame;
142 GtkAdjustment *adjustment;
143 AccessXControlStruct *control;
145 outer_vbox = gtk_widget_new (GTK_TYPE_VBOX,
146 "GtkWidget::visible", TRUE,
149 hbox = gtk_widget_new (GTK_TYPE_HBOX,
150 "GtkWidget::parent", outer_vbox,
151 "GtkWidget::visible", TRUE,
154 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
155 "GtkButton::label", "Enable AccessX",
156 "GtkWidget::parent", hbox,
157 "GtkWidget::visible", TRUE,
160 toggle_accessx, NULL,
163 /* FeatureFBMask seems not to work :-(
165 control = control_struct_new (XkbAX_FeatureFBMask, &xkb->ctrls->ax_options, NULL, NULL);
167 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
168 "GtkButton::label", "Notify Changes",
169 "GtkWidget::parent", hbox,
170 "GtkWidget::visible", TRUE,
173 toggle_xkb_notify_control, control,
177 gtk_widget_new (GTK_TYPE_HSEPARATOR,
178 "GtkWidget::parent", outer_vbox,
179 "GtkWidget::visible", TRUE,
182 hbox = gtk_widget_new (GTK_TYPE_HBOX,
183 "GtkWidget::parent", outer_vbox,
184 "GtkWidget::visible", TRUE,
187 control = control_struct_new (XkbStickyKeysMask, &xkb->ctrls->enabled_ctrls, NULL, NULL);
189 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
190 "GtkButton::label", "Sticky Keys",
191 "GtkWidget::parent", hbox,
192 "GtkWidget::visible", TRUE,
195 toggle_xkb_control, control,
198 control = control_struct_new (XkbAX_StickyKeysFBMask, &xkb->ctrls->ax_options, NULL, NULL);
200 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
201 "GtkButton::label", "Beep when Latched",
202 "GtkWidget::parent", hbox,
203 "GtkWidget::visible", TRUE,
206 toggle_xkb_notify_control, control,
209 frame = gtk_widget_new (gtk_frame_get_type(),
210 "GtkFrame::label", "Slow Keys",
211 "GtkWidget::parent", outer_vbox,
212 "GtkWidget::visible", TRUE,
215 vbox = gtk_widget_new (GTK_TYPE_VBOX,
216 "GtkWidget::parent", frame,
217 "GtkWidget::visible", TRUE,
220 hbox = gtk_widget_new (GTK_TYPE_HBOX,
221 "GtkWidget::parent", vbox,
222 "GtkWidget::visible", TRUE,
225 control = control_struct_new (XkbSlowKeysMask, &xkb->ctrls->slow_keys_delay, NULL, NULL);
227 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
228 "GtkButton::label", "Enable Slow Keys",
229 "GtkWidget::parent", hbox,
230 "GtkWidget::visible", TRUE,
233 toggle_xkb_control, control,
236 adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (1.0, 1.0, 2000.0, 1.0, 10.0, 1.0 ));
238 range = g_object_connect (gtk_widget_new (GTK_TYPE_HSCALE,
239 "GtkWidget::parent", hbox,
240 "GtkWidget::visible", TRUE,
241 "GtkRange::update_policy", GTK_UPDATE_DELAYED,
242 "GtkScale::digits", 0,
243 "GtkScale::adjustment", adjustment,
245 "signal::spi_value_changed",
246 set_accessx_control_value, control,
249 gtk_widget_set_usize (GTK_WIDGET (range), 150, -1);
251 label = gtk_widget_new (GTK_TYPE_LABEL,
252 "GtkLabel::label", "Delay (mS)",
253 "GtkWidget::parent", hbox,
254 "GtkWidget::visible", TRUE,
257 hbox = gtk_widget_new (GTK_TYPE_HBOX,
258 "GtkWidget::parent", vbox,
259 "GtkWidget::visible", TRUE,
262 control = control_struct_new (XkbAX_SKAcceptFBMask, &xkb->ctrls->ax_options, NULL, NULL);
264 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
265 "GtkButton::label", "Beep on Accept",
266 "GtkWidget::parent", hbox,
267 "GtkWidget::visible", TRUE,
270 toggle_xkb_notify_control, control,
273 control = control_struct_new (XkbAX_SKRejectFBMask, &xkb->ctrls->ax_options, NULL, NULL);
275 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
276 "GtkButton::label", "Beep on Reject",
277 "GtkWidget::parent", hbox,
278 "GtkWidget::visible", TRUE,
281 toggle_xkb_notify_control, control,
284 frame = gtk_widget_new (gtk_frame_get_type(),
285 "GtkFrame::label", "Bounce Keys",
286 "GtkWidget::parent", outer_vbox,
287 "GtkWidget::visible", TRUE,
290 vbox = gtk_widget_new (GTK_TYPE_VBOX,
291 "GtkWidget::parent", frame,
292 "GtkWidget::visible", TRUE,
295 hbox = gtk_widget_new (GTK_TYPE_HBOX,
296 "GtkWidget::parent", vbox,
297 "GtkWidget::visible", TRUE,
300 control = control_struct_new (XkbBounceKeysMask, &xkb->ctrls->debounce_delay, NULL, NULL);
302 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
303 "GtkButton::label", "Enable Key Debounce",
304 "GtkWidget::parent", hbox,
305 "GtkWidget::visible", TRUE,
308 toggle_xkb_control, control,
311 adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (1.0, 1.0, 2000.0, 1.0, 10.0, 1.0 ));
313 range = g_object_connect (gtk_widget_new (GTK_TYPE_HSCALE,
314 "GtkWidget::parent", hbox,
315 "GtkWidget::visible", TRUE,
316 "GtkRange::update_policy", GTK_UPDATE_DELAYED,
317 "GtkScale::digits", 0,
318 "GtkScale::adjustment", adjustment,
320 "signal::spi_value_changed",
321 set_accessx_control_value, control,
324 gtk_widget_set_usize (GTK_WIDGET (range), 150, -1);
326 label = gtk_widget_new (GTK_TYPE_LABEL,
327 "GtkLabel::label", "Delay (mS)",
328 "GtkWidget::parent", hbox,
329 "GtkWidget::visible", TRUE,
332 hbox = gtk_widget_new (GTK_TYPE_HBOX,
333 "GtkWidget::parent", vbox,
334 "GtkWidget::visible", TRUE,
337 control = control_struct_new (XkbAX_BKRejectFBMask, &xkb->ctrls->ax_options, NULL, NULL);
339 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
340 "GtkButton::label", "Beep on Reject",
341 "GtkWidget::parent", hbox,
342 "GtkWidget::visible", TRUE,
345 toggle_xkb_notify_control, control,
354 GtkWidget *outer_hbox, *hbox, *vbox, *label, *button, *range, *frame;
355 GtkAdjustment *adjustment;
356 AccessXControlStruct *control =
357 control_struct_new (XkbRepeatKeysMask, &xkb->ctrls->repeat_delay, NULL, NULL);
359 frame = gtk_widget_new (gtk_frame_get_type(),
360 "GtkFrame::label","Repeat Keys",
361 "GtkWidget::visible", TRUE,
364 outer_hbox = gtk_widget_new (GTK_TYPE_HBOX,
365 "GtkWidget::visible", TRUE,
366 "GtkWidget::parent", frame,
369 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
370 "GtkButton::label", "Enable RepeatKeys",
371 "GtkWidget::parent", outer_hbox,
372 "GtkWidget::visible", TRUE,
375 toggle_xkb_control, control,
378 gtk_box_set_child_packing (GTK_BOX (outer_hbox), button, FALSE, FALSE, 0, GTK_PACK_START);
381 vbox = gtk_widget_new (GTK_TYPE_VBOX,
382 "GtkWidget::visible", TRUE,
383 "GtkWidget::parent", outer_hbox,
386 adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (200.0, 200.0, 4000.0, 10.0, 100.0, 10.0 ));
388 range = g_object_connect (gtk_widget_new (GTK_TYPE_HSCALE,
389 "GtkWidget::parent", vbox,
390 "GtkWidget::visible", TRUE,
391 "GtkRange::update_policy", GTK_UPDATE_DELAYED,
392 "GtkScale::digits", 0,
393 "GtkScale::adjustment", adjustment,
395 "signal::spi_value_changed",
396 set_accessx_control_value, control,
399 gtk_widget_set_usize (GTK_WIDGET (range), 150, -1);
401 adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (200.0, 40.0, 4000.0, 1.0, 10.0, 1.0 ));
403 control = control_struct_new (XkbRepeatKeysMask, &xkb->ctrls->repeat_interval, NULL, NULL);
405 range = g_object_connect (gtk_widget_new (GTK_TYPE_HSCALE,
406 "GtkWidget::parent", vbox,
407 "GtkWidget::visible", TRUE,
408 "GtkRange::update_policy", GTK_UPDATE_DELAYED,
409 "GtkScale::digits", 0,
410 "GtkScale::adjustment", adjustment,
412 "signal::spi_value_changed",
413 set_accessx_control_value, control,
416 gtk_widget_set_usize (GTK_WIDGET (range), 150, -1);
418 vbox = gtk_widget_new (GTK_TYPE_VBOX,
419 "GtkWidget::visible", TRUE,
420 "GtkWidget::parent", outer_hbox,
423 label = gtk_widget_new (GTK_TYPE_LABEL,
424 "GtkLabel::label", "Delay (mS)",
425 "GtkWidget::parent", vbox,
426 "GtkWidget::visible", TRUE,
429 label = gtk_widget_new (GTK_TYPE_LABEL,
430 "GtkLabel::label", "Interval (mS)",
431 "GtkWidget::parent", vbox,
432 "GtkWidget::visible", TRUE,
441 GtkWidget *outer_hbox, *hbox, *vbox, *label, *button, *range, *frame;
442 GtkAdjustment *adjustment;
443 AccessXControlStruct *control =
444 control_struct_new (XkbMouseKeysMask, &xkb->ctrls->mk_delay, NULL, NULL);
446 frame = gtk_widget_new (gtk_frame_get_type(),
447 "GtkFrame::label","Mouse Keys",
448 "GtkWidget::visible", TRUE,
451 outer_hbox = gtk_widget_new (GTK_TYPE_HBOX,
452 "GtkWidget::visible", TRUE,
453 "GtkWidget::parent", frame,
456 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
457 "GtkButton::label", "Enable MouseKeys",
458 "GtkWidget::parent", outer_hbox,
459 "GtkWidget::visible", TRUE,
462 toggle_xkb_control, control,
465 gtk_box_set_child_packing (GTK_BOX (outer_hbox), button, FALSE, FALSE, 0, GTK_PACK_START);
467 vbox = gtk_widget_new (GTK_TYPE_VBOX,
468 "GtkWidget::visible", TRUE,
469 "GtkWidget::parent", outer_hbox,
472 adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (200.0, 20.0, 4000.0, 10.0, 100.0, 10.0 ));
474 control = control_struct_new (XkbRepeatKeysMask, &xkb->ctrls->mk_interval, NULL, NULL);
476 range = g_object_connect (gtk_widget_new (GTK_TYPE_HSCALE,
477 "GtkWidget::parent", vbox,
478 "GtkWidget::visible", TRUE,
479 "GtkRange::update_policy", GTK_UPDATE_DELAYED,
480 "GtkScale::digits", 0,
481 "GtkScale::adjustment", adjustment,
483 "signal::spi_value_changed",
484 set_accessx_control_value, control,
487 gtk_widget_set_usize (GTK_WIDGET (range), 150, -1);
489 adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (800.0, 200.0, 4000.0, 1.0, 10.0, 1.0 ));
491 control = control_struct_new (XkbRepeatKeysMask, &xkb->ctrls->mk_time_to_max, NULL, NULL);
493 range = g_object_connect (gtk_widget_new (GTK_TYPE_HSCALE,
494 "GtkWidget::parent", vbox,
495 "GtkWidget::visible", TRUE,
496 "GtkRange::update_policy", GTK_UPDATE_DELAYED,
497 "GtkScale::digits", 0,
498 "GtkScale::adjustment", adjustment,
500 "signal::spi_value_changed",
501 set_accessx_control_value, control,
504 gtk_widget_set_usize (GTK_WIDGET (range), 150, -1);
506 adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (800.0, 200.0, 4000.0, 1.0, 10.0, 1.0 ));
508 control = control_struct_new (XkbMouseKeysMask, &xkb->ctrls->mk_max_speed, NULL, NULL);
510 range = g_object_connect (gtk_widget_new (GTK_TYPE_HSCALE,
511 "GtkWidget::parent", vbox,
512 "GtkWidget::visible", TRUE,
513 "GtkRange::update_policy", GTK_UPDATE_DELAYED,
514 "GtkScale::digits", 0,
515 "GtkScale::adjustment", adjustment,
517 "signal::spi_value_changed",
518 set_accessx_control_value, control,
521 gtk_widget_set_usize (GTK_WIDGET (range), 150, -1);
523 adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (800.0, 200.0, 4000.0, 1.0, 10.0, 1.0 ));
525 control = control_struct_new (XkbMouseKeysMask, &xkb->ctrls->mk_curve, NULL, NULL);
527 range = g_object_connect (gtk_widget_new (GTK_TYPE_HSCALE,
528 "GtkWidget::parent", vbox,
529 "GtkWidget::visible", TRUE,
530 "GtkRange::update_policy", GTK_UPDATE_DELAYED,
531 "GtkScale::digits", 0,
532 "GtkScale::adjustment", adjustment,
534 "signal::spi_value_changed",
535 set_accessx_control_value, control,
538 vbox = gtk_widget_new (gtk_vbox_get_type(),
539 "GtkWidget::name", "MouseKeys",
540 "GtkWidget::parent", outer_hbox,
541 "GtkWidget::visible", TRUE,
542 "GtkContainer::border_width", 5,
544 label = gtk_widget_new (GTK_TYPE_LABEL,
545 "GtkLabel::label", "Delay (mS)",
546 "GtkWidget::parent", vbox,
547 "GtkWidget::visible", TRUE,
550 label = gtk_widget_new (GTK_TYPE_LABEL,
551 "GtkLabel::label", "Accel. time (mS)",
552 "GtkWidget::parent", vbox,
553 "GtkWidget::visible", TRUE,
556 label = gtk_widget_new (GTK_TYPE_LABEL,
557 "GtkLabel::label", "Interval (mS)",
558 "GtkWidget::parent", vbox,
559 "GtkWidget::visible", TRUE,
562 label = gtk_widget_new (GTK_TYPE_LABEL,
563 "GtkLabel::label", "Max. Speed",
564 "GtkWidget::parent", vbox,
565 "GtkWidget::visible", TRUE,
568 label = gtk_widget_new (GTK_TYPE_LABEL,
569 "GtkLabel::label", "Curve",
570 "GtkWidget::parent", vbox,
571 "GtkWidget::visible", TRUE,
579 GtkWidget *outer_hbox, *hbox, *vbox, *label, *button, *range;
580 GtkAdjustment *adjustment;
581 AccessXControlStruct *control =
582 control_struct_new (XkbAccessXTimeoutMask, &xkb->ctrls->ax_timeout, NULL, NULL);
584 hbox = gtk_widget_new (gtk_hbox_get_type(),
585 "GtkWidget::visible", TRUE,
588 button = g_object_connect (gtk_widget_new (GTK_TYPE_CHECK_BUTTON,
589 "GtkButton::label", "AccessX Timeout",
590 "GtkWidget::parent", hbox,
591 "GtkWidget::visible", TRUE,
594 toggle_xkb_control, control,
597 adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (1.0, 1.0, 200.0, 1.0, 10.0, 1.0 ));
599 range = g_object_connect (gtk_widget_new (GTK_TYPE_HSCALE,
600 "GtkWidget::parent", hbox,
601 "GtkWidget::visible", TRUE,
602 "GtkRange::update_policy", GTK_UPDATE_DELAYED,
603 "GtkScale::digits", 0,
604 "GtkScale::adjustment", adjustment,
606 "signal::spi_value_changed",
607 set_accessx_control_value, control,
610 gtk_widget_set_usize (GTK_WIDGET (range), 150, -1);
612 label = gtk_widget_new (GTK_TYPE_LABEL,
613 "GtkLabel::label", "AccessX Timeout (Min.)",
614 "GtkWidget::parent", hbox,
615 "GtkWidget::visible", TRUE,
624 GtkWidget *window, *button, *container, *hbox;
626 window = g_object_connect (gtk_widget_new (gtk_window_get_type (),
629 "type", GTK_WINDOW_TOPLEVEL,
630 "window-position", GTK_WIN_POS_CENTER,
633 "allow_shrink", TRUE,
636 "signal::destroy", gui_exit, NULL,
639 container = gtk_widget_new (GTK_TYPE_VBOX,
640 "GtkWidget::parent", window,
641 "GtkWidget::visible", TRUE,
644 /* create and add containers for: AccessX on/off,
646 MouseKeys support, and timeout */
648 gtk_container_add (GTK_CONTAINER (container), basic_toggles_box ());
649 gtk_container_add (GTK_CONTAINER (container), repeat_keys_box ());
650 /* gtk_container_add (GTK_CONTAINER (container), mouse_keys_box ());
651 gtk_container_add (GTK_CONTAINER (container), timeout_box ());*/
653 hbox = gtk_widget_new (gtk_hbox_get_type(),
654 "GtkWidget::parent", container,
655 "GtkWidget::visible", TRUE,
656 "GtkContainer::border_width", 5,
659 button = g_object_connect (gtk_widget_new (gtk_button_get_type (),
660 "GtkButton::label", "Quit",
661 "GtkWidget::parent", hbox,
662 "GtkWidget::visible", TRUE,
668 gtk_widget_show (window);
674 GtkWidget *window, *button, *container, *hbox, *vbox, *range, *frame, *label;
675 GtkAdjustment *adjustment;
677 static AccessXControlStruct* controls[N_CONTROLS];
678 controls[0] = control_struct_new (XkbSlowKeysMask, &xkb->ctrls->slow_keys_delay, "Slow Keys", "Delay, mS");
679 controls[1] = control_struct_new (XkbStickyKeysMask, &xkb->ctrls->ax_options, "Sticky Keys", NULL);
680 controls[2] = control_struct_new (XkbBounceKeysMask, &xkb->ctrls->debounce_delay, "Key Debounce", "Delay, mS");
681 controls[3] = control_struct_new (XkbRepeatKeysMask, &xkb->ctrls->repeat_delay, "Repeat Keys", "Delay, mS");
682 controls[4] = control_struct_new (XkbRepeatKeysMask, &xkb->ctrls->repeat_interval, NULL, "Interval, mS");
683 controls[5] = control_struct_new (XkbMouseKeysMask, &xkb->ctrls->mk_delay, "MouseKeys", "Delay, mS");
684 controls[6] = control_struct_new (XkbMouseKeysAccelMask, &xkb->ctrls->mk_time_to_max, NULL, "Accel");
685 controls[7] = control_struct_new (XkbAccessXTimeoutMask, &xkb->ctrls->ax_timeout, "AccessX timeout", "Sec");
689 hbox = gtk_widget_new (gtk_hbox_get_type(),
690 "GtkWidget::parent", container,
691 "GtkWidget::visible", TRUE,
694 button = g_object_connect (gtk_widget_new (gtk_check_button_get_type (),
695 "GtkButton::label", "Access X Timeout",
696 "GtkWidget::parent", hbox,
697 "GtkWidget::visible", TRUE,
700 toggle_xkb_control, controls[i],
703 adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (1.0, 1.0, 200.0, 1.0, 10.0, 1.0 ));
705 range = g_object_connect (gtk_widget_new (gtk_hscale_get_type (),
706 "GtkWidget::parent", hbox,
707 "GtkWidget::visible", TRUE,
708 "GtkScale::adjustment", adjustment,
710 "signal::spi_value_changed",
711 set_accessx_control_value, controls[i],
714 gtk_widget_set_usize (GTK_WIDGET (range), 150, -1);
715 gtk_widget_new (gtk_label_get_type(),
716 "GtkWidget::parent", hbox,
717 "GtkLabel::label", controls[i]->val_label,
718 "GtkWidget::visible", TRUE,
721 hbox = gtk_widget_new (gtk_hbox_get_type(),
722 "GtkWidget::parent", container,
723 "GtkWidget::visible", TRUE,
724 "GtkContainer::border_width", 5,
727 button = g_object_connect (gtk_widget_new (gtk_button_get_type (),
728 "GtkButton::label", "Quit",
729 "GtkWidget::parent", hbox,
730 "GtkWidget::visible", TRUE,
736 gtk_widget_show (window);
740 main(int argc, char **argv)
743 if ((argc > 1) && (!strncmp(argv[1],"-h",2)))
745 printf ("Usage: keysynth-demo\n");
749 gtk_init (&argc, &argv); /* must call, because this program uses GTK+ */
753 g_error ("Xkb extension not present, can't initialize accessX\n");