Re: GTK+ accessibility

Missing test source code is below.


PS. Sample code:

#include <gtk/gtk.h>

void create_window();

GtkWidget *window1;
GtkWidget *vbox1;
GtkWidget *menubar1;
GtkWidget *menu1;
GtkWidget *item1;

int main (int argc, char *argv[])
    gtk_init (&argc, &argv);

    GtkSettings* settings = gtk_settings_get_default();
    if (settings){
gtk_settings_set_long_property(settings, "gtk-auto-mnemonics", TRUE, NULL); gtk_settings_set_long_property(settings, "gtk-enable-mnemonics", TRUE, NULL);

    gtk_main ();
    return 0;

#ifdef _WIN32
#include <windows.h>
int APIENTRY WinMain( HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR lpCmdLine, int nCmdShow)
    return main( __argc, __argv );

void create_window()
    window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window1), "test");
    gtk_widget_show (window1);
g_signal_connect (window1, "destroy", G_CALLBACK (gtk_main_quit), NULL);

    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox1);
    gtk_container_add (GTK_CONTAINER (window1), vbox1);

    menubar1 = gtk_menu_bar_new ();
    gtk_widget_show (menubar1);
    gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0);

    //create menu items
    item1 = gtk_menu_item_new_with_mnemonic ("_File");
    gtk_widget_show (item1);
    gtk_container_add (GTK_CONTAINER (menubar1), item1);

    menu1 = gtk_menu_new ();
    gtk_menu_item_set_submenu (GTK_MENU_ITEM (item1), menu1);

    item1 = gtk_image_menu_item_new_with_mnemonic ("_Quit");
    gtk_widget_show (item1);
    gtk_container_add (GTK_CONTAINER (menu1), item1);

    item1 = gtk_menu_item_new_with_mnemonic("_Edit");
    gtk_container_add(GTK_CONTAINER(menubar1), item1);

    menu1 = gtk_menu_new();
    gtk_menu_item_set_submenu(GTK_MENU_ITEM(item1), menu1);

    item1 = gtk_image_menu_item_new_with_mnemonic("_Action");
    gtk_container_add(GTK_CONTAINER(menu1), item1);

On 15.7.2015. 13:55, Miroslav Rajcic wrote:
Hi everyone,

recently I've received the mail from a blind user of my program complaining about accessibility issues.
Program is GTK+ 2.x based, he tried Windows edition.

One of the things he mentioned is that pressing Alt key in the main window should cause the first item in the menu bar to become focused.

I've checked other programs and it seems that:
1. Windows native programs (see Notepad for example) obey this behavior, pressing Alt does select menu bar item 2. created basic GTK program with menu bar, this behavior is not obeyed (see test source code below) I've played with different GTK settings like "gtk-auto-mnemonics" and "gtk-enable-mnemonics", but no help.

My question:
- am I missing some setting here ?
- is this unsupported?

Thanks for any tip, I'd like to improve the program accessibility for my users.


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