Re: howto get the XkbLayout with the C language

2004-03-09 Thread Tomáš Macek
Thanks for answer, but I'm a C/C++ newbie. Can you help me a bit more?
I already have this code in my event (see below):

void Toolbar::redrawKBLabel(bool redraw) {
  XkbStateRec xkbState;
  XkbDescPtr my_xkb_desc;
  int my_xkb_group;

  my_xkb_desc = XkbGetMap(display, 0, XkbUseCoreKbd);

  XkbGetState(display, XkbUseCoreKbd, &xkbState);
  my_xkb_group = xkbState.group;
  fprintf(stderr, "my_xkb_grup = %d\n", my_xkb_group);
  XkbGetNames(display, XkbAllComponentsMask, my_xkb_desc);
  fprintf(stderr, "my_xkb_geometry = %s\n", XGetAtomName(display, 
my_xkb_desc->names->geometry));
  fprintf(stderr, "my_xkb_groups = %s\n", XGetAtomName(display, 
my_xkb_desc->names->groups[1]));
  fprintf(stderr, "my_xkb_types = %s\n", XGetAtomName(display, 
my_xkb_desc->names->types));
  fprintf(stderr, "my_xkb_indicators[0] = %s\n", XGetAtomName(display, 
my_xkb_desc->names->indicators[0]));
  fprintf(stderr, "my_xkb_geometry = %s\n", XGetAtomName(display, 
my_xkb_desc->names->geometry));
  if (redraw) XClearWindow(display, frame.kb);
  fprintf(stderr, "redrawKBLabel\n");
}

I think, that the line
> fprintf(stderr, "my_xkb_groups = %s\n", XGetAtomName(display, 
> my_xkb_desc->names->groups[1]));
should print the current "cz" or "us" keyboard layout, but it prints only NULL.
There is a lot of debugging code in the function, that outputs everything it is 
possible.
The keyboard layout index is in the "my_xkb_group" variable. But it's only integer. I 
need the keyboard layout in the text form...

Thanks for your help


On Tue, 9 Mar 2004, Ivan Pascal wrote:

>   Hi,
>
> > I've just tried to get the XkbLayout in my program, but It doesn't work for me at 
> > this moment.
> > I caught the event, when the user changes the keyboard layout. But I cannot get 
> > the layout symbolic name as is in my XF86Config like "us" or
> > "cz" or "de" or whatever I have there in the
> >
> > Option "XkbLayout"  "us,cz"
> >
> > line. How can I programm it? I programm it in the C language.
>
> All strings from Xkb* options are stored in the root window property
> _XKB_RULES_NAMES.  You can get them as a usual window property or use the
> function XkbRF_GetNamesProp (see X11/extensions/XKBrules.h) from libxkbfile.
>
> --
>  Ivan U. Pascal |   e-mail: [EMAIL PROTECTED]
>Administrator of |   Tomsk State University
>  University Network |   Tomsk, Russia
> ___
> Devel mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/devel
>
>
>
>
>
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: howto get the XkbLayout with the C language

2004-03-09 Thread Ivan Pascal
  Hi,

> I've just tried to get the XkbLayout in my program, but It doesn't work for me at 
> this moment.
> I caught the event, when the user changes the keyboard layout. But I cannot get the 
> layout symbolic name as is in my XF86Config like "us" or
> "cz" or "de" or whatever I have there in the
> 
>   Option "XkbLayout"  "us,cz"
> 
> line. How can I programm it? I programm it in the C language.

All strings from Xkb* options are stored in the root window property
_XKB_RULES_NAMES.  You can get them as a usual window property or use the
function XkbRF_GetNamesProp (see X11/extensions/XKBrules.h) from libxkbfile.

-- 
 Ivan U. Pascal |   e-mail: [EMAIL PROTECTED]
   Administrator of |   Tomsk State University
 University Network |   Tomsk, Russia
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


howto get the XkbLayout with the C language

2004-03-07 Thread Tomáš Macek
Hi,
I've just tried to get the XkbLayout in my program, but It doesn't work for me at this 
moment.
I caught the event, when the user changes the keyboard layout. But I cannot get the 
layout symbolic name as is in my XF86Config like "us" or
"cz" or "de" or whatever I have there in the

Option "XkbLayout"  "us,cz"

line. How can I programm it? I programm it in the C language.

Any help appreciated

Maca
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel