diff options
| author | Dana Jansens <danakj@orodu.net> | 2002-11-03 11:46:05 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2002-11-03 11:46:05 +0000 |
| commit | ace8c8896aa13a6fc4e489277cf9c96f49175322 (patch) | |
| tree | 69748320de56b6c0c1fccdefc768b2b12ab012b7 /otk | |
| parent | 37e56007680a6664967e0e71ac52981654def6a6 (diff) | |
WE DONT USE BASE DISPLAY FOR ANYTHING ANY MORE!!@^!*@*!! YAY
Diffstat (limited to 'otk')
| -rw-r--r-- | otk/Makefile.am | 2 | ||||
| -rw-r--r-- | otk/display.cc | 55 | ||||
| -rw-r--r-- | otk/display.hh | 13 | ||||
| -rw-r--r-- | otk/screeninfo.cc | 10 |
4 files changed, 72 insertions, 8 deletions
diff --git a/otk/Makefile.am b/otk/Makefile.am index 4a2b9f84..7f862287 100644 --- a/otk/Makefile.am +++ b/otk/Makefile.am @@ -5,7 +5,7 @@ INCLUDES= -I../src noinst_LIBRARIES=libotk.a libotk_a_SOURCES= color.cc display.cc font.cc gccache.cc image.cc \ - imagecontrol.cc rect.cc texture.cc + imagecontrol.cc rect.cc screeninfo.cc texture.cc MAINTAINERCLEANFILES= Makefile.in diff --git a/otk/display.cc b/otk/display.cc index 9e6685b9..45924428 100644 --- a/otk/display.cc +++ b/otk/display.cc @@ -39,7 +39,14 @@ extern "C" { namespace otk { -Display *display = (Display*) 0; +Display *OBDisplay::display = (Display*) 0; +bool OBDisplay::_shape = false; +int OBDisplay::_shape_event_basep; +bool OBDisplay::_xinerama = false; +int OBDisplay::_xinerama_event_basep; +unsigned int OBDisplay::_mask_list[8]; +OBDisplay::ScreenInfoList OBDisplay::_screenInfoList; +BGCCache *OBDisplay::_gccache = (BGCCache*) 0; int OBDisplay::xerrorHandler(Display *d, XErrorEvent *e) @@ -90,14 +97,10 @@ line argument.\n\n")); // find the availability of X extensions we like to use #ifdef SHAPE _shape = XShapeQueryExtension(display, &_shape_event_basep, &junk); -#else - _shape = false; #endif #ifdef XINERAMA _xinerama = XineramaQueryExtension(display, &_xinerama_event_basep, &junk); -#else - _xinerama = false; #endif // XINERAMA // get lock masks that are defined by the display (not constant) @@ -155,4 +158,46 @@ void OBDisplay::destroy() } + + + + + + + + + +/* + * Grabs a button, but also grabs the button in every possible combination + * with the keyboard lock keys, so that they do not cancel out the event. + + * if allow_scroll_lock is true then only the top half of the lock mask + * table is used and scroll lock is ignored. This value defaults to false. + */ +void OBDisplay::grabButton(unsigned int button, unsigned int modifiers, + Window grab_window, bool owner_events, + unsigned int event_mask, int pointer_mode, + int keyboard_mode, Window confine_to, + Cursor cursor, bool allow_scroll_lock) { + unsigned int length = (allow_scroll_lock) ? 8 / 2: + 8; + for (size_t cnt = 0; cnt < length; ++cnt) + XGrabButton(otk::OBDisplay::display, button, modifiers | _mask_list[cnt], + grab_window, owner_events, event_mask, pointer_mode, + keyboard_mode, confine_to, cursor); +} + + +/* + * Releases the grab on a button, and ungrabs all possible combinations of the + * keyboard lock keys. + */ +void OBDisplay::ungrabButton(unsigned int button, unsigned int modifiers, + Window grab_window) { + for (size_t cnt = 0; cnt < 8; ++cnt) + XUngrabButton(otk::OBDisplay::display, button, modifiers | _mask_list[cnt], + grab_window); +} + + } diff --git a/otk/display.hh b/otk/display.hh index aa457bcd..7724bbab 100644 --- a/otk/display.hh +++ b/otk/display.hh @@ -62,6 +62,19 @@ public: inline static int shapeEventBase() { return _shape_event_basep; } //! Returns if the display has the xinerama extention available inline static bool xinerama() { return _xinerama; } + + + + + + /* TEMPORARY */ + static void grabButton(unsigned int button, unsigned int modifiers, + Window grab_window, bool owner_events, + unsigned int event_mask, int pointer_mode, + int keyboard_mode, Window confine_to, Cursor cursor, + bool allow_scroll_lock); + static void ungrabButton(unsigned int button, unsigned int modifiers, + Window grab_window); }; } diff --git a/otk/screeninfo.cc b/otk/screeninfo.cc index 22ec6d02..c1c0c2ac 100644 --- a/otk/screeninfo.cc +++ b/otk/screeninfo.cc @@ -4,8 +4,14 @@ # include "../config.h" #endif // HAVE_CONFIG_H +extern "C" { +#include <X11/Xlib.h> +#include <X11/Xutil.h> +} + #include "screeninfo.hh" #include "display.hh" +#include "src/util.hh" using std::string; @@ -14,7 +20,7 @@ namespace otk { ScreenInfo::ScreenInfo(unsigned int num) { screen_number = num; - root_window = RootWindow(ob::OBDisplay::display, screen_number); + root_window = RootWindow(OBDisplay::display, screen_number); rect.setSize(WidthOfScreen(ScreenOfDisplay(OBDisplay::display, screen_number)), @@ -73,7 +79,7 @@ ScreenInfo::ScreenInfo(unsigned int num) { default_string.resize(pos); display_string = string("DISPLAY=") + default_string + '.' + - itostring(static_cast<unsigned long>(screen_number)); + ob::itostring(static_cast<unsigned long>(screen_number)); #ifdef XINERAMA xinerama_active = False; |
