LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-18-2008, 10:23 AM   #1
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Rep: Reputation: 43
GLX doublebuffer causes mouse pointer to move to top left of screen


hello all
I've been trying to get a mouse to work with my code, I had the "real" mouse off and was using a sprite, my readings were all over the place. So I turned the mouse on, every double buffer it moves to the top left corner of the screen. I think that's my problem? Can anyone tell me how to make the mouse stay in the same position rather than resetting?
In case that's not the problem He's my code for reading the mouse position below. Thanks for the help !

Code:
KeySym DetectKey(void)
{

/* key mapping found in usr/x11/keysymdef.h*/
Key=0;
//MouseButtonPressed=0;

       XWarpPointer(DisplayPointer, None, ScreenNumber1.win, 0, 0, 0, 0,0, 0);
       XMapRaised(DisplayPointer, ScreenNumber1.win);
       XGrabKeyboard(DisplayPointer, ScreenNumber1.win, True, GrabModeAsync,
            GrabModeAsync, CurrentTime);
        XGrabPointer(DisplayPointer, ScreenNumber1.win, True,ButtonPressMask|PointerMotionMask,
            GrabModeAsync, GrabModeAsync, ScreenNumber1.win, None,CurrentTime);


//XSelectInput(DisplayPointer,ScreenNumber1.win,PointerMotionMask);

        while(XPending(DisplayPointer) > 0)
        {
            XNextEvent(DisplayPointer, &event);
             
            switch (event.type)
            {
           //   case MotionNotify:
           //     if(event.xmotion.y==0 && event.xmotion.x==0 ) break;
           //     if(event.xmotion.x!=0) mousexpos=event.xmotion.x+event.xmotion.x_root;
           //   	if(event.xmotion.y!=0) mouseypos=event.xmotion.y+event.xmotion.y_root;
              
              
            //  break;
              
                case ButtonPress:
               // if(event.xmotion.y==0 && event.xmotion.x==0 ) break;
                if(event.xbutton.x!=0) mousexpos=event.xbutton.x;
              	if(event.xbutton.y!=0) mouseypos=event.xbutton.y;
              
              
              break;

              
              
               case KeyPress:
               	  printf("detect key pressed\n");
     	          Key = XLookupKeysym(&event.xkey, 0);
			   break;
            }

         };



return(Key);
}

Last edited by knobby67; 06-18-2008 at 10:24 AM.
 
Old 06-18-2008, 10:28 AM   #2
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
Sorry solved, had XWarpPointer!
I've worked on it all afternoon with no luck, read over my post on here and solve it, it's as if you we're helping me over the Ether
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How should I move my Mouse pointer yugandhar Programming 1 07-25-2006 07:56 AM
XFree86 - can't move mouse pointer Lenard Spencer Linux From Scratch 3 07-23-2006 04:47 PM
Mouse pointer clicks a few centimeters to the left. jtolds Linux - General 2 11-25-2003 12:21 PM
how to move pointer w/o using mouse in X gongli Linux - Software 1 10-22-2003 07:42 PM
The you have a Mouse Pointer Problem(mouse stick top left)here is the solution. dr4ven Linux - Hardware 0 05-25-2003 05:53 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration