Difference for arch/ogl/glx.c from version 1.13 to 1.14


version 1.13 version 1.14
Line 12
 
Line 12
 #include <X11/extensions/xf86vmode.h>  #include <X11/extensions/xf86vmode.h>
 #endif  #endif
   
 static int attribs[]={GLX_RGBA,GLX_DOUBLEBUFFER,GLX_DEPTH_SIZE,0,GLX_STENCIL_SIZE,0,  
  GLX_ACCUM_RED_SIZE,0,GLX_ACCUM_GREEN_SIZE,0,GLX_ACCUM_BLUE_SIZE,0,GLX_ACCUM_ALPHA_SIZE,0,None};  #include <X11/Xatom.h>
   
   //#define HAVE_MOTIF
   #ifdef HAVE_MOTIF
   
   #include <X11/Xm/MwmUtil.h>
   
   #else
   
   /* bit definitions for MwmHints.flags */
   #define MWM_HINTS_FUNCTIONS (1L << 0)
   #define MWM_HINTS_DECORATIONS (1L << 1)
   #define MWM_HINTS_INPUT_MODE (1L << 2)
   #define MWM_HINTS_STATUS (1L << 3)
   
   /* bit definitions for MwmHints.functions */
   #define MWM_FUNC_ALL            (1L << 0)
   #define MWM_FUNC_RESIZE         (1L << 1)
   #define MWM_FUNC_MOVE           (1L << 2)
   #define MWM_FUNC_MINIMIZE       (1L << 3)
   #define MWM_FUNC_MAXIMIZE       (1L << 4)
   #define MWM_FUNC_CLOSE          (1L << 5)
   
   
   /* bit definitions for MwmHints.decorations */
   #define MWM_DECOR_ALL  (1L << 0)
   #define MWM_DECOR_BORDER (1L << 1)
   #define MWM_DECOR_RESIZEH (1L << 2)
   #define MWM_DECOR_TITLE  (1L << 3)
   #define MWM_DECOR_MENU  (1L << 4)
   #define MWM_DECOR_MINIMIZE (1L << 5)
   #define MWM_DECOR_MAXIMIZE (1L << 6)
   
   typedef struct
   {
    unsigned long flags;
    unsigned long functions;
    unsigned long decorations;
    long          inputMode;
    unsigned long status;
   } PropMotifWmHints;
   
   #define PROP_MOTIF_WM_HINTS_ELEMENTS 5
   
   #endif
   
   
   
   /*
    * Specify which Motif window manager border decorations to put on a * top-level window.  For example, you can specify that
    a window is not * resizabe, or omit the titlebar, or completely remove all decorations. * Input:  dpy - the X display
    *        w - the X window
    *        flags - bitwise-OR of the MWM_DECOR_xxx symbols in
    X11/Xm/MwmUtil.h
    *                indicating what decoration elements to enable.  Zero would
    *                be no decoration.
    */
   void set_mwm_border( Display *dpy, Window w, unsigned long dflags,unsigned long fflags ) {
    PropMotifWmHints motif_hints;
    Atom prop, proptype;
   
    /* setup the property */
    motif_hints.flags = MWM_HINTS_DECORATIONS|MWM_HINTS_FUNCTIONS;
    motif_hints.decorations = dflags;
    motif_hints.functions = fflags;
   
    /* get the atom for the property */
    prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True );   if (!prop) {
    mprintf((0,"set_mwm_border: prop==0\n"));
    /* something went wrong! */
    return;
    }
   
    /* not sure this is correct, seems to work, XA_WM_HINTS didn't work */   proptype = prop;
   
    XChangeProperty( dpy, w, /* display, window */ prop, proptype, /* property, type */
    32, /* format: 32-bit datums */ PropModeReplace, /* mode */
    (unsigned char *) &motif_hints, /* data */ PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */);
   }
   
 int glx_erbase,glx_evbase;  int glx_erbase,glx_evbase;
 Display *dpy;  Display *dpy;
Line 24
 
Line 102
 Pixmap blankpixmap=None;  Pixmap blankpixmap=None;
 Cursor blankcursor=None;  Cursor blankcursor=None;
   
   
   void set_wm_hints(int fullscreen){
    XSizeHints *hints=NULL;
   
   
   // return;//seems screwed.
    if (!hints) hints=XAllocSizeHints();
    hints->width=hints->min_width=hints->max_width=hints->base_width=grd_curscreen->sc_w;
    hints->height=hints->min_height=hints->max_height=hints->base_height=grd_curscreen->sc_h;
    hints->flags=PSize|PMinSize|PMaxSize|PBaseSize;
   // hints->min_width=hints->max_width=grd_curscreen->sc_w;
   // hints->min_height=hints->max_height=grd_curscreen->sc_h;
   // hints->flags=PMinSize|PMaxSize;
    XSetWMNormalHints(dpy,win,hints);
    XFree(hints);
    if (fullscreen){
    set_mwm_border(dpy,win,0,0);
    }else{
    set_mwm_border(dpy,win,MWM_DECOR_TITLE|MWM_DECOR_BORDER,MWM_FUNC_MOVE|MWM_FUNC_CLOSE);
    }
   }
   
   static int attribs[]={GLX_RGBA,GLX_DOUBLEBUFFER,GLX_DEPTH_SIZE,0,GLX_STENCIL_SIZE,0,
    GLX_ACCUM_RED_SIZE,0,GLX_ACCUM_GREEN_SIZE,0,GLX_ACCUM_BLUE_SIZE,0,GLX_ACCUM_ALPHA_SIZE,0,None};
   
 void ogl_do_fullscreen_internal(void){  void ogl_do_fullscreen_internal(void){
 // ogl_smash_texture_list_internal();//not needed  // ogl_smash_texture_list_internal();//not needed
  if (ogl_fullscreen){   if (ogl_fullscreen){
    set_wm_hints(1);
  XMoveWindow(dpy,win,0,0);   XMoveWindow(dpy,win,0,0);
  // XDefineCursor(dpy,win,blankcursor);   // XDefineCursor(dpy,win,blankcursor);
  //XGrabPointer(dpy,win,0,swa.event_mask,GrabModeAsync,GrabModeAsync,win,blankcursor,CurrentTime);   //XGrabPointer(dpy,win,0,swa.event_mask,GrabModeAsync,GrabModeAsync,win,blankcursor,CurrentTime);
Line 39
 
Line 143
  //might have to kill the window/context/whatever first?  HRm.   //might have to kill the window/context/whatever first?  HRm.
 #endif  #endif
  }else{   }else{
    set_wm_hints(0);
  // XUndefineCursor(dpy,win);   // XUndefineCursor(dpy,win);
  XUngrabPointer(dpy,CurrentTime);   XUngrabPointer(dpy,CurrentTime);
  // XUngrabKeyboard(dpy,CurrentTime);   // XUngrabKeyboard(dpy,CurrentTime);
Line 62
 
Line 167
  //create window   //create window
  swa.border_pixel=0;   swa.border_pixel=0;
  swa.event_mask=ExposureMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask| ButtonPressMask | ButtonReleaseMask | PointerMotionMask;   swa.event_mask=ExposureMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask| ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
  win = XCreateWindow(dpy,RootWindow(dpy,visinfo->screen),0,0,x,y,0,visinfo->depth,InputOutput,visinfo->visual,CWBorderPixel|CWColormap|CWEventMask,&swa);   //win = XCreateWindow(dpy,RootWindow(dpy,visinfo->screen),0,0,x,y,0,visinfo->depth,InputOutput,visinfo->visual,CWBorderPixel|CWColormap|CWEventMask,&swa);
    win = XCreateWindow(dpy,RootWindow(dpy,visinfo->screen),0,0,x,y,0,visinfo->depth,InputOutput,visinfo->visual,CWColormap|CWEventMask,&swa);
   
  XStoreName(dpy,win,DESCENT_VERSION " " D1X_DATE);   XStoreName(dpy,win,DESCENT_VERSION " " D1X_DATE);
 // XStoreName(dpy,win,"agry");  // XStoreName(dpy,win,"agry");
   
  XMapWindow(dpy,win);   XMapWindow(dpy,win);
   
  glXMakeCurrent(dpy,win,glxcontext);   glXMakeCurrent(dpy,win,glxcontext);
   
    set_wm_hints(ogl_fullscreen);
   
  gl_initialized=1;   gl_initialized=1;
   

Legend:
line(s) removed in v.1.13 
line(s) changed
 line(s) added in v.1.14