---
name: "mouse_getx"
section: "3vga"
platform: "linux"
package: "svgalibg1-dev"
version: "1:1.4.3-7"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/mouse_getx/3vga"
---

# mouse\_getx(3vga)

query the mouse state

## NAME

mouse\_getx, mouse\_gety, mouse\_getbutton - query the mouse state

## SYNOPSIS

**#include \<vgamouse.h\>**

**int mouse\_getx(void);**\
 **int mouse\_gety(void);**\
 **int mouse\_getbutton(void);**

## DESCRIPTION

These three routines do the obvious, namely returning current mouse pointer position and button state. **mouse\_getbutton()** returns an integer which can be bitwise &'d with **MOUSE\_LEFTBUTTON**, **MOUSE\_MIDDLEBUTTON**, **MOUSE\_RIGHTBUTTON**,  **MOUSE\_FOURTHBUTTON**, **MOUSE\_FIFTHBUTTON**, **MOUSE\_SIXTHBUTTON**, or **MOUSE\_RESETBUTTON**.

A 1 on any of these bits means the button has been pressed, a 0 means it hasn't.

Please note that you need to call [**mouse\_update**(3)](/mouse_update/3.md) or [**mouse\_waitforupdate**(3)](/mouse_waitforupdate/3.md) for the mouse state actually to change.

For 3d pointer devices, there is actually another interface. See [**mouse\_getposition\_6d**(3)](/mouse_getposition_6d/3.md).

## SEE ALSO

[**svgalib**(7)](/svgalib/7.md), [**vgagl**(7)](/vgagl/7.md), [**libvga.config**(5)](/libvga.config/5.md), **eventtest**(6), [**mouse\_close**(3)](/mouse_close/3.md), [**mouse\_init**(3)](/mouse_init/3.md), [**mouse\_getposition\_6d**(3)](/mouse_getposition_6d/3.md), [**mouse\_setposition**(3)](/mouse_setposition/3.md), [**mouse\_setscale**(3)](/mouse_setscale/3.md), [**mouse\_setwrap**(3)](/mouse_setwrap/3.md), [**mouse\_setxrange**(3)](/mouse_setxrange/3.md), [**mouse\_update**(3)](/mouse_update/3.md), [**mouse\_waitforupdate**(3)](/mouse_waitforupdate/3.md), [**vga\_setmousesupport**(3)](/vga_setmousesupport/3.md), [**mouse\_seteventhandler**(3)](/mouse_seteventhandler/3.md), [**vga\_waitevent**(3)](/vga_waitevent/3.md)

## AUTHOR

This manual page was edited by Michael Weller \<eowmob@exp-math.uni-essen.de\>. The exact source of the referenced function as well as of the original documentation is unknown.

It is very likely that both are at least to some extent are due to Harm Hanemaayer \<H.Hanemaayer@inter.nl.net\>.

Occasionally this might be wrong. I hereby asked to be excused by the original author and will happily accept any additions or corrections to this first version of the svgalib manual.
