GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with motion event drawing

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
gallen
Familiar Face


Joined: 01 Sep 2007
Posts: 10

PostPosted: Sat Sep 01, 2007 7:58 am    Post subject: Problem with motion event drawing Reply with quote

Hi all,

First of all I'm programming in C.

I'm trying to create a panning image effect using the grab and drag style that you would use in a pdf file for example.

It's mostly working, I'm using a gtk drawing area and modifying the 'corner position' of the gdk pixmap to start drawing from onto the drawing area.

I'm using a button press event to detect the 'grab' point and then motion events to detect how to move the image.

The problem is that when there is a lot of pointer motion occuring and then the button is clicked to start the drag it seems as though the button click event is ignored until after the motion events are dealt with. This results in the previously clicked point (or 0,0 if no previous points) being mistaken as the point which is 'grabbed' rather than the new point.

I have made sure that the button press event is attached before the motion event if that makes a difference, and I've had many people (who know C but not GTK) verify that my code seems correct.

Would anyone know the problem here? Or is there a better way of doing what I'm trying to achieve? sorry I'm very new to GTK and GUI programming.

Also if anyone could point me in the direction of come open source code which does this it would be GREATLY appreciated.

Thanks for reading!

Glenn
Back to top
gallen
Familiar Face


Joined: 01 Sep 2007
Posts: 10

PostPosted: Sat Sep 01, 2007 10:23 am    Post subject: Reply with quote

Hi again,

I fixed it! It was because I was setting the GDK_POINTER_MOTION_HINT_MASK event as well, as soon as I took that out it worked properly.

Can anyone explain why this caused the problem? As I heard using the hint mask was good to reduce CPU workload.

Thanks anyway,

Glenn
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP