Import Geant4 11.1.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2022-07-01 10:44:02 +02:00
parent b3bf75a2a1
commit c07cea1fe0
2172 changed files with 183300 additions and 123938 deletions
+77
View File
@@ -0,0 +1,77 @@
// Copyright (C) 2010, Guy Barrand. All rights reserved.
// See the file tools.license for terms.
#ifndef toolx_Xt_session
#define toolx_Xt_session
#include <ostream>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/StringDefs.h>
namespace toolx {
namespace Xt {
class session {
public:
session(std::ostream& a_out,int& a_argc,char** a_argv)
:m_out(a_out),m_app_context(0),m_app_widget(0)
{
//LookDSM_Problem();
Arg args[1];
XtSetArg(args[0],XtNgeometry,XtNewString("100x100"));
m_app_widget = ::XtAppInitialize(&m_app_context,"toolx::Xt::session",NULL,(Cardinal)0,&a_argc,a_argv,NULL,args,1);
if(!m_app_context || !m_app_widget) {
m_app_context = 0;
m_app_widget = 0;
}
}
virtual ~session() {
if(m_app_widget) {::XtDestroyWidget(m_app_widget);m_app_widget = 0;}
if(m_app_context) {::XtDestroyApplicationContext(m_app_context);m_app_context = 0;}
}
protected:
session(const session& a_from)
:m_out(a_from.m_out),m_app_context(0),m_app_widget(0)
{}
session& operator=(const session&){return *this;}
public:
std::ostream& out() const {return m_out;}
bool is_valid() {return m_app_context && m_app_widget?true:false;}
bool steer() {
if(!m_app_context) return false;
while(true) {
XEvent event;
::XtAppNextEvent(m_app_context,&event);
::XtDispatchEvent(&event);
//if(m_exit) break;
}
return true;
}
bool sync() {
//if(!m_app_widget) return false;
//Display* display = XtDisplay(m_app_widget);
//::XSync(display,False);
if(!m_app_context) return false;
while(true) {
XtInputMask input = ::XtAppPending(m_app_context);
if(input==0) break;
XEvent event;
::XtAppNextEvent(m_app_context,&event);
::XtDispatchEvent(&event);
}
return true;
}
public:
Widget get_app_widget() {return m_app_widget;}
protected:
std::ostream& m_out;
bool m_app_owner;
XtAppContext m_app_context;
Widget m_app_widget;
};
}}
#endif