3 //============================================================================
7 // X11 Pixel Port class
9 //============================================================================
13 #include <X11/Xutil.h>
17 const long X11WindowDefaultInput = KeyPressMask | KeyReleaseMask |
18 ButtonPressMask | ButtonReleaseMask |
20 ExposureMask | StructureNotifyMask;
26 X11Window( const char* name, Display* dis = 0, int scr = 0,
27 int swidth = 320, int sheight = 200,
28 long inputMask = X11WindowDefaultInput );
38 int error() const { return _err; }
40 char* errorStr() const { return ErrorMessage[ _err ]; }
42 Display* display() { return _display; }
44 int screen() { return _screen; }
46 Window window() { return _win; }
48 void setTitle( const char* text );
49 void setIconName( const char* text );
51 int width() { return _width; }
52 int height() { return _height; }
54 int displayWidth() { return XDisplayWidth( _display, _screen ); }
55 int displayHeight() { return XDisplayHeight( _display, _screen ); }
57 void move( int x, int y );
58 void moveResize( int x, int y, unsigned int w, unsigned int h );
59 void resize( unsigned int newWidth, unsigned int newHeight );
60 void setSizeHints( int minW, int minH, int maxW, int maxH );
72 int eventsPending() { return XPending( _display ); }
73 void handleNextEvent();
75 void flush() { XFlush( _display ); }
76 void sync( Bool discard = False ) { XSync( _display, discard ); }
81 KeySym keysym( XKeyEvent* event );
85 // These virtual event methods are called during handleNextEvent()
87 virtual void unknownEvent( XEvent* );
88 virtual void deleteEvent( XEvent* );
89 virtual void configureEvent( XConfigureEvent* );
90 virtual void buttonDown( XButtonEvent* );
91 virtual void buttonUp( XButtonEvent* );
92 virtual void motionEvent( XMotionEvent* );
93 virtual void keyDown( XKeyEvent* );
94 virtual void keyUp( XKeyEvent* );
95 virtual void focusIn( XFocusChangeEvent* );
96 virtual void focusOut( XFocusChangeEvent* );
97 virtual void exposeEvent( XExposeEvent* );
101 Cursor _createNullCursor();
105 static char* ErrorMessage[];
107 void _set( int mask ) { _flags |= mask; }
108 void _clr( int mask ) { _flags &= ~mask; }
112 kOpenedDisplay = 0x0001
115 Display* _display; // The X11 display connection
117 Window _win; // The X11 window on the display
121 //GC _gc; // The window's current graphics context
130 #endif // X11WINDOW_H