Re: layouts.c

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

 



Not sure what you're looking for, but, try installing Devhelp so you can 
easily browse and search for the functions and objects you need. 
http://developer.imendio.com/projects/devhelp

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



linux user wrote:
> #include <stdio.h>
> #include <stdlib.h>
> #include <gtk/gtk.h>
>
> /*
>  *   I suspect that the problem involved in this program could be solved using
>  *   Xlib and/or Gdk libraries.
>  *
>  *   But... I can't identify the functions as well: (I only find tutorials for
>  *   creating new layouts, assigning new values on keys,...)
>  *
>  *   Please, help me in any way. Thanks a lot!.
>  */
>
> GtkWidget *pLayout;
> GtkWidget *pVariant;
>
> void change_keyboard ()
> {
> /*
>  *  Routine for applying the keyboard layout.
>  *
>  *           Just the same as $ setxkbmap -layout xx -variant xxxx
>  *           in Bash Console.
>  *
>  */
> }
>
> void search_variants ()
> {
> /*
>  *  Once Layout selected,
>  *
>  *            (1) search the *available* variants (if so...)
>  *
>  *            (2) elaborate the pVariant ComboBox List (append text...).
>  *
>  */
>
>    gtk_combo_box_append_text (GTK_COMBO_BOX(pVariant), "Layout Variant");
>
> }
>
> void search_layouts()
> {
> /*
>  *  Having the same keyboard characteristics as defined in
> /etc/X11/xorg.conf, mainly:
>  *
>  *  Section "Input Device"
>  *  ....
>  *         Option "XkbRules" "xorg"
>  *         Option "XkbModel" "pc105"
>  *  EndSection
>  *
>  *  Getting a list of keyboard layouts as:
>  *
>  *    Andorra
>  *    Afghanistan
>  *    Arabic
>  *    Albania
>  *    Armenia
>  *    Azerbaijan
>  *    Belarus
>  *  ....
>  *
>  *  For that, must I process /usr/share/X11/xkb/rules/xorg.lst directly or coud
>  *  I use a more suitable function ? (Also for correspondences between
> developped
>  *  and abreviated forms -like Andorra and ad, Afghanistan and af,...).
>  *
>  *  After all, finally, elaborate the pLayout ComboBox List (append text...).
>  *
>  */
>
>    gtk_combo_box_append_text (GTK_COMBO_BOX(pLayout), "Keyboard Layout");
>
> }
>
> int main (int argc, char **argv)
> {
>    GtkWidget *pWindow;
>    GtkWidget *pHBox;
>    GtkWidget *pApply;
>
>    gtk_init (&argc, &argv);
>
>    pWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>    gtk_container_set_border_width (GTK_CONTAINER (pWindow), 5);
>    g_signal_connect (G_OBJECT(pWindow),"delete-event",
>                      G_CALLBACK(gtk_main_quit),0);
>
>    pHBox = gtk_hbox_new (FALSE, 10);
>
>    pLayout = gtk_combo_box_new_text ();
>    search_layouts();
>    gtk_combo_box_set_active (GTK_COMBO_BOX(pLayout), 0);
>    g_signal_connect (G_OBJECT(pLayout), "changed",
>                      G_CALLBACK(search_variants), 0);
>
>
>    pVariant = gtk_combo_box_new_text ();
>    search_variants();
>    gtk_combo_box_set_active (GTK_COMBO_BOX(pVariant), 0);
>
>    pApply = gtk_button_new_with_label ("< Apply >");
>    g_signal_connect (G_OBJECT(pApply), "clicked",
>                      G_CALLBACK(change_keyboard), 0);
>
>    gtk_box_pack_start (GTK_BOX (pHBox), pLayout, TRUE, TRUE, 0);
>    gtk_box_pack_start (GTK_BOX (pHBox), pVariant, TRUE, TRUE, 0);
>    gtk_box_pack_start (GTK_BOX (pHBox), pApply, TRUE, TRUE, 0);
>
>    gtk_container_add (GTK_CONTAINER(pWindow), pHBox);
>
>    gtk_widget_show_all(pWindow);
>    gtk_main();
>
>    return 0;
> }
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>   
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux