Re: Detecting mouse clicks anywhere on screen
- From: "Jasper St. Pierre" <jstpierre mecheye net>
- To: Kerrick Staley <mail kerrickstaley com>
- Cc: gnome-shell-list gnome org
- Subject: Re: Detecting mouse clicks anywhere on screen
- Date: Wed, 8 Aug 2012 20:59:24 -0400
On Wed, Aug 8, 2012 at 8:55 PM, Kerrick Staley <mail kerrickstaley com> wrote:
> Hi,
> I'm trying to write an extension that will toggle the overview
> whenever mouse button 9 is clicked, but I can't figure out how to
> detect clicks from arbitrary locations on the screen.
You cannot. X does not work that way. You could take a button grab,
but XGrabKeys isn't introspectable, and we don't have introspectable
bindings for it.
> global.stage's button-press-event will fire when you click the mouse
> anywhere within the overview, but when the overview is hidden, only
> clicks on the panel will cause button-press-event to fire.
>
> My current code follows:
>
> const Main = imports.ui.main;
> const Lang = imports.lang;
>
> function init() { }
>
> function enable() {
> global.stage.connect('button-press-event', Lang.bind(this,
> function(actor, event) {
> if (event.get_button() == 9)
> this._toggleOverview();
> }));
> }
>
> function disable() { }
>
> function _toggleOverview() {
> if (Main.overview.visible)
> Main.overview.hide();
> else
> Main.overview.show();
> }
>
> - Kerrick
> _______________________________________________
> gnome-shell-list mailing list
> gnome-shell-list gnome org
> https://mail.gnome.org/mailman/listinfo/gnome-shell-list
--
Jasper
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]