Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -53,7 +53,7 @@ public:
|
||||
,m_SESSION_EXIT_STEER_atom(None)
|
||||
{
|
||||
copy_dispatchers(a_from.m_dispatchers);
|
||||
if(!initialize()) {} //throw
|
||||
if(!initialize()) {} //throw
|
||||
}
|
||||
base_session& operator=(const base_session& a_from){
|
||||
if(&a_from==this) return *this;
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
clear_dispatchers();
|
||||
finalize();
|
||||
copy_dispatchers(a_from.m_dispatchers);
|
||||
if(!initialize()) {} //throw
|
||||
if(!initialize()) {} //throw
|
||||
return *this;
|
||||
}
|
||||
protected:
|
||||
@@ -101,7 +101,7 @@ protected:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void finalize() {
|
||||
if(!m_display) return;
|
||||
::XCloseDisplay(m_display);
|
||||
@@ -116,11 +116,11 @@ public:
|
||||
bool is_valid() const {return m_display?true:false;}
|
||||
|
||||
Display* display() const {return m_display;}
|
||||
|
||||
|
||||
bool steer() {
|
||||
if(!m_display) return false;
|
||||
|
||||
while(true) {
|
||||
while(true) {
|
||||
XEvent xevent;
|
||||
::XNextEvent(m_display,&xevent);
|
||||
if(xevent.type==ClientMessage) {
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
}
|
||||
dispatch(xevent);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
if(!m_display) return false;
|
||||
//::glXWaitX();
|
||||
::XSync(m_display,False);
|
||||
while(true) {
|
||||
while(true) {
|
||||
XEvent xevent;
|
||||
if(::XPending(m_display)) {
|
||||
::XNextEvent(m_display,&xevent);
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
if(xevent.xclient.data.l[0]==(long)m_SESSION_EXIT_STEER_atom) {
|
||||
a_to_exit = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
dispatch(xevent);
|
||||
a_to_exit = false;
|
||||
@@ -190,7 +190,7 @@ public:
|
||||
| ButtonPressMask | ButtonReleaseMask | ButtonMotionMask
|
||||
| PointerMotionMask
|
||||
| KeyPressMask;
|
||||
|
||||
|
||||
swa.background_pixel = ::XWhitePixel(m_display,m_monitor);
|
||||
|
||||
Window window = ::XCreateWindow(m_display,
|
||||
@@ -332,40 +332,40 @@ public:
|
||||
void add_dispatcher(dispatcher* a_dispatcher) {
|
||||
m_dispatchers.push_back(a_dispatcher); //take ownership.
|
||||
}
|
||||
|
||||
|
||||
void invalidate_dispatchers_with_window(Window a_win){
|
||||
tools_vforit(dispatcher*,m_dispatchers,it) {
|
||||
tools_vforit(dispatcher*,m_dispatchers,it) {
|
||||
if((*it)->window()==a_win) (*it)->invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void remove_dispatchers_with_window(Window a_win){
|
||||
tools_vforit_npp(dispatcher*,m_dispatchers,it) {
|
||||
tools_vforit_npp(dispatcher*,m_dispatchers,it) {
|
||||
if((*it)->window()==a_win) {
|
||||
dispatcher* obj = *it;
|
||||
it = m_dispatchers.erase(it);
|
||||
it = m_dispatchers.erase(it);
|
||||
delete obj;
|
||||
} else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool dispatch(XEvent& a_event) {
|
||||
{tools_vforit_npp(dispatcher*,m_dispatchers,it) {
|
||||
{tools_vforit_npp(dispatcher*,m_dispatchers,it) {
|
||||
if(!(*it)->is_valid()) {
|
||||
dispatcher* obj = *it;
|
||||
it = m_dispatchers.erase(it);
|
||||
it = m_dispatchers.erase(it);
|
||||
delete obj;
|
||||
} else {
|
||||
it++;
|
||||
}
|
||||
}}
|
||||
tools_vforit(dispatcher*,m_dispatchers,it) {
|
||||
tools_vforit(dispatcher*,m_dispatchers,it) {
|
||||
if((*it)->is_valid()) {
|
||||
if((*it)->dispatch(a_event)) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
protected:
|
||||
@@ -392,18 +392,18 @@ protected:
|
||||
Window m_window;
|
||||
};
|
||||
static Bool wait_for(Display*,XEvent* a_event,char* a_arg){
|
||||
wait_what* arg = (wait_what*)a_arg;
|
||||
return (a_event->type == arg->m_event_type) &&
|
||||
wait_what* arg = (wait_what*)a_arg;
|
||||
return (a_event->type == arg->m_event_type) &&
|
||||
(a_event->xmap.window == arg->m_window);
|
||||
}
|
||||
*/
|
||||
|
||||
void clear_dispatchers() {
|
||||
tools_vforit_npp(dispatcher*,m_dispatchers,it) {
|
||||
tools_vforit_npp(dispatcher*,m_dispatchers,it) {
|
||||
dispatcher* obj = *it;
|
||||
it = m_dispatchers.erase(it);
|
||||
it = m_dispatchers.erase(it);
|
||||
delete obj;
|
||||
}
|
||||
}
|
||||
m_dispatchers.clear();
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ protected:
|
||||
clear_dispatchers();
|
||||
tools_vforcit(dispatcher*,a_from,it) {
|
||||
m_dispatchers.push_back((*it)->copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace X11 {
|
||||
|
||||
class session : public base_session {
|
||||
typedef base_session parent;
|
||||
public:
|
||||
public:
|
||||
//virtual bool make_current(Window a_window) const {
|
||||
// if(!m_display) return false;
|
||||
// if(::glXMakeCurrent(m_display,a_window,m_ctx)==False) {
|
||||
@@ -47,13 +47,13 @@ public:
|
||||
,m_ctx(0)
|
||||
,m_colormap(0)
|
||||
{
|
||||
if(!initialize_gl()) {} //throw
|
||||
if(!initialize_gl()) {} //throw
|
||||
}
|
||||
session& operator=(const session& a_from){
|
||||
if(&a_from==this) return *this;
|
||||
parent::operator=(a_from);
|
||||
finalize_gl();
|
||||
if(!initialize_gl()) {} //throw
|
||||
if(!initialize_gl()) {} //throw
|
||||
return *this;
|
||||
}
|
||||
protected:
|
||||
@@ -64,9 +64,9 @@ protected:
|
||||
m_ctx = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
{int glxMajor, glxMinor;
|
||||
::glXQueryVersion(m_display,&glxMajor,&glxMinor);
|
||||
::glXQueryVersion(m_display,&glxMajor,&glxMinor);
|
||||
if(glxMajor<=0) {
|
||||
m_out << "tools::X11::session::initialize : bad GLX-Version " << glxMajor << "." << glxMinor << std::endl;
|
||||
::XCloseDisplay(m_display);
|
||||
@@ -95,7 +95,7 @@ protected:
|
||||
//m_out << "tools::X11::session::initialize :"
|
||||
// << " DefaultScreen(m_display): " << DefaultScreen(m_display) << "."
|
||||
// << std::endl;
|
||||
|
||||
|
||||
static const int atbs[] = {
|
||||
GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
@@ -154,7 +154,7 @@ protected:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void finalize_gl() {
|
||||
if(!m_display) return;
|
||||
if(m_ctx) {
|
||||
@@ -181,11 +181,11 @@ public:
|
||||
| ButtonPressMask | ButtonReleaseMask | ButtonMotionMask
|
||||
| PointerMotionMask
|
||||
| KeyPressMask;
|
||||
|
||||
|
||||
swa.colormap = m_colormap;
|
||||
swa.border_pixel = 0L;
|
||||
|
||||
Window window = ::XCreateWindow(m_display,
|
||||
Window window = ::XCreateWindow(m_display,
|
||||
::XRootWindow(m_display,m_monitor),
|
||||
a_x,a_y,a_width,a_height,
|
||||
0,
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
InputOutput,
|
||||
m_vinfo->visual,
|
||||
CWBorderPixel|CWColormap|CWEventMask,&swa);
|
||||
|
||||
|
||||
if(window==0L) {
|
||||
m_out << "tools::X11::session::create_window :"
|
||||
<< " can't create a X11 window."
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
}
|
||||
virtual Window window() const {return m_win;}
|
||||
public:
|
||||
simple_dispatcher(base_session& a_session,Window a_win)
|
||||
simple_dispatcher(base_session& a_session,Window a_win)
|
||||
:parent()
|
||||
,m_session(a_session)
|
||||
,m_win(a_win)
|
||||
|
||||
Reference in New Issue
Block a user