Re: [Vala] Problem to handle shift key
- From: yannick inizan <inizan yannick gmail com>
- To: Raum <raum no-log org>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Problem to handle shift key
- Date: Thu, 12 Dec 2013 19:14:36 +0100
this code works on Ubuntu Saucy, Gtk+ 3.11.3
2013/12/13 Raum <raum no-log org>
Hello,
I've got a new problem :) This code works on windows but not on linux and
I don't understand why ?!?
--------- CODE gtk_test.vala -----------
public class Application {
public Gtk.Window window;
public Application () {
window = new Gtk.Window();
// Prepare Gtk.Window:
window.title = "test";
window.window_position = Gtk.WindowPosition.CENTER;
window.destroy.connect (Gtk.main_quit);
window.set_default_size (350, 70);
window.add_events(Gdk.EventMask.KEY_RELEASE_MASK);
window.add_events(Gdk.EventMask.KEY_PRESS_MASK);
window.key_release_event.connect(on_key_press);
window.key_press_event.connect(on_key_press);
}
public bool on_key_press (Gdk.EventKey event) {
stdout.printf ("state : %d / shift modifier should be : %d\n",
event.state, Gdk.ModifierType.SHIFT_MASK);
return true;
}
public static int main (string[] args) {
Gtk.init (ref args);
Application app = new Application ();
app.window.show_all ();
Gtk.main ();
return 0;
}
}
---------------------------------------------
// Ubuntu 11.04
# valac --pkg gtk+-3.0 gtk_test.vala
# ./gtk_test
state : 0 / shift modifier should be : 1 // I've pressed "shift" I
should see "1 / 1" and not "0 / 1"
state : 1 / shift modifier should be : 1 // I've released "shift", I see
"1/1", it's ok
----------------------------------------------
I didn't compile this code on Windows/MingW but I've a similar code which
working...
Where am I wrong ?
Thanks
Regards
Raum
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]