Problem build GdkEventKey on gtkdfb
- From: Matteo Mazzini <matteo mazzini email it>
- To: gtkmm-list gnome org
- Subject: Problem build GdkEventKey on gtkdfb
- Date: Fri, 06 Feb 2009 16:23:16 +0100
Hi to everybody,
i'm developing a gtkmm application on embedded system.
and i need to build a GdkEventKey to simulate a keyboard when i receive characters from a serial line.
Before all, to try build a GdkEventKey i had write a simple test program with a simple Gtk::Window, a callback for key press event, a callback where i build the event and put them into the event loop after a timeout.
Here the main:
========================================================
int main(int argc, char ** argv)
{
LOGGER.debug("gtestMain");
Gtk::Main _gtkMain(argc, argv);
_testWin = new Gtk::Window();
Gdk::Event::set_show_events(true);
_testWin->signal_key_press_event().connect(sigc::ptr_fun(onKeyPressedEvent), false);
Glib::signal_timeout().connect(sigc::ptr_fun(onTimeout), 5000);
LOGGER.info("Main before gtk event......");
_testWin->set_title("Frame Example");
_testWin->set_size_request(300, 200);
_testWin->set_decorated(false);
_testWin->set_has_frame(true);
_testWin->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
_testWin->show();
Glib::RefPtr<Gdk::Window> f_rptr = _testWin->get_frame();
_gtkMain.run();
return 0;
}
Here the callback where i build the event after timeout:
========================================================
bool onTimeout()
{
LOGGER.debug("=====> Main::build fake GtkEventKey ====");
GdkEvent* event = NULL;
event = gdk_event_new(GDK_KEY_PRESS);
LOGGER.debug("Main == key PRESSED event");
event->key.send_event = 1;
event->key.state = 0;
event->key.length = 1;
event->key.group = 0;
event->key.time = time (NULL);
event->key.keyval = 53;
event->key.hardware_keycode = 14;
event->key.string = gdk_keyval_name(53);
Glib::RefPtr<Gdk::Window> f_rptr = _testWin->get_frame();
event->key.window = f_rptr->gobj();
Gdk::Event gdkev(event);
gdkev.set_screen(_testWin->get_screen());
gdkev.put();
return true;
}
Here the callback for key press:
========================================================
bool onKeyPressedEvent(GdkEventKey *event)
{
LOGGER.debug("=====> Main::onKeyPressedEvent START <=========");
LOGGER.debug(Format("Dump of event structure: type[%$] window[%$] send event[%$] time[%$] state[%$] keyval[%$] length[%$] string[%$] hardware_keycode[%$] group[%$]")
%event->type %ptrtoa(event->window) %event->send_event %event->time %event->state %event->keyval %event->length %event->string %event->hardware_keycode %event->group);
LOGGER.debug("=====> Main::onKeyPressedEvent END <=========");
return false;
}
The problem is that i tested this on xorg and on directfb, on xorg all go well, after i put the event into main event loop i can see on screen the onKeyPressedEvent callback log, instead on directfb after i put the event into the main event loop i never see the onKeyPressedEvent callback log.
Could anyone help me on what happen?
Thank you very much for your time and help.
Matteo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]