bool OBDisplay::_xinerama = false;
int OBDisplay::_xinerama_event_basep = 0;
unsigned int OBDisplay::_mask_list[8];
+unsigned int OBDisplay::_scrollLockMask = 0;
+unsigned int OBDisplay::_numLockMask = 0;
OBDisplay::ScreenInfoList OBDisplay::_screenInfoList;
BGCCache *OBDisplay::_gccache = (BGCCache*) 0;
int OBDisplay::_grab_count = 0;
// get lock masks that are defined by the display (not constant)
XModifierKeymap *modmap;
- unsigned int NumLockMask = 0, ScrollLockMask = 0;
modmap = XGetModifierMapping(display);
if (modmap && modmap->max_keypermod > 0) {
if (! modmap->modifiermap[cnt]) continue;
if (num_lock == modmap->modifiermap[cnt])
- NumLockMask = mask_table[cnt / modmap->max_keypermod];
+ _numLockMask = mask_table[cnt / modmap->max_keypermod];
if (scroll_lock == modmap->modifiermap[cnt])
- ScrollLockMask = mask_table[cnt / modmap->max_keypermod];
+ _scrollLockMask = mask_table[cnt / modmap->max_keypermod];
}
}
_mask_list[0] = 0;
_mask_list[1] = LockMask;
- _mask_list[2] = NumLockMask;
- _mask_list[3] = LockMask | NumLockMask;
- _mask_list[4] = ScrollLockMask;
- _mask_list[5] = ScrollLockMask | LockMask;
- _mask_list[6] = ScrollLockMask | NumLockMask;
- _mask_list[7] = ScrollLockMask | LockMask | NumLockMask;
+ _mask_list[2] = _numLockMask;
+ _mask_list[3] = LockMask | _numLockMask;
+ _mask_list[4] = _scrollLockMask;
+ _mask_list[5] = _scrollLockMask | LockMask;
+ _mask_list[6] = _scrollLockMask | _numLockMask;
+ _mask_list[7] = _scrollLockMask | LockMask | _numLockMask;
// Get information on all the screens which are available.
_screenInfoList.reserve(ScreenCount(display));
//! A list of all possible combinations of keyboard lock masks
static unsigned int _mask_list[8];
+ //! The value of the mask for the NumLock modifier
+ static unsigned int _numLockMask;
+
+ //! The value of the mask for the ScrollLock modifier
+ static unsigned int _scrollLockMask;
+
//! The number of requested grabs on the display
static int _grab_count;
//! Returns if the display has the xinerama extention available
inline static bool xinerama() { return _xinerama; }
+ inline static unsigned int numLockMask() { return _numLockMask; }
+ inline static unsigned int scrollLockMask() { return _scrollLockMask; }
+
//! Grabs the display
static void grab();
printf("Event %d window %lx\n", e.type, e.xany.window);
#endif
- // grab the lasttime
+ printf("num=%u scroll=%u\n", OBDisplay::numLockMask(), OBDisplay::scrollLockMask());
+
+ // grab the lasttime and hack up the modifiers
switch (e.type) {
case ButtonPress:
case ButtonRelease:
- _lasttime = e.xbutton.time; break;
+ _lasttime = e.xbutton.time;
+ e.xbutton.state &= ~(LockMask | OBDisplay::numLockMask() |
+ OBDisplay::scrollLockMask());
+ break;
+ case KeyPress:
+ e.xkey.state &= ~(LockMask | OBDisplay::numLockMask() |
+ OBDisplay::scrollLockMask());
+ break;
case MotionNotify:
- _lasttime = e.xmotion.time; break;
+ _lasttime = e.xmotion.time;
+ e.xmotion.state &= ~(LockMask | OBDisplay::numLockMask() |
+ OBDisplay::scrollLockMask());
+ break;
case PropertyNotify:
_lasttime = e.xproperty.time; break;
case EnterNotify:
}
+static PyObject *_wrap_OBDisplay_numLockMask(PyObject *self, PyObject *args) {
+ PyObject *resultobj;
+ unsigned int result;
+
+ if(!PyArg_ParseTuple(args,(char *)":OBDisplay_numLockMask")) goto fail;
+ result = (unsigned int)otk::OBDisplay::numLockMask();
+
+ resultobj = PyInt_FromLong((long)result);
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
+static PyObject *_wrap_OBDisplay_scrollLockMask(PyObject *self, PyObject *args) {
+ PyObject *resultobj;
+ unsigned int result;
+
+ if(!PyArg_ParseTuple(args,(char *)":OBDisplay_scrollLockMask")) goto fail;
+ result = (unsigned int)otk::OBDisplay::scrollLockMask();
+
+ resultobj = PyInt_FromLong((long)result);
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
static PyObject *_wrap_OBDisplay_grab(PyObject *self, PyObject *args) {
PyObject *resultobj;
{ (char *)"OBDisplay_shape", _wrap_OBDisplay_shape, METH_VARARGS },
{ (char *)"OBDisplay_shapeEventBase", _wrap_OBDisplay_shapeEventBase, METH_VARARGS },
{ (char *)"OBDisplay_xinerama", _wrap_OBDisplay_xinerama, METH_VARARGS },
+ { (char *)"OBDisplay_numLockMask", _wrap_OBDisplay_numLockMask, METH_VARARGS },
+ { (char *)"OBDisplay_scrollLockMask", _wrap_OBDisplay_scrollLockMask, METH_VARARGS },
{ (char *)"OBDisplay_grab", _wrap_OBDisplay_grab, METH_VARARGS },
{ (char *)"OBDisplay_ungrab", _wrap_OBDisplay_ungrab, METH_VARARGS },
{ (char *)"OBDisplay_grabButton", _wrap_OBDisplay_grabButton, METH_VARARGS },