| Commit message (Expand) | Author | Age | Files | Lines |
* | we need a tagset per monitor, removed tagset declaration from config.h | Anselm R Garbe | 2009-06-20 | 1 | -1/+0 |
* | experimental xinerama support, two new actions, Mod1-w/e and Mod1-Shift-w/e | Anselm R Garbe | 2009-06-20 | 1 | -1/+9 |
* | removed MAXTAGLEN | Anselm R Garbe | 2009-05-29 | 1 | -2/+2 |
* | applied Gottox' patches, and also removed usegrab | Anselm R Garbe | 2009-03-17 | 1 | -2/+0 |
* | applied Neale Pickett's xprop status reading patch, updated README and dwm.1 ... | a@null | 2008-12-12 | 1 | -1/+0 |
* | several changes towards 5.3, XINERAMA is disabled by default, introduced useg... | Anselm R Garbe | 2008-10-19 | 1 | -0/+2 |
* | introduced NOBORDER macro to hide the nasty - 2 * c->bw in various calculatio... | Anselm R Garbe | 2008-08-27 | 1 | -0/+1 |
* | added a comment about FAQ regarding mfact meaning | Anselm R Garbe | 2008-08-18 | 1 | -1/+1 |
* | made readin a config.h variable | Anselm R Garbe | 2008-08-02 | 1 | -0/+1 |
* | make hg tip compilable with default config | Premysl Hruby | 2008-07-18 | 1 | -2/+2 |
* | got rid of compile time xidx configuration, querying mouse pointer instead | Anselm R Garbe | 2008-07-16 | 1 | -4/+0 |
* | removed useless comment | Anselm R Garbe | 2008-07-02 | 1 | -1/+1 |
* | removed useless characters | Anselm R Garbe | 2008-06-24 | 1 | -3/+3 |
* | applied Gottox' ClkTagBar patch | Anselm R Garbe | 2008-06-20 | 1 | -15/+4 |
* | untested monocle | Anselm R Garbe | 2008-06-19 | 1 | -6/+9 |
* | branch merge 5.0 | Anselm R Garbe | 2008-06-17 | 1 | -1/+1 |
|\ |
|
| * | s/tags ref/tags mask/ | arg@suckless.org | 2008-06-15 | 1 | -1/+1 |
* | | tiled layout resizehints should be respected by default | Anselm R Garbe | 2008-06-17 | 1 | -2/+2 |
|/ |
|
* | removed scroll-wheel based focussing on window title clicks | Anselm R Garbe | 2008-06-14 | 1 | -2/+0 |
* | fix of swapped focusstack mouse buttons | Anselm R Garbe | 2008-06-14 | 1 | -2/+2 |
* | removed root window click handling | Anselm R Garbe | 2008-06-14 | 1 | -1/+0 |
* | removed font and color definitions | Anselm R Garbe | 2008-06-14 | 1 | -18/+21 |
* | update | Anselm R Garbe | 2008-06-12 | 1 | -1/+1 |
* | integrated yiyus mouse.diff (though the bar click handling is slightly broken... | Anselm R Garbe | 2008-06-11 | 1 | -25/+59 |
* | made Xinerama screen index customizable | Anselm R Garbe | 2008-06-11 | 1 | -4/+8 |
* | added nsz' patch | Anselm R Garbe | 2008-06-11 | 1 | -0/+3 |
* | integrated Peter Hartlich's patch, removed const char *c from union, simplifi... | Anselm R Garbe | 2008-06-11 | 1 | -4/+4 |
* | applied anydot's patchset.diff | Anselm R Garbe | 2008-06-11 | 1 | -35/+35 |
* | Gottox' drawtext simplification | Anselm R Garbe | 2008-06-01 | 1 | -1/+1 |
* | applied noviewprev.diff, fix.diff and unusedflags.diff | Anselm R Garbe | 2008-06-01 | 1 | -1/+1 |
* | removed Layout->updategeom, unnecessary | Anselm R Garbe | 2008-05-26 | 1 | -3/+3 |
* | applied yiyus domax patch with slight modifications | Anselm R Garbe | 2008-05-26 | 1 | -36/+16 |
* | s/int/uint/ in config.h | Anselm R Garbe | 2008-05-22 | 1 | -38/+38 |
* | setmfact argument was wrong | Anselm R Garbe | 2008-05-22 | 1 | -2/+2 |
* | applied Gottox bitmask + void *arg patch | Anselm R Garbe | 2008-05-22 | 1 | -43/+44 |
* | merged tile.c again into dwm.c | anselm@anselm1 | 2008-05-19 | 1 | -3/+1 |
* | recent changes, introduced togglebar, changed some defines into variable decl... | Anselm R Gar# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.
from __future__ import (absolute_import, division, print_function)
import curses
class MouseEvent(object):
PRESSED = [
0,
curses.BUTTON1_PRESSED,
curses.BUTTON2_PRESSED,
curses.BUTTON3_PRESSED,
curses.BUTTON4_PRESSED,
]
CTRL_SCROLLWHEEL_MULTIPLIER = 5
def __init__(self, getmouse):
"""Creates a MouseEvent object from the result of win.getmouse()"""
_, self.x, self.y, _, self.bstate = getmouse
# x-values above ~220 suddenly became negative, apparently
# it's sufficient to add 0xFF to fix that error.
if self.x < 0:
self.x += 0xFF
if self.y < 0:
self.y += 0xFF
def pressed(self, n):
"""Returns whether the mouse key n is pressed"""
try:
return (self.bstate & MouseEvent.PRESSED[n]) != 0
except IndexError:
return False
def mouse_wheel_direction(self):
"""Returns the direction of the scroll action, 0 if there was none"""
# If the bstate > ALL_MOUSE_EVENTS, it's an invalid mouse button.
# I interpret invalid buttons as "scroll down" because all tested
# systems have a broken curses implementation and this is a workaround.
# Recently it seems to have been fixed, as 2**21 was introduced as
# the code for the "scroll down" button.
if self.bstate & curses.BUTTON4_PRESSED:
return -self.CTRL_SCROLLWHEEL_MULTIPLIER if self.ctrl() else -1
elif self.bstate & curses.BUTTON2_PRESSED \
or self.bstate & 2**21 \
or self.bstate > curses.ALL_MOUSE_EVENTS:
return self.CTRL_SCROLLWHEEL_MULTIPLIER if self.ctrl() else 1
return 0
def ctrl(self):
return self.bstate & curses.BUTTON_CTRL
def alt(self):
return self.bstate & curses.BUTTON_ALT
def shift(self):
return self.bstate & curses.BUTTON_SHIFT
def key_invalid(self):
return self.bstate > curses.ALL_MOUSE_EVENTS
|