Ignore:
Timestamp:
Dec 5, 2008, 2:48:29 PM (16 years ago)
Author:
garnier
Message:

x,y position should be ok

Location:
trunk/source/visualization/OpenGL
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/visualization/OpenGL/History

    r897 r898  
    3030
    3131 - G4OpenGLQtViewer.hh : Suppress WinSize private variable
     32 - Now Could pass XString like 400x600-0+0 to viewers and set position and location. It
     33   will work for Qt, X, Win32 for the moment.
    3234
    333524 October, Laurent Garnier
  • trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r897 r898  
    5555#include <qprocess.h>
    5656#include <qapplication.h>
     57#include <qdesktopwidget.h>
    5758
    5859#if QT_VERSION >= 0x040000
     
    186187  GLWindow->setWindowTitle( name);
    187188#endif
    188   GLWindow->resize(fVP.GetWindowSizeHintX(), fVP.GetWindowSizeHintY());
    189   GLWindow->move(900,300);
     189  fWinSize_x = fVP.GetWindowSizeHintX();
     190  fWinSize_y = fVP.GetWindowSizeHintY();
     191
     192  //useful for MACOSX, we have to compt the menuBar height
     193  unsigned int offset = QApplication::desktop()->height()
     194                      - QApplication::desktop()->availableGeometry().height();
     195
     196  G4int YPos= fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height());
     197  if (fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height())< offset) {
     198    YPos = offset;
     199  }
     200  GLWindow->resize(fWinSize_x, fWinSize_y);
     201  GLWindow->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos);
    190202  GLWindow->show();
    191203 
    192   // delete the pointer if close this
    193   //  GLWindow->setAttribute(Qt::WA_DeleteOnClose);
    194 
    195 #if QT_VERSION >= 0x040000
    196 //   QObject ::connect(GLWindow,
    197 //                     SIGNAL(rejected()),
    198 //                     this,
    199 //                     SLOT(dialogClosed()));
    200 #endif
    201 
    202204  if(!fWindow) return;
    203205#ifdef G4DEBUG
  • trunk/source/visualization/OpenGL/src/G4OpenGLWin32Viewer.cc

    r897 r898  
    117117  } 
    118118 
     119  fWinSize_x = fVP.GetWindowSizeHintX();
     120  fWinSize_y = fVP.GetWindowSizeHintY();
     121  int x_res=GetSystemMetrics(SM_CXSCREEN);
     122  int y_res=GetSystemMetrics(SM_CYSCREEN);
     123 
     124  //FIXME : NOT tested !
    119125  fWindow = ::CreateWindow(className,fName.c_str(),
    120126                           WS_OVERLAPPEDWINDOW,
    121127                           //WS_CHILD | WS_VISIBLE,
    122                            0,0,
     128                           //                      0,0,
     129                           fVP.GetWindowAbsoluteLocationHintX(x_res),
     130                           fVP.GetWindowAbsoluteLocationHintY(y_res),
    123131                           fWinSize_x,fWinSize_y,
    124132                           NULL, NULL,
  • trunk/source/visualization/OpenGL/src/G4OpenGLXViewer.cc

    r897 r898  
    214214
    215215  // Window size and position...
    216   G4int x_origin = 0;
    217   G4int y_origin = 0;
    218216  size_hints = XAllocSizeHints();
    219 
    220   Window root_return;
    221   int x_return, y_return;
    222   unsigned int width_return, height_return;
    223   unsigned int border_width_return;
    224   unsigned int depth_return;
    225  
    226   // get the parent window's geometry
    227   XGetGeometry(dpy, XRootWindow (dpy, vi -> screen), &root_return, &x_return, &y_return,
    228                &width_return, &height_return, &border_width_return,
    229                &depth_return);
    230  
     217   
    231218  fWinSize_x = fVP.GetWindowSizeHintX();
    232219  fWinSize_y = fVP.GetWindowSizeHintY();
    233   x_origin = fVP.GetWindowAbsoluteLocationHintX(width_return);
    234   y_origin = fVP.GetWindowAbsoluteLocationHintY(height_return);
     220  G4int x_origin = fVP.GetWindowAbsoluteLocationHintX(DisplayWidth(dpy, vi -> screen));
     221  G4int y_origin = fVP.GetWindowAbsoluteLocationHintY(DisplayHeight(dpy, vi -> screen));
     222
    235223  size_hints->base_width = fWinSize_x;
    236224  size_hints->base_height = fWinSize_y;
  • trunk/source/visualization/OpenGL/src/G4OpenGLXmViewer.cc

    r897 r898  
    126126  borcol = XBlackPixelOfScreen (XtScreen(shell));
    127127 
     128  fWinSize_x = fVP.GetWindowSizeHintX();
     129  fWinSize_y = fVP.GetWindowSizeHintY();
     130  G4int x_origin = fVP.GetWindowAbsoluteLocationHintX(DisplayWidth(dpy, vi -> screen));
     131  G4int y_origin = fVP.GetWindowAbsoluteLocationHintY(DisplayHeight(dpy, vi -> screen));
     132
    128133  XtVaSetValues (shell,
    129134                 XtNvisual, vi -> visual,
    130                  XtNdepth, vi -> depth, 
     135                 XtNdepth, vi -> depth,
    131136                 XtNcolormap, cmap,
     137                 XtNwidth, fWinSize_x,
     138                 XtNheight, fWinSize_y,
     139                 XtNx, x_origin,
     140                 XtNy, y_origin,
    132141                 XtNborderColor, &borcol,
    133142                 XtNbackground, &bgnd,
     
    593602  // Once widget is realized (ie, associated with a created X window), we
    594603  // can bind the OpenGL rendering context to the window.
    595 
    596   Dimension width, height;
    597   XtVaGetValues (glxarea,XmNwidth,&width,XmNheight,&height,NULL);
    598   fWinSize_x = (unsigned int) width;
    599   fWinSize_y = (unsigned int) height;
    600604
    601605  win = XtWindow (glxarea);
Note: See TracChangeset for help on using the changeset viewer.