Home Forums Wiki Doc Install Extras Screenshots Source Code Projects Blog Users Groups Register
Glx-Dock / Cairo-Dock List of forums Git Version | Version Git xkl_engine_get_state returns incorrect group value in 64-bits (KDE+XFCE) - Applet Keyboard
The latest stable release is the *3.4.0* : How to install it here.
Note: We just switched from BZR to Git on Github! (only to host the code and your future pull requests)
Git Version | Version Git

Subjects Author Language Messages Last message
[Locked] xkl_engine_get_state returns incorrect group value in 64-bits (KDE+XFCE) - Applet Keyboard
Page : 1 2 3 4 5 6
FrankKubuntu Français 115 FrankKubuntu [Read]
01 January 2013 à 14:56

fabounet, Monday 17 May 2010 à 12:25


Subscription date : 30 November 2007
Messages : 17118
dans applet-init.c, à 2 endroits
c'est en commentaire, tu peux pas les louper

FrankKubuntu, Tuesday 18 May 2010 à 02:01


Subscription date : 21 October 2009
Messages : 1575
Ok alors j'ai compris l'erreur fab. Il y avait un conflit textuel dans le fichier en faisant un bzr up. Alors j'ai tout effacé et re-bzr checkout. J'ai maintenant les lignes. Elles sont en commentaires, donc ça fait quoi si je supprime le 2ième argument qui est en commentaire?

Sans rien faire à l'applet, j'obtiens l'erreur suivant en changeant la langue :

cairo_dock_start_icon_animation (cairo-dock, 1)
debug : (/home/frank/stuff/Downloads/cairo-dock_bzr/cairo-dock-plug-ins/keyboard-indicator/src/applet-xklavier.c:cd_xkbd_keyboard_state_changed:85)
cd_xkbd_keyboard_state_changed (window:92277340)
warning : (/home/frank/stuff/Downloads/cairo-dock_bzr/cairo-dock-plug-ins/keyboard-indicator/src/applet-xklavier.c:cd_xkbd_keyboard_state_changed:107)
xkl_engine_get_state() failed, we use the first keyboard layout as a workaround
debug : (/home/frank/stuff/Downloads/cairo-dock_bzr/cairo-dock-plug-ins/keyboard-indicator/src/applet-xklavier.c:cd_xkbd_keyboard_state_changed:111)
group : 0 -> 0 ; indic : 2 -> 0
debug : (/home/frank/stuff/Downloads/cairo-dock_bzr/cairo-dock-plug-ins/keyboard-indicator/src/applet-xklavier.c:cd_xkbd_keyboard_state_changed:127)
group name : USA (2 groups)
debug : (/home/frank/stuff/Downloads/cairo-dock_bzr/cairo-dock-plug-ins/keyboard-indicator/src/applet-xklavier.c:cd_xkbd_keyboard_state_changed:149)
indicator name :

fabounet, Tuesday 18 May 2010 à 12:56


Subscription date : 30 November 2007
Messages : 17118
ça c'est en laissant le code en commentaire ?
quand tu passes d'une fenêtre à l'autre (fenêtres d'éditeur de texte) qui n'ont pas la même langue, l'applet change aussi ou pas ?

FrankKubuntu, Tuesday 18 May 2010 à 13:53


Subscription date : 21 October 2009
Messages : 1575
Oui, en commentaires.

Ah pas essayé de changer de fenêtre, mais à mon avis ça changera pas, puisque pour la fenêtre active ça n'a pas changé. Je vais quand essayer ce soir.

FrankKubuntu, Wednesday 19 May 2010 à 02:13


Subscription date : 21 October 2009
Messages : 1575
Non, même problème même en basculant.

J'ai des erreurs du genre
Unread_message_signal
cd_xkbd_set_group: assertion `bSuccess' failed

fabounet, Wednesday 19 May 2010 à 12:51


Subscription date : 30 November 2007
Messages : 17118
ok, bon donc c'est ce que je pensais, ce code ne fait rien
le gars essaye de nous endormir là

FrankKubuntu, Wednesday 19 May 2010 à 15:02


Subscription date : 21 October 2009
Messages : 1575
Je peux lui poster mon fail et lui dire que ça marche pas?

fabounet, Wednesday 19 May 2010 à 15:19


Subscription date : 30 November 2007
Messages : 17118
oui tu peux luis dire que l'init/stop ne sert à rien, et que en 64 tu as systématiquement la fonction cd_xkbd_set_group qui renvoie FALSE.

FrankKubuntu, Thursday 20 May 2010 à 01:03


Subscription date : 21 October 2009
Messages : 1575
Voici sa réponse :

Sergey V. Udaltsov 2010-05-19 15:36:07 PDT

Start-stop functions initialize listener. After that, your application is
responsible for calling even handling function in X event loop
(xkl_engine_filter_events).

See the sample code in tests/test_monitor.c


Le 'test_monitor.c' c'est quand tu compiles libxklavier.

Le voici :

/*
* Copyright (C) 2002-2006 Sergey V. Udaltsov <no spam....>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/XKBlib.h>
#include <libxklavier/xklavier.h>

extern void xkl_config_dump(FILE * file, XklConfigRec * data);

static void
print_usage()
{
    printf
     ("Usage: test_monitor (-l1)(-l2)(-l3)(-h)(-d <debugLevel>)\n");
    printf("Options:\n");
    printf(" -d - Set the debug level (by default, 0)\n");
    printf(" -h - Show this help\n");
    printf(" -l1 - listen to manage layouts\n");
    printf(" -l2 - listen to manage window states\n");
    printf(" -l3 - listen to track the keyboard state\n");
}

static void
state_changed(XklEngine * engine, XklEngineStateChange type,
     gint new_group, gboolean restore)
{
    xkl_debug(0, "State changed: %d,%d,%d\n", type, new_group,
         restore);
}

static void
config_changed(XklEngine * engine)
{
    const gchar **gn;
    gint gt;
    gint i;

    xkl_debug(0, "Config changed\n");

    gn = xkl_engine_get_groups_names(engine);
    gt = xkl_engine_get_num_groups(engine);
    for (i = 0; i < gt; i++)
        xkl_debug(0, "group[%d]: [%s]\n", i, gn[i]);
}

static void
new_device(XklEngine * engine)
{
    xkl_debug(0, "New device attached!\n");
}

int
main(int argc, char *argv[])
{
    int c;
    int debug_level = -1;
    XkbEvent ev;
    Display *dpy;
    XklEngine *engine;
    int listener_type = 0, lt;
    int listener_types[] = { XKLL_MANAGE_LAYOUTS,
        XKLL_MANAGE_WINDOW_STATES,
        XKLL_TRACK_KEYBOARD_STATE
    };

    g_type_init_with_debug_flags(G_TYPE_DEBUG_OBJECTS |
                 G_TYPE_DEBUG_SIGNALS);

    while (1) {
        c = getopt(argc, argv, "hd:l:");
        if (c == -1)
            break;
        switch (c) {
        case 'h':
            print_usage();
            exit(0);
        case 'd':
            debug_level = atoi(optarg);
            break;
        case 'l':
            lt = optarg[0] - '1';
            if (lt >= 0
             && lt <
             sizeof(listener_types) /
             sizeof(listener_types[0]))
                listener_type |= listener_types[lt];
            break;
        default:
            fprintf(stderr,
                "?? getopt returned character code 0%o ??\n",
                c);
            print_usage();
            exit(0);
        }
    }

    dpy = XOpenDisplay(NULL);
    if (dpy == NULL) {
        fprintf(stderr, "Could not open display\n");
        exit(1);
    }
    if (debug_level != -1)
        xkl_set_debug_level(debug_level);
    engine = xkl_engine_get_instance(dpy);
    if (engine != NULL) {
        XklConfigRec *current_config;
        const gchar **names;

        xkl_debug(0, "Xklavier initialized\n");

        current_config = xkl_config_rec_new();
        xkl_config_rec_get_from_server(current_config, engine);

        names = xkl_engine_get_groups_names(engine);
        while (names != NULL && *names != NULL && **names != 0)
            xkl_debug(0, "Group: [%s]\n", *names++);

        names = xkl_engine_get_indicators_names(engine);
        while (names != NULL && *names != NULL && **names != 0)
            xkl_debug(0, "Indicator: [%s]\n", *names++);

        g_signal_connect(engine, "X-state-changed",
                 G_CALLBACK(state_changed), NULL);
        g_signal_connect(engine, "X-config-changed",
                 G_CALLBACK(config_changed), NULL);
        g_signal_connect(engine, "X-new-device",
                 G_CALLBACK(new_device), NULL);

        xkl_debug(0, "Now, listening: %X...\n", listener_type);
        xkl_engine_start_listen(engine, listener_type);

        while (1) {
            XNextEvent(dpy, &ev.core);
            if (!xkl_engine_filter_events(engine, &ev.core))
                xkl_debug(200, "Unknown event %d\n",
                     ev.type);
        }

        xkl_engine_stop_listen(engine, listener_type);

        g_object_unref(G_OBJECT(current_config));
        g_object_unref(G_OBJECT(engine));
        xkl_debug(0, "Xklavier terminating\n");
    } else {
        fprintf(stderr, "Could not init Xklavier\n");
        exit(2);
    }
    printf("closing display: %p\n", dpy);
    XCloseDisplay(dpy);
    return 0;
}

fabounet, Thursday 20 May 2010 à 10:17


Subscription date : 30 November 2007
Messages : 17118
le truc c'est quon récupère déjà nous-même les évènements XKLAVIER_STATE
donc tout ce qu'on veut c'est que la fonction XklGetState() nous renvoit l'état courant.

La fonction le fait comme ça :

(XGetWindowProperty( dpy, appWin, XKLAVIER_STATE, 0L, PROP_LENGTH, False, XA_INTEGER,
&type_ret, &format_ret, &nitems, &rest,
&prop ) == Success ) &&
( type_ret == XA_INTEGER ) && ( format_ret == 8 )

le seul endroit où ça peut donner FALSE, c'est si XGetWindowProperty ne passe pas, ou si le type ou le format de retour ne sont pas les bons.
en 64 bits, il doit y'avoir un problème qu'il n'y a pas en 32bits.

Précise-lui bien que l'applet marche impec en 32bits.

FrankKubuntu, Thursday 20 May 2010 à 14:05


Subscription date : 21 October 2009
Messages : 1575
64-bits devrait être le standard et 32-bits ne devrait plus exister, j'ai eu des problèmes tout le temps en 64-bits un peu partout...

Je lui ai poussé l'info.

fabounet, Thursday 20 May 2010 à 17:39


Subscription date : 30 November 2007
Messages : 17118
merci

FrankKubuntu, Tuesday 28 September 2010 à 17:31


Subscription date : 21 October 2009
Messages : 1575
Bon, après tous ces mois (mai 2010!!!), voici un retour du Russe (et un rappel de ce que je lui avais écrit) :

Frank 2010-05-20 05:04:17 PDT

Ok.

We already retrieve ourselves XKLAVIER_STATE events.

All we want is that the function 'XklGetState()' returns current state.

The function does it this way:

(XGetWindowProperty( dpy, appWin, XKLAVIER_STATE, 0L, PROP_LENGTH, False,
XA_INTEGER,
&type_ret, &format_ret, &nitems, &rest,
? ) == Success ) &&
( type_ret == XA_INTEGER ) && ( format_ret == 8 )

The only places where it can return FALSE is if 'XGetWindowProperty' doesn't go
through or if the return type or format is wrong.

Again this exact function works perfectly in 32-bits mode, there must be
something handled differently in 64-bits.

------------------------------------------------------

Comment 22 Sergey V. Udaltsov 2010-09-27 14:14:04 PDT

Sorry, that bug somehow got lost in my inbox

First of all, would you try running test_monitor app from libxklavier? Does it
display proper group number?

Second, using that app, you could add more debug (just printf, if you like) to
the library code, straight after XGetWindowProperty and see what it returns.

Additionally, you can always check every window's properties using xprop. Would
you see any mismatch between xprop results - and the results of the
XGetWindowProperties call?


Je ne sais pas quoi lui répondre, je ne comprends pas trop son commentaire... je vais aussi devoir tester avec la 2.2 voir si le problème est toujours là, pour ça je dois compiler libxklavier 5, j'ai la 4 avec openSUSE 11.2.

Qqu'un a libxklavier 5.0 en 64-bits?

http://sourceforge.net/projects/gswitchit/files/libxklavier/

fabounet, Tuesday 28 September 2010 à 17:59


Subscription date : 30 November 2007
Messages : 17118
je pense que ce programme test_monitor se trouve dans les sources de la lib, et que tu l'auras en la compilant
effectivement ça serait un bon moyen pour être sûr.

FrankKubuntu, Thursday 09 February 2012 à 19:16


Subscription date : 21 October 2009
Messages : 1575
J'ai relancé le gars pour ce bug!

Peut-être que je vais avoir besoin de qqu'un pour venir lui parler sur bugzilla...

fabounet, Wednesday 15 February 2012 à 12:59


Subscription date : 30 November 2007
Messages : 17118
pas de problème !
j'ai aussi souvent des soucis (le num-lock pas défini au lancement)
j'envisage sérieusement de me passer de cette lib, faut que je vois l'impact.

FrankKubuntu, Saturday 05 May 2012 à 00:43


Subscription date : 21 October 2009
Messages : 1575
Ok, donc aucune réponse du russe depuis le 9 février.

Est-ce que CD peut utiliser autre chose que libxklavier?
Sinon, à qui je pourrais rapporter ce problème, autre que le russe qui ne répond plus?

Le dernier commentaire sur le bug semble être automatique, comme s'il ne supporte plus la lib :

Sergey V. Udaltsov 2012-02-09 10:17:53 PST

Everybody is free to join, this is bugzilla ;)


Si on peut faire fonctionner cet applet avec KDE (64bits peut-être seulement qui a le prob), alors je n'aurai plus besoin d'utiliser le systray de KDE!!! Car j'ai découvert qque chose sur les notifs et CD les prend! Donc il ne reste que cet applet à faire fonctionner et À DIEU (ou AU DIABLE :D) le systray de KDE!

fabounet, Monday 07 May 2012 à 13:01


Subscription date : 30 November 2007
Messages : 17118

Est-ce que CD peut utiliser autre chose que libxklavier?

et bien, on pourrait extraire les quelques fonctions qui nous intéresse de la lib, et la balancer aux orties
j'y pense sérieusement vu ce que tu me dis.

FrankKubuntu, Thursday 13 December 2012 à 14:46


Subscription date : 21 October 2009
Messages : 1575
Je ne suis pas le seul avec ce problème, XFCE l'a aussi...

Quelqu'un a répondu à mon bug libxklavier, mais il semble que le développeur ne supporte plus le package car je n'ai pas eu de retour depuis février.

https://bugs.freedesktop.org/show_bug.cgi?id=27737

I have exactly the same problem.

Xubuntu 12.10, 64 bit
Cairo-dock 3.10

The same error message:

[1355392250,150,xklavier_toplevel.c:xkl_engine_get_toplevel_window_state/]     Appwin 4e00004, 'Terminal - vas.pup@aaa: ~' does not have state
cd_xkbd_set_group: assertion `bSuccess' failed


Que pouvons-nous faire pour ça?
Y a-t-il un autre endroit où logger le bug?
Pouvons-nous designer CD autrement pour passer outre ce problème, même s'il s'agit d'un patch pas beau?

FrankKubuntu, Thursday 13 December 2012 à 16:14


Subscription date : 21 October 2009
Messages : 1575
I will switch to English, in case the XFCE user decides to join in.

Does anyone know where I can change the suggested changes by the developer?

Another idea.

Change
CARD32 *prop = NULL;
to
long *prop = NULL;

(I am still talking about xkl_engine_get_toplevel_window_state)

The idea is based on http://www.x.org/releases/X11R7.5/doc/man/man3/XGetWindowProperty.3.html:

If the returned format is 32, the property data will be stored as an array of longs (which in a 64-bit application will be 64-bit values that are padded in the upper 4 bytes).

If that helps - I will patch libxklavier


Where do I change CARD32 *prop to long *prop?
I do not want to ask him as I think I would look stupid not knowing.

Git Version | Version Git

Subjects Author Language Messages Last message
[Locked] xkl_engine_get_state returns incorrect group value in 64-bits (KDE+XFCE) - Applet Keyboard
Page : 1 2 3 4 5 6
FrankKubuntu Français 115 FrankKubuntu [Read]
01 January 2013 à 14:56


Glx-Dock / Cairo-Dock List of forums Git Version | Version Git xkl_engine_get_state returns incorrect group value in 64-bits (KDE+XFCE) - Applet Keyboard Top

Online users :

Powered by ElementSpeak © 2007 Adrien Pilleboue, 2009-2013 Matthieu Baerts.
Dock based on CSS Dock Menu (Ndesign) with jQuery. Icons by zgegball
Cairo-Dock is a free software under GNU-GPL3 licence. First stable version created by Fabounet.
Many thanks to TuxFamily for the web Hosting and Mav for the domain name.