From: H.G. Muller Date: Thu, 18 Oct 2012 19:57:50 +0000 (+0200) Subject: Add access routines to checkboxes and FocusOnWidget X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=fd137f5c6464e66277c5e427c6cebca1b6527fd8;p=xboard.git Add access routines to checkboxes and FocusOnWidget The handler of the filter field needs it to return focus to the listbox. --- diff --git a/xoptions.c b/xoptions.c index 928d28d..2043e40 100644 --- a/xoptions.c +++ b/xoptions.c @@ -232,21 +232,13 @@ SetWidgetText (Option *opt, char *buf, int n) void GetWidgetState (Option *opt, int *state) { -#ifdef TODO_GTK - Arg arg; - XtSetArg(arg, XtNstate, state); - XtGetValues(opt->handle, &arg, 1); -#endif + *state = gtk_toggle_button_get_active(opt->handle); } void SetWidgetState (Option *opt, int state) { -#ifdef TODO_GTK - Arg arg; - XtSetArg(arg, XtNstate, state); - XtSetValues(opt->handle, &arg, 1); -#endif + gtk_toggle_button_set_active(opt->handle, state); } void @@ -346,6 +338,7 @@ FocusOnWidget (Option *opt, DialogClass dlg) #ifdef TODO_GTK XtSetKeyboardFocus(shells[dlg], opt->handle); #endif + gtk_widget_grab_focus(opt->handle); } void @@ -604,8 +597,8 @@ void AddHandler (Option *opt, DialogClass dlg, int nr) { switch(nr) { - case 0: - case 1: + case 0: // history (now uses generic textview callback) + case 1: // comment (likewise) case 2: break; case 3: // input box g_signal_connect(opt->handle, "key-press-event", G_CALLBACK (ICSKeyEvent), NULL); break; // Input Box