Re: Gdk 'keys-changed' signal not emitted



On Mon, 2005-01-03 at 08:36, Tarek wrote:
Hi,
I was wondering if anyone had any ideas why the gdk 'keys-changed'
signal is not working properly for me.
This is my connect call:
  g_signal_connect (G_OBJECT (someKeyMap), "keys_changed",
                           CALLBACK (someFunction), (gpointer) someData);

I think the keys-changed signal is bounded to GtkWindows, isn't it ?
http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html#GtkWindow-keys-changed

The "keys-changed" signal
void        user_function                  (GtkWindow *window,
                                            gpointer user_data);

My callback:
static void test_keys(GdkKeymap *keymap, gpointer user_data)
{ g_printf("test\n"); }

I tried changing "keys_changed" to "keys-changed" and still no dice.

The signal is "keys-changed".

What im looking for is a way to detect when the keyboard
mapping/layout changes. Ive done it using low-level XKB APIs but from
what i understood from
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Keyboard-Handling.html
that it should work using this signal as well.

I may have misunderstood something. Any advice is appreciated.
Thanks.

It seems you're tracking the signal on the keymap, that's not a GObject
so cannot deal with signals at all.

Try to track the signal on your applications main window.

g_signal_connect (G_OBJECT (theWindow), "keys_changed",
                             CALLBACK (someFunction), (gpointer) someData);

void someFunction  (GtkWindow *window, gpointer user_data)
{
        GdkKeymap* keymap;
        keymap = gdk_keymap_get_default();
        ...
}

I did not tried this as I never dealed with keyboard changes, but may be
it could work.
-- 
Iago Rubio



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