Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7631227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:18:06+00:00 2026-05-31T06:18:06+00:00

Is it possible to detect mouse events from entire screen in linux? My application

  • 0

Is it possible to detect mouse events from entire screen in linux? My application is programmed in C and uses gtk2. I tried to look the source of several programs but all I found was grabbing the entire screen and other programs no longer recieve those events and this is not what I’m looking for.

At the moment I’m just trying to read the device directly but this doesn’t seem to be very good way.. I would like to get any mouse click events made by keyboard, scripts etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:18:07+00:00Added an answer on May 31, 2026 at 6:18 am

    A “solution” I’ve seen in some places is to select ButtonPressEvent on every window in the entire tree of X windows, using XSelectInput, and also selecting SubstructureNotifyMask to find out about new windows. This method is known to break some programs (by preventing mouse events from propagating from a window whose client has not selected ButtonPressEvent), so use it at your own risk. Also, it will not work if another client has a pointer grab.

    You can maintain a pointer grab with GrabModeSync forever and allow mouse events to go to the window that would normally get them by calling XAllowEvents(event_mode=ReplayPointer). If you keep a full pointer grab all the time, then it will horribly break all your programs because they will expect to be able to grab the pointer. You can grab a single button + modifier combination with XGrabButton, but I suspect your window manager might interfere with this in practice (which may be a good argument for modifying your window manager to notify you of events or directly do whatever it is you need).

    If all of the programs you use support AT-SPI (they probably don’t) and you have Assistive Technologies enabled, you can get notification of mouse events from AT-SPI. This won’t break anything, but it won’t work for some programs.

    So there really isn’t a good solution, but maybe one of these broken solutions will work in the circumstances you need, applied in a limited way or with a huge disclaimer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to detect touch events from within another application, specifically swipes? I'd
Possible Duplicate: How to detect right mouse click + paste using JavaScript? How to
is it possible for flash to detect off-stage mouse coordinates in order to continuously
Quick question - is it possible to detect whether a focus has come from
Is it possible the detect the version of IE installed on a machine from
I would like to detect mouse events like left button click, right button click
Is it possible to detect if my app is running and displaying on screen?
Is it possible to detect the fingersize in an IOS Application? I've read in
Possible Duplicate: Jquery: detect if middle or right mouse button is clicked, if so,
Is it possible to detect if a Facebook app is running from inside a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.