I'm working on a multiplatform project and I decided to use GTK3 both for
Windows and Linux because of its availability on these os.
I'm using the last distribution for windows (GTK 3.6 package) but I have
the following problem: I'm trying to handle Touch Events coming from a
touch screen but I'm not able to get them form the GTK event system.
I'm able to catch all the others events (mouse, scroll, keys) but not touch.
There is someone who can help me?

Here, there is the code I have used to create my gtk window

static GtkWidget* CreateGTKWindow(DES_VIEW* pView){
   GtkWidget *window, *scrollWindow, *table, *vbox, *hbox;
   GdkCursor *cursor;
   GtkWidget *cr;

   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

   gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_NONE);
   gtk_window_move(GTK_WINDOW(window), pView->m_Window.m_StartX,
pView->m_Window.m_StartY);
   gtk_window_set_default_size(GTK_WINDOW(window), pView->m_Window.m_Width,
pView->m_Window.m_Height);
   gtk_window_set_title(GTK_WINDOW(window), pView->m_Window.m_Title);
   gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
   gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);
   gtk_widget_add_events(window, GDK_BUTTON_RELEASE_MASK);
   gtk_widget_add_events(window, GDK_SCROLL_MASK);
   gtk_widget_add_events(window, GDK_TOUCH_MASK);

   if (m_Utente == SYSTEM) {
      gtk_widget_add_events(window, GDK_KEY_PRESS_MASK);
      gtk_widget_add_events(window, GDK_KEY_RELEASE_MASK);
   }

   if (pView->TipoSelezione == SEL_INTERNA){
      pView->cursorSel = (GdkCursor*)createCursor(PATH_NAME_CURSOR,
DIM_CURSOR, window);
   }

   g_signal_connect(G_OBJECT(window), "button-press-event",
G_CALLBACK(OnMouseEvent), pView);
   g_signal_connect(G_OBJECT(window), "button-release-event",
G_CALLBACK(OnMouseEvent), pView);
   g_signal_connect(G_OBJECT(window), "scroll-event",
G_CALLBACK(OnScrollEvent), pView);
   g_signal_connect(G_OBJECT(window), "touch-event",
G_CALLBACK(OnTouchEvent), pView);

   if (m_Utente == SYSTEM) {
      g_signal_connect(G_OBJECT(window), "key-press-event",
G_CALLBACK(OnKeyEvent), pView);
      g_signal_connect(G_OBJECT(window), "key-release-event",
G_CALLBACK(OnKeyEvent), pView);
   }

   cr = gtk_drawing_area_new();
   g_signal_connect(cr, "draw", G_CALLBACK(OnExposeEvent), pView);
   gtk_widget_show(window);

   return window;

}

Best Regards
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to