GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Apr 18, 2014 10:38 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: No visible cursor
PostPosted: Tue Jun 26, 2012 1:27 pm 
Offline
Familiar Face

Joined: Tue Jun 26, 2012 1:18 pm
Posts: 5
Hello

I`m new to gtk and this is my first program. Its running on a ARM machine with a Touchscreen (no, not a smatphone/tablet). It`s an embedded computer.
So, the application is running very good and I can click the buttons with my finger. But I don`t see any mouse cursor.
I tried:

Code:
cur = gdk_cursor_new(GDK_ARROW);
gdk_window_set_cursor ( GTK_WINDOW(widget) > window , cur);
gdk_flush();


But it didn`t work.

Here is the complete main code:

Code:
int main (int argc, char *argv[])
{
   int retval = 0;
   GtkWidget *window;
   GtkWidget *widget;
   GtkWidget *box;
   GtkWidget *label1;
   GtkWidget *label2;
   GtkWidget *label3;
   GtkWidget *label4;
   GtkWidget *label5;

   GtkWidget *button1;
   GtkWidget *button2;
   GtkWidget *button3;
   GtkWidget *button4;
   GtkWidget *button5;
   GdkCursor *cur=NULL;

   gtk_init(&argc, &argv);

   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_window_set_default_size(GTK_WINDOW(window), 1024, 768);

   cur = gdk_cursor_new(GDK_ARROW);
   gdk_window_set_cursor ( GTK_WINDOW(widget) > window , cur);
   gdk_flush();

   box = gtk_fixed_new();
   label1 = gtk_label_new("Messpunkt 1");
   gtk_widget_modify_font (label1,pango_font_description_from_string ("Monospace 12"));
   gtk_fixed_put(GTK_FIXED(box), label1, (MP1_XC-40), (MP1_YC-95));
   label2 = gtk_label_new("Messpunkt 2");
   gtk_widget_modify_font (label2,pango_font_description_from_string ("Monospace 12"));
   gtk_fixed_put(GTK_FIXED(box), label2, (MP2_XC-40), (MP2_YC-95));
   label3 = gtk_label_new("Messpunkt 3");
   gtk_widget_modify_font (label3,pango_font_description_from_string ("Monospace 12"));   
   gtk_fixed_put(GTK_FIXED(box), label3, (MP3_XC-40), (MP3_YC-95));
   label4 = gtk_label_new("Messpunkt 4");
   gtk_widget_modify_font (label4,pango_font_description_from_string ("Monospace 12"));   
   gtk_fixed_put(GTK_FIXED(box), label4, (MP4_XC-40), (MP4_YC-95));
   label5 = gtk_label_new("Messpunkt 5");
   gtk_widget_modify_font (label5,pango_font_description_from_string ("Monospace 12"));   
   gtk_fixed_put(GTK_FIXED(box), label5, (MP5_XC-40), (MP5_YC-95));

   gtk_container_add(GTK_CONTAINER(window), box);

   button1 = gtk_button_new_with_label("Touch Test Punkt 1");
   button2 = gtk_button_new_with_label("Touch Test Punkt 2");
   button3 = gtk_button_new_with_label("Touch Test Punkt 3");
   button4 = gtk_button_new_with_label("Touch Test Punkt 4");
   button5 = gtk_button_new_with_label("Dauerlauf");

   gtk_signal_connect (GTK_OBJECT (button5), "clicked", GTK_SIGNAL_FUNC (Dauerlauf_clicked), NULL);

   gtk_fixed_put(GTK_FIXED(box), button1, 460, 150);
   gtk_fixed_put(GTK_FIXED(box), button2, 724, 364);
   gtk_fixed_put(GTK_FIXED(box), button3, 460, 550);
   gtk_fixed_put(GTK_FIXED(box), button4, 200, 364);

   gtk_fixed_put(GTK_FIXED(box), button5, 20, 724);

   gtk_container_add(GTK_CONTAINER(window), box);

   gtk_widget_show_all(box);

   g_signal_connect(window, "expose-event", G_CALLBACK (on_expose), NULL);

   gtk_widget_set_app_paintable(window, TRUE);

   gtk_widget_show_all(window);

   gtk_main();

   return 0;
}


I`m sorry for this stupid question, but at the moment I can`t see the way to success... :-(
Thanks for any help!
Best regards

Mr Bean


Top
 Profile  
 
 Post subject: Re: No visible cursor
PostPosted: Tue Jun 26, 2012 2:21 pm 
Offline
Familiar Face

Joined: Tue Jun 26, 2012 1:18 pm
Posts: 5
Hello

Another question concerning this problem. Is there any X-Server/Gtk environment variable that must be set to get a visible mouse pointer?

Thanks!
Mr Bean


Top
 Profile  
 
 Post subject: Re: No visible cursor
PostPosted: Tue Jun 26, 2012 3:41 pm 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 176
Location: USA
Touch support was just added to Gtk in version 3.4.
https://mail.gnome.org/archives/gnome-announce-list/2012-March/msg00074.html

It references setting GdkInputSource as GDK_SOURCE_TOUCHSCREEN.
http://developer.gnome.org/gdk3/3.4/GdkDevice.html#GdkInputSource

Also since you need gtk+-3.4 for touch support there's no need to call gtk_widget_modify_font. Font, font size and color can all be set using the new CSS integration in the gtk3.x series. It's very straight forward for buttons especially. I've posted a series of tutorials on using CSS in the tutorials section (starting on page 2)

Sorry I don't have any more information than that.
What hardware are you using ? I'm dying to get my hands on a Rasperberry Pi or the A13-OLinuXino by Olimex.


Last edited by zerohour on Thu Jul 05, 2012 6:32 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: No visible cursor
PostPosted: Wed Jun 27, 2012 5:55 am 
Offline
Familiar Face

Joined: Tue Jun 26, 2012 1:18 pm
Posts: 5
Hey zerohour

Thanks for your reply. I think Gtk don`t know that I`m using a touchscreen. I`m using an ELO touch device. The driver of the touch device implements a normal mouse device. So I think that shouldn`t be the problem. The second thing is, that the touch seems to work. I can click my buttons by my finger. I only don`t see (optically) the mouse pointer.
Are there any routines I have to use to show the mouse pointer!?
Hardware is a self designed embedded computer with a Marvell ARM CPU.

Thanks in advance!

Best regards

Mr Bean


Top
 Profile  
 
 Post subject: Re: No visible cursor
PostPosted: Wed Jun 27, 2012 3:23 pm 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 176
Location: USA
1) Which Marvel CPU is it ? ARMADA, Kirkwood, PXA?
2) What O.S. and version are you using on the Marvel? Debian Squeeze Armel ?
3) What version of GTK are you using ?
I know Squeeze doesn't support gtk3 and it's in the testing phase for Wheezy
http://packages.debian.org/search?searchon=names&keywords=libgtk-3-0
4) Which ELO touch device?
5) What version is the ELO driver?

Even though you can click the buttons I still think you need to enable GdkInputSource as GDK_SOURCE_TOUCHSCREEN.


Top
 Profile  
 
 Post subject: Re: No visible cursor
PostPosted: Thu Jun 28, 2012 6:04 am 
Offline
Familiar Face

Joined: Tue Jun 26, 2012 1:18 pm
Posts: 5
Hello

1. It`s a Marvel ARMADA PXA168 CPU.
2. The OS is made on my own. It`s using xorg-server-1.9.3
3. The version of Gtk is gtk+-2.10.13, atk-1.33.6, cairo-1.4.14, pango-1.16.4, gdk-pixbuf-2.22.1.
4. I don`t know which touch device it is exactly, but I think it is the SCN-IT-FLT12.1-003-004-F-R acoustic wave touch.
5. Version of the elo driver is xf86-input-elographics-1.2.4.

So it is necessary to switch to a higher gtk Version if I want to see the mouse pointer!?

As the OS is made on my own, I think it is also possible that the problem lays in the xorg.conf. Still trying....

Thanks

Best regards
Mr Bean


Top
 Profile  
 
 Post subject: Re: No visible cursor
PostPosted: Fri Jul 06, 2012 6:34 am 
Offline
Familiar Face

Joined: Tue Jun 26, 2012 1:18 pm
Posts: 5
Hey zerohour

I can`t leave you a PM, don`t know why. So, thanks for the point to stackoverflow. I hope, giuspen can help me... ;-)

Thanks an best regards

Me Bean


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group