scroll the options window when the keyboard focus moves out of the visible
2008-10-26 Jens Granseuer <jensgr@gmx.net> * gnome-keyboard-properties-xkbot.c: (option_focused_cb), (xkb_options_add_option), (xkb_options_add_group): * gnome-keyboard-properties.glade: scroll the options window when the keyboard focus moves out of the visible part (bug #557944) svn path=/trunk/; revision=9120
This commit is contained in:
parent
be828108f8
commit
54ed1aef6a
3 changed files with 35 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-10-26 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
* gnome-keyboard-properties-xkbot.c: (option_focused_cb),
|
||||
(xkb_options_add_option), (xkb_options_add_group):
|
||||
* gnome-keyboard-properties.glade: scroll the options window when the
|
||||
keyboard focus moves out of the visible part (bug #557944)
|
||||
|
||||
Fri Oct 24 19:38:52 2008 Søren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* gnome-keyboard-properties.c: Don't include gnome.h
|
||||
|
|
|
@ -179,6 +179,20 @@ xkb_options_is_selected (gchar * optionname)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/* Make sure selected options stay visible when navigating with the keyboard */
|
||||
static gboolean
|
||||
option_focused_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
|
||||
{
|
||||
GtkScrolledWindow *win = GTK_SCROLLED_WINDOW (data);
|
||||
GtkAllocation *alloc = &widget->allocation;
|
||||
GtkAdjustment *adj;
|
||||
|
||||
adj = gtk_scrolled_window_get_vadjustment (win);
|
||||
gtk_adjustment_clamp_page (adj, alloc->y, alloc->y + alloc->height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Update xkb backend to reflect the new UI state */
|
||||
static void
|
||||
option_toggled_cb (GtkWidget * checkbutton, gpointer data)
|
||||
|
@ -228,6 +242,10 @@ xkb_options_add_option (XklConfigRegistry * config_registry,
|
|||
gtk_radio_button_get_group (GTK_RADIO_BUTTON
|
||||
(option_check));
|
||||
current_none_radio = option_check;
|
||||
|
||||
g_signal_connect (option_check, "focus-in-event",
|
||||
G_CALLBACK (option_focused_cb),
|
||||
WID ("options_scroll"));
|
||||
}
|
||||
option_check =
|
||||
gtk_radio_button_new_with_label (current_radio_group,
|
||||
|
@ -248,9 +266,13 @@ xkb_options_add_option (XklConfigRegistry * config_registry,
|
|||
g_object_set_data_full (G_OBJECT (option_check), OPTION_ID_PROP,
|
||||
full_option_name, g_free);
|
||||
|
||||
g_signal_connect (G_OBJECT (option_check), "toggled",
|
||||
g_signal_connect (option_check, "toggled",
|
||||
G_CALLBACK (option_toggled_cb), NULL);
|
||||
|
||||
g_signal_connect (option_check, "focus-in-event",
|
||||
G_CALLBACK (option_focused_cb),
|
||||
WID ("options_scroll"));
|
||||
|
||||
gtk_box_pack_start_defaults (GTK_BOX (current_vbox), option_check);
|
||||
|
||||
xkb_options_expander_selcounter_add (xkb_options_get_expander
|
||||
|
@ -308,6 +330,10 @@ xkb_options_add_group (XklConfigRegistry * config_registry,
|
|||
expanders_list = g_slist_append (expanders_list, expander);
|
||||
g_object_set_data (G_OBJECT (dialog), EXPANDERS_PROP,
|
||||
expanders_list);
|
||||
|
||||
g_signal_connect (expander, "focus-in-event",
|
||||
G_CALLBACK (option_focused_cb),
|
||||
WID ("options_scroll"));
|
||||
}
|
||||
|
||||
static gint
|
||||
|
|
|
@ -2003,7 +2003,7 @@
|
|||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow7">
|
||||
<widget class="GtkScrolledWindow" id="options_scroll">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="border_width">5</property>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue