Re: Gdk 'keys-changed' signal not emitted



I tried changing it to a GtkWindow and still cant catch the signal.
Anyway to know if the signal is emitted at all in the first place?
maybe a GdkEventFilter?

Anyways, it seems the api documentation is a little confusing here and
might need some clearing up.

This was my first reference:
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Keyboard-Handling.html#GdkKeymap-keys-changed

Thanks.

On Mon, 03 Jan 2005 10:02:41 +0100, Iago Rubio <iago rubio hispalinux es> wrote:
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
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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