LinuxQuestions.org
Visit Jeremy's Blog.
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-12-2009, 02:18 AM   #1
chuangsheng
LQ Newbie
 
Registered: Nov 2006
Location: CHINA
Distribution: UBUNTU
Posts: 7

Rep: Reputation: 0
about xwindow. mouse left button and right button


The Button1MotionMask happend MotionNotify,
and Button2MotionMask happend MotionNotify to,
Button3MotionMask,
Button4MotionMask
Button5MotionMask.......


same,there happend ButtonPress and ButtonRelease.
but, i don't know where is mouse left button, where is mouse right button.

my code
Code:
if ((XGrabPointer
	     (disp, root, False,
	      Button1MotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync,
	      GrabModeAsync, root, cursor, CurrentTime) != GrabSuccess))
		gib_eprintf("couldn't grab pointer:");



	while (1) {	
		while (!done && XPending(disp)) {
			XNextEvent(disp, &ev);

			switch (ev.type) {
                                case MotionNotify://left button select to do something..

                                case xxxx://left button ButtonPress to do something..

                                case xxxx://left button ButtonRelease to do something..

[same:------->   right button no select~~]
                                case xxxx://right button ButtonPress to do something..


a new progremer..


thanks.
 
Old 06-12-2009, 04:46 AM   #2
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: Debian lenny, Slackware 12
Posts: 808

Rep: Reputation: 178Reputation: 178
The left button is button 1.

The right button is button 2.
 
Old 06-12-2009, 09:24 AM   #3
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Quote:
Originally Posted by wje_lq View Post
The left button is button 1.

The right button is button 2.
__normally__ right is Button3.
Code:
	while (1) 
	{	
		while (!done && XPending(disp)) 
		{
			XNextEvent(disp, &ev);

			switch (ev.type) 
			{
				case MotionNotify://left button select to do something..

				case ButtonRelease:
				case ButtonPress:
				{
					switch (ev.xbutton.button)
					{
						case Button1://left
						case Button2://middle
						case Button3://right
						case Button4://wheel up
						case Button5://whell down
 
Old 06-13-2009, 12:33 AM   #4
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: Debian lenny, Slackware 12
Posts: 808

Rep: Reputation: 178Reputation: 178
Quote:
Originally Posted by dmail View Post
__normally__ right is Button3.
Oops. My bad.
 
Old 06-13-2009, 12:34 AM   #5
chuangsheng
LQ Newbie
 
Registered: Nov 2006
Location: CHINA
Distribution: UBUNTU
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks wje_lq and dmail.
I'm form China, I'm sorry my English is bad.
my codes run my ubuntu now ^_^ thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Mouse left-button makes a screenshot? Why? gho6uuu Linux - Newbie 1 10-15-2007 04:29 PM
how should i enable the middle button of 3-button mouse ?? b0nd Slackware 1 07-17-2006 02:46 AM
3 button mouse (scroll button) Spyiish Slackware 24 07-23-2005 01:37 PM
switch left a right mouse button gbarny Slackware 1 07-26-2004 11:38 PM
middle mouse button is paste.. but what if i dont have a mid mouse button? kublador Linux - Newbie 4 09-02-2003 08:59 AM


All times are GMT -5. The time now is 01:59 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration