| version 1.8 | | version 1.9 |
|---|
| | |
| //opengl platform specific functions for GLX - Added 9/15/99 Matthew Mueller | | //opengl platform specific functions for GLX - Added 9/15/99 Matthew Mueller |
| #include <X11/Xlib.h> | | #include <X11/Xlib.h> |
| #include <GL/glx.h> | | #include <GL/glx.h> |
| | | #include <string.h> |
| #include "ogl_init.h" | | #include "ogl_init.h" |
| #include "vers_id.h" | | #include "vers_id.h" |
| #include "error.h" | | #include "error.h" |
| #include "event.h" | | #include "event.h" |
| | | #include "mono.h" |
| #ifdef XFREE86_DGA | | #ifdef XFREE86_DGA |
| #include <X11/extensions/xf86dga.h> | | #include <X11/extensions/xf86dga.h> |
| #include <X11/extensions/xf86vmode.h> | | #include <X11/extensions/xf86vmode.h> |
| | |
| XVisualInfo *visinfo; | | XVisualInfo *visinfo; |
| GLXContext glxcontext; | | GLXContext glxcontext; |
| static int fullscreen=0; | | static int fullscreen=0; |
| | | Pixmap blankpixmap; |
| | | Cursor blankcursor; |
| | | |
| int gr_check_fullscreen(void){ | | int gr_check_fullscreen(void){ |
| return fullscreen; | | return fullscreen; |
| } | | } |
| int gr_toggle_fullscreen(void){ | | void gr_do_fullscreen(int f){ |
| fullscreen^=1; | | fullscreen=f; |
| // grd_curscreen->sc_mode=0;//hack to get it to reset screen mode | | |
| if (gl_initialized){ | | if (gl_initialized){ |
| if (fullscreen){ | | if (fullscreen){ |
| XMoveWindow(dpy,win,0,0); | | XMoveWindow(dpy,win,0,0); |
| | | // XDefineCursor(dpy,win,blankcursor); |
| | | //XGrabPointer(dpy,win,0,swa.event_mask,GrabModeAsync,GrabModeAsync,win,blankcursor,CurrentTime); |
| | | XGrabPointer(dpy,win,1,ButtonPressMask | ButtonReleaseMask | PointerMotionMask,GrabModeAsync,GrabModeAsync,win,blankcursor,CurrentTime); |
| | | // XGrabKeyboard(dpy,win,1,GrabModeAsync,GrabModeAsync,CurrentTime);//grabbing keyboard doesn't seem to do much good anyway. |
| | | |
| #ifdef XFREE86_DGA | | #ifdef XFREE86_DGA |
| //make fullscreen | | //make fullscreen |
| //can you even do this with DGA ? just resizing with ctrl-alt-(-/+) caused X to die a horrible death. | | //can you even do this with DGA ? just resizing with ctrl-alt-(-/+) caused X to die a horrible death. |
| //might have to kill the window/context/whatever first? HRm. | | //might have to kill the window/context/whatever first? HRm. |
| #endif | | #endif |
| }else{ | | }else{ |
| | | // XUndefineCursor(dpy,win); |
| | | XUngrabPointer(dpy,CurrentTime); |
| | | // XUngrabKeyboard(dpy,CurrentTime); |
| #ifdef XFREE86_DGA | | #ifdef XFREE86_DGA |
| //return to normal | | //return to normal |
| #endif | | #endif |
| } | | } |
| } | | } |
| | | } |
| | | int gr_toggle_fullscreen(void){ |
| | | gr_do_fullscreen(!fullscreen); |
| | | // grd_curscreen->sc_mode=0;//hack to get it to reset screen mode |
| return fullscreen; | | return fullscreen; |
| } | | } |
| | | |
| | |
| glXMakeCurrent(dpy,win,glxcontext); | | glXMakeCurrent(dpy,win,glxcontext); |
| | | |
| gl_initialized=1; | | gl_initialized=1; |
| | | |
| | | { |
| | | XColor blankcolor; |
| | | unsigned char *blankdata; |
| | | int w,h; |
| | | XQueryBestCursor(dpy,win,1,1,&w,&h); |
| | | // mprintf((0,"bestcursor %ix%i\n",w,h)); |
| | | blankdata=malloc(w*h/8); |
| | | memset(blankdata,0,w*h/8); |
| | | memset(&blankcolor,0,sizeof(XColor)); |
| | | blankpixmap=XCreateBitmapFromData(dpy,win,blankdata,w,h); |
| | | blankcursor=XCreatePixmapCursor(dpy,blankpixmap,blankpixmap,&blankcolor,&blankcolor,w,h); |
| | | free(blankdata); |
| | | // sleep(1); |
| | | } |
| | | |
| | | if (fullscreen) |
| | | gr_do_fullscreen(fullscreen); |
| | | } |
| #ifdef GII_XWIN | | #ifdef GII_XWIN |
| init_gii_xwin(dpy,win); | | init_gii_xwin(dpy,win); |
| #endif | | #endif |
| if (fullscreen) | | |
| XMoveWindow(dpy,win,0,0); | | |
| } | | |
| return 0; | | return 0; |
| } | | } |
| void ogl_destroy_window(void){ | | void ogl_destroy_window(void){ |
| | |
| Error("no visual\n"); | | Error("no visual\n"); |
| } | | } |
| void ogl_close(void){ | | void ogl_close(void){ |
| | | gr_do_fullscreen(0); |
| ogl_destroy_window(); | | ogl_destroy_window(); |
| | | XFreeCursor(dpy,blankcursor); |
| | | XFreePixmap(dpy,blankpixmap); |
| XCloseDisplay(dpy); | | XCloseDisplay(dpy); |
| } | | } |