Doxygen Source Code Documentation
glutint.h File Reference
#include <X11/Xlib.h>
#include <GL/glx.h>
#include <GL/glut.h>
#include <sys/types.h>
#include <sys/time.h>
Go to the source code of this file.
Define Documentation
|
Value: { \ if(((dest).tv_usec = \ (src1).tv_usec + (src2).tv_usec) >= 1000000) { \ (dest).tv_usec -= 1000000; \ (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \ } else { \ (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \ if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \ (dest).tv_sec --;(dest).tv_usec += 1000000; \ } \ } \ } Definition at line 55 of file glutint.h. Referenced by glutTimerFunc(). |
|
Definition at line 53 of file glutint.h. Referenced by __glutInitTime(), glutGet(), glutTimerFunc(), handleTimeouts(), and waitForSomething(). |
|
Definition at line 99 of file glutint.h. Referenced by glutCopyColormap(), glutCreateSubWindow(), glutDestroyWindow(), glutEstablishOverlay(), glutRemoveOverlay(), glutSetColor(), and processWindowWorkList(). |
|
Definition at line 98 of file glutint.h. Referenced by glutFullScreen(), glutPopWindow(), glutPositionWindow(), glutPushWindow(), glutReshapeWindow(), and processWindowWorkList(). |
|
Definition at line 102 of file glutint.h. Referenced by __glutSetWindow(), and processWindowWorkList(). |
|
Definition at line 100 of file glutint.h. Referenced by glutButtonBoxFunc(), glutDialsFunc(), glutSpaceballButtonFunc(), glutSpaceballMotionFunc(), glutSpaceballRotateFunc(), glutTabletButtonFunc(), glutTabletMotionFunc(), and processWindowWorkList(). |
|
Value: (ButtonReleaseMask | \ ButtonPressMask | \ KeyPressMask | \ KeyReleaseMask | \ PointerMotionMask | \ Button1MotionMask | \ Button2MotionMask | \ Button3MotionMask) Definition at line 289 of file glutint.h. Referenced by __glutCreateWindow(), and processWindowWorkList(). |
|
Definition at line 103 of file glutint.h. Referenced by processWindowWorkList(). |
|
Definition at line 96 of file glutint.h. Referenced by __glutChangeWindowEventMask(), and processWindowWorkList(). |
|
Definition at line 101 of file glutint.h. Referenced by __glutSetWindow(), and processWindowWorkList(). |
|
Definition at line 104 of file glutint.h. Referenced by glutFullScreen(), and processWindowWorkList(). |
|
Value: (KeyPressMask | \ KeyReleaseMask) Definition at line 298 of file glutint.h. Referenced by __glutCreateWindow(), and processWindowWorkList(). |
|
Definition at line 95 of file glutint.h. Referenced by __glutCreateWindow(), glutHideWindow(), glutIconifyWindow(), glutShowWindow(), and processWindowWorkList(). |
|
Definition at line 190 of file glutint.h. Referenced by __glutCreateWindow(). |
|
Value: (ExposureMask | \ StructureNotifyMask | \ EnterWindowMask | \ LeaveWindowMask) Definition at line 284 of file glutint.h. Referenced by glutEstablishOverlay(), and processWindowWorkList(). |
|
Definition at line 105 of file glutint.h. Referenced by glutPostOverlayRedisplay(), processEvents(), and processWindowWorkList(). |
|
Definition at line 97 of file glutint.h. Referenced by __glutPostRedisplay(), glutPostRedisplay(), processEvents(), and processWindowWorkList(). |
|
Definition at line 88 of file glutint.h. Referenced by checkOverlayAcceptability(), and getVisualInfoRGB(). |
|
Definition at line 89 of file glutint.h. Referenced by checkOverlayAcceptability(), and getVisualInfoRGB(). |
|
Definition at line 90 of file glutint.h. Referenced by checkOverlayAcceptability(), getVisualInfoCI(), and getVisualInfoRGB(). |
|
Definition at line 91 of file glutint.h. Referenced by checkOverlayAcceptability(), getVisualInfoCI(), and getVisualInfoRGB(). |
|
Definition at line 87 of file glutint.h. Referenced by checkOverlayAcceptability(), getVisualInfoCI(), and getVisualInfoRGB(). |
|
|
|
Definition at line 94 of file glutint.h. Referenced by __glutGetVisualInfo(), and getOverlayVisualInfo(). |
|
Definition at line 92 of file glutint.h. Referenced by __glutDetermineVisual(), checkOverlayAcceptability(), and getVisualInfoRGB(). |
|
Definition at line 84 of file glutint.h. Referenced by __glutGetVisualInfo(), __glutSetupColormap(), and getOverlayVisualInfo(). |
|
Definition at line 86 of file glutint.h. Referenced by __glutDetermineVisual(). |
|
Definition at line 93 of file glutint.h. Referenced by checkOverlayAcceptability(), getVisualInfoCI(), and getVisualInfoRGB(). |
|
Value: (((t2).tv_sec > (t1).tv_sec) || \ (((t2).tv_sec == (t1).tv_sec) && \ ((t2).tv_usec > (t1).tv_usec))) Definition at line 75 of file glutint.h. Referenced by glutTimerFunc(), and waitForSomething(). |
|
Value: (((t2).tv_sec > (t1).tv_sec) || \ (((t2).tv_sec == (t1).tv_sec) && \ ((t2).tv_usec >= (t1).tv_usec))) Definition at line 79 of file glutint.h. Referenced by handleTimeouts(). |
|
Definition at line 362 of file glutint.h. Referenced by processWindowWorkList(). |
|
Value: { \ if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \ (dest).tv_usec += 1000000; \ (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \ } else { \ (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \ } \ } Definition at line 67 of file glutint.h. Referenced by glutGet(), and waitForSomething(). |
Typedef Documentation
|
Definition at line 125 of file glutint.h. Referenced by glutButtonBoxFunc(). |
|
|
|
|
|
Definition at line 124 of file glutint.h. Referenced by glutDialsFunc(). |
|
Definition at line 107 of file glutint.h. Referenced by glutDisplayFunc(), and glutOverlayDisplayFunc(). |
|
Definition at line 113 of file glutint.h. Referenced by glutEntryFunc(). |
|
|
|
Definition at line 115 of file glutint.h. Referenced by glutIdleFunc(). |
|
Definition at line 109 of file glutint.h. Referenced by glutKeyboardFunc(). |
|
|
|
|
|
Definition at line 117 of file glutint.h. Referenced by glutMenuStateFunc(). |
|
Definition at line 118 of file glutint.h. Referenced by glutMenuStatusFunc(). |
|
Definition at line 111 of file glutint.h. Referenced by glutMotionFunc(). |
|
Definition at line 110 of file glutint.h. Referenced by glutMouseFunc(). |
|
|
|
Definition at line 112 of file glutint.h. Referenced by glutPassiveMotionFunc(). |
|
Definition at line 108 of file glutint.h. Referenced by glutReshapeFunc(). |
|
Definition at line 119 of file glutint.h. Referenced by glutCreateMenu(). |
|
Definition at line 123 of file glutint.h. Referenced by glutSpaceballButtonFunc(). |
|
Definition at line 121 of file glutint.h. Referenced by glutSpaceballMotionFunc(). |
|
Definition at line 122 of file glutint.h. Referenced by glutSpaceballRotateFunc(). |
|
Definition at line 120 of file glutint.h. Referenced by glutSpecialFunc(). |
|
|
|
Definition at line 127 of file glutint.h. Referenced by glutTabletButtonFunc(). |
|
Definition at line 126 of file glutint.h. Referenced by glutTabletMotionFunc(). |
|
|
|
Definition at line 116 of file glutint.h. Referenced by glutTimerFunc(). |
|
Definition at line 114 of file glutint.h. Referenced by glutVisibilityFunc(). |
|
|
Function Documentation
|
Definition at line 71 of file glut_cindex.c. References associateNewColormap(), cmap, _GLUTcolormap::next, _GLUTcolormap::refcnt, and _GLUTcolormap::visual. Referenced by __glutSetupColormap().
00072 { 00073 GLUTcolormap *cmap = __glutColormapList; 00074 00075 while (cmap != NULL) { 00076 /* Play safe: compare visual IDs, not Visual*'s */ 00077 if (cmap->visual->visualid == vis->visual->visualid) { 00078 /* already have created colormap for the visual */ 00079 cmap->refcnt++; 00080 return cmap; 00081 } 00082 cmap = cmap->next; 00083 } 00084 return associateNewColormap(vis); 00085 } |
|
Definition at line 834 of file glut_win.c. References __glutPutOnWorkList(), Bool, _GLUTwindow::eventMask, and GLUT_EVENT_MASK_WORK. Referenced by glutAttachMenu(), glutDetachMenu(), glutEntryFunc(), glutKeyboardFunc(), glutMotionFunc(), glutMouseFunc(), glutPassiveMotionFunc(), glutSpecialFunc(), and glutVisibilityFunc().
00835 { 00836 if (add) { 00837 /* add eventMask to window's event mask */ 00838 if ((__glutCurrentWindow->eventMask & eventMask) != 00839 eventMask) { 00840 __glutCurrentWindow->eventMask |= eventMask; 00841 __glutPutOnWorkList(__glutCurrentWindow, 00842 GLUT_EVENT_MASK_WORK); 00843 } 00844 } else { 00845 /* remove eventMask from window's event mask */ 00846 if (__glutCurrentWindow->eventMask & eventMask) { 00847 __glutCurrentWindow->eventMask &= ~eventMask; 00848 __glutPutOnWorkList(__glutCurrentWindow, 00849 GLUT_EVENT_MASK_WORK); 00850 } 00851 } 00852 } |
|
Definition at line 459 of file glut_win.c. References _GLUToverlay::ctx, _GLUTwindow::ctx, _GLUTwindow::overlay, overlay, _GLUTwindow::renderCtx, _GLUTwindow::renderWin, _GLUToverlay::win, and _GLUTwindow::win. Referenced by __glutCreateWindow(), and glutReshapeFunc().
00460 { 00461 GLUToverlay *overlay; 00462 00463 /* Adjust the viewport of the window (and overlay if one 00464 exists). */ 00465 glXMakeCurrent(__glutDisplay, __glutCurrentWindow->win, 00466 __glutCurrentWindow->ctx); 00467 glViewport(0, 0, (GLsizei) width, (GLsizei) height); 00468 overlay = __glutCurrentWindow->overlay; 00469 if (overlay) { 00470 glXMakeCurrent(__glutDisplay, overlay->win, overlay->ctx); 00471 glViewport(0, 0, (GLsizei) width, (GLsizei) height); 00472 } 00473 /* Make sure we are current to the current layer (application 00474 00475 should be able to count on the current layer not changing 00476 unless the application explicitly calls glutUseLayer). */ 00477 glXMakeCurrent(__glutDisplay, __glutCurrentWindow->renderWin, 00478 __glutCurrentWindow->renderCtx); 00479 } |
|
Definition at line 323 of file glut_win.c. References Bool, GLUT_DOUBLE, GLUT_MULTISAMPLE, GLUT_WIND_IS_MULTISAMPLE, and GLUT_WIND_IS_SINGLE. Referenced by __glutCreateWindow(), glutEstablishOverlay(), glutGet(), and glutLayerGet().
00327 { 00328 XVisualInfo *vis; 00329 00330 *singleFake = False; 00331 vis = getVisualInfo(displayMode); 00332 if (!vis) { 00333 /* Fallback cases when can't get exactly what was asked 00334 for... */ 00335 if (GLUT_WIND_IS_SINGLE(displayMode)) { 00336 /* If we can't find a single buffered visual, try looking 00337 for a double buffered visual. We can treat a double 00338 buffered visual as a single buffer visual by changing 00339 the draw buffer to GL_FRONT and treating any swap 00340 buffers as no-ops. */ 00341 displayMode |= GLUT_DOUBLE; 00342 vis = getVisualInfo(displayMode); 00343 *singleFake = True; 00344 } 00345 if (!vis && GLUT_WIND_IS_MULTISAMPLE(displayMode)) { 00346 /* If we can't seem to get multisampling (ie, not Reality 00347 Engine class graphics!), go without multisampling. It 00348 is up to the application to query how many multisamples 00349 were allocated (0 equals no multisampling) if the 00350 application is going to use multisampling for more than 00351 just antialiasing. */ 00352 displayMode &= ~GLUT_MULTISAMPLE; 00353 vis = getVisualInfo(displayMode); 00354 } 00355 } 00356 return vis; 00357 } |
|
Definition at line 639 of file glut_win.c. References __glutFatalError(), __glutWarning(), findColormaps(), free, malloc, _GLUTwindow::parent, and _GLUTwindow::win. Referenced by processWindowWorkList().
00640 { 00641 static Atom wmColormapWindows = None; 00642 Window *winlist; 00643 Colormap *cmaplist; 00644 Status status; 00645 int maxcmaps, num; 00646 00647 assert(!window->parent); 00648 maxcmaps = MaxCmapsOfScreen(ScreenOfDisplay(__glutDisplay, 00649 __glutScreen)); 00650 /* For portability reasons we don't use alloca for winlist 00651 and cmaplist, but we could. */ 00652 winlist = (Window *) malloc(maxcmaps * sizeof(Window)); 00653 cmaplist = (Colormap *) malloc(maxcmaps * sizeof(Colormap)); 00654 num = findColormaps(window, winlist, cmaplist, 0, maxcmaps); 00655 if (num < 2) { 00656 /* Property no longer needed; remove it. */ 00657 wmColormapWindows = XInternAtom(__glutDisplay, 00658 "WM_COLORMAP_WINDOWS", False); 00659 if (wmColormapWindows == None) { 00660 __glutWarning("Could not intern X atom for WM_COLORMAP_WINDOWS."); 00661 return; 00662 } 00663 XDeleteProperty(__glutDisplay, window->win, wmColormapWindows); 00664 } else { 00665 status = XSetWMColormapWindows(__glutDisplay, window->win, 00666 winlist, num); 00667 /* XSetWMColormapWindows should always work unless the 00668 WM_COLORMAP_WINDOWS property cannot be intern'ed. We 00669 check to be safe. */ 00670 if (status == False) 00671 __glutFatalError("XSetWMColormapWindows returned False"); 00672 } 00673 /* For portability reasons we don't use alloca for winlist 00674 and cmaplist, but we could. */ 00675 free(winlist); 00676 free(cmaplist); 00677 } |
|
|
Definition at line 43 of file glut_util.c. Referenced by glutDestroyWindow(), and glutMainLoop().
|
|
Definition at line 271 of file glut_menu.c. References __glutMenuStatusFunc, __glutSetMenu(), __glutSetWindow(), dummy, GLUT_MENU_NOT_IN_USE, _GLUTmenuItem::isTrigger, _GLUTmenuItem::menu, _GLUTmenu::select, unmapMenu(), _GLUTmenuItem::value, _GLUTwindow::win, and win. Referenced by processEvents().
00272 { 00273 Window dummy; 00274 int rc; 00275 00276 unmapMenu(__glutMappedMenu); 00277 XUngrabPointer(__glutDisplay, CurrentTime); 00278 00279 /* This XFlush is needed to to make sure the pointer is 00280 really ungrabbed when the application's menu callback is 00281 called. Otherwise, a deadlock might happen because the 00282 application may try to read from an terminal window, but 00283 yet the ungrab hasn't really happened since it hasn't been 00284 flushed out. */ 00285 XFlush(__glutDisplay); 00286 00287 if (__glutMenuStatusFunc) { 00288 if (win != __glutMenuWindow->win) { 00289 /* The button release may have occurred in a window other 00290 than the window requesting the pop-up menu (for 00291 example, one of the submenu windows). In this case, we 00292 need to translate the coordinates into the coordinate 00293 system of the window associated with the window. */ 00294 rc = XTranslateCoordinates(__glutDisplay, win, __glutMenuWindow->win, 00295 x, y, &x, &y, &dummy); 00296 assert(rc != False); /* Will always be on same screen. */ 00297 } 00298 __glutSetWindow(__glutMenuWindow); 00299 __glutSetMenu(__glutMappedMenu); 00300 00301 /* Setting __glutMappedMenu to NULL permits operations that 00302 change menus or destroy the menu window again. */ 00303 __glutMappedMenu = NULL; 00304 00305 __glutMenuStatusFunc(GLUT_MENU_NOT_IN_USE, x, y); 00306 } 00307 /* Setting __glutMappedMenu to NULL permits operations that 00308 change menus or destroy the menu window again. */ 00309 __glutMappedMenu = NULL; 00310 00311 /* If an item is selected and it is not a submenu trigger, 00312 generate menu callback. */ 00313 if (__glutItemSelected && !__glutItemSelected->isTrigger) { 00314 __glutSetWindow(__glutMenuWindow); 00315 /* When menu callback is triggered, current menu should be 00316 set to the callback menu. */ 00317 __glutSetMenu(__glutItemSelected->menu); 00318 __glutItemSelected->menu->select( 00319 __glutItemSelected->value); 00320 } 00321 __glutMenuWindow = NULL; 00322 } |
|
Definition at line 212 of file glut_cindex.c. References _GLUTcolormap::cells, _GLUTcolormap::cmap, cmap, free, _GLUTcolormap::next, and _GLUTcolormap::refcnt. Referenced by __glutFreeOverlay(), destroyWindow(), and glutCopyColormap().
00213 { 00214 GLUTcolormap *cur, **prev; 00215 00216 cmap->refcnt--; 00217 if (cmap->refcnt == 0) { 00218 /* remove from colormap list */ 00219 cur = __glutColormapList; 00220 prev = &__glutColormapList; 00221 while (cur) { 00222 if (cur == cmap) { 00223 *prev = cmap->next; 00224 break; 00225 } 00226 prev = &(cur->next); 00227 cur = cur->next; 00228 } 00229 /* actually free colormap */ 00230 XFreeColormap(__glutDisplay, cmap->cmap); 00231 free(cmap->cells); 00232 free(cmap); 00233 } 00234 } |
|
Definition at line 545 of file glut_menu.c. References _GLUTmenu::cascade, _GLUTmenu::win, and win. Referenced by processEvents().
00546 { 00547 GLUTmenu *menu; 00548 00549 menu = __glutMappedMenu; 00550 while (menu) { 00551 if (win == menu->win) { 00552 return menu; 00553 } 00554 menu = menu->cascade; 00555 } 00556 return NULL; 00557 } |
|
Definition at line 560 of file glut_menu.c. References menuListSize. Referenced by glutDestroyMenu(), and processEvents().
00561 { 00562 if (menunum < 1 || menunum > menuListSize) { 00563 return NULL; 00564 } 00565 return menuList[menunum - 1]; 00566 } |
|
Definition at line 505 of file glut_menu.c. References i, _GLUTmenuItem::isTrigger, _GLUTmenu::list, _GLUTmenuItem::next, _GLUTmenu::num, _GLUTmenuItem::value, _GLUTmenuItem::win, and win. Referenced by processEvents().
00506 { 00507 GLUTmenuItem *item; 00508 int i; 00509 00510 i = menu->num; 00511 item = menu->list; 00512 while (item) { 00513 if (item->win == win) { 00514 *which = i; 00515 return item; 00516 } 00517 if (item->isTrigger) { 00518 GLUTmenuItem *subitem; 00519 00520 subitem = __glutGetMenuItem(menuList[item->value], 00521 win, which); 00522 if (subitem) { 00523 return subitem; 00524 } 00525 } 00526 i--; 00527 item = item->next; 00528 } 00529 return NULL; 00530 } |
|
Definition at line 310 of file glut_win.c. References getVisualInfoCI(), getVisualInfoRGB(), GLUT_WIND_IS_LUMINANCE, and GLUT_WIND_IS_RGB. Referenced by __glutCreateWindow().
00311 { 00312 /* XXX GLUT_LUMINANCE not implemented for GLUT 3.0. */ 00313 if (GLUT_WIND_IS_LUMINANCE(mode)) 00314 return NULL; 00315 00316 if (GLUT_WIND_IS_RGB(mode)) 00317 return getVisualInfoRGB(mode); 00318 else 00319 return getVisualInfoCI(mode); 00320 } |
|
Definition at line 74 of file glut_win.c. References __glutWindowListSize, i, _GLUTstale::next, _GLUTwindow::overlay, _GLUTstale::win, _GLUToverlay::win, _GLUTwindow::win, win, and _GLUTstale::window. Referenced by __glutProcessDeviceEvents(), and processEvents().
00075 { 00076 GLUTstale *entry; 00077 int i; 00078 00079 /* Does win belong to the last window ID looked up? */ 00080 if (__glutWindowCache && (win == __glutWindowCache->win || 00081 (__glutWindowCache->overlay && win == 00082 __glutWindowCache->overlay->win))) { 00083 return 00084 __glutWindowCache; 00085 } 00086 /* Otherwise scan the window list looking for the window ID. */ 00087 for (i = 0; i < __glutWindowListSize; i++) { 00088 if (__glutWindowList[i]) { 00089 if (win == __glutWindowList[i]->win) { 00090 __glutWindowCache = __glutWindowList[i]; 00091 return __glutWindowCache; 00092 } 00093 if (__glutWindowList[i]->overlay) { 00094 if (win == __glutWindowList[i]->overlay->win) { 00095 __glutWindowCache = __glutWindowList[i]; 00096 return __glutWindowCache; 00097 } 00098 } 00099 } 00100 } 00101 /* Scan through destroyed overlay window IDs for which no 00102 DestroyNotify has yet been received. */ 00103 for (entry = __glutStaleWindowList; entry; entry = entry->next) { 00104 if (entry->win == win) 00105 return entry->window; 00106 } 00107 return NULL; 00108 } |
|
Definition at line 80 of file glut_init.c. References GETTIMEOFDAY. Referenced by glutGet(), and glutInit().
00081 { 00082 static int beenhere = 0; 00083 static struct timeval genesis; 00084 00085 if (!beenhere) { 00086 GETTIMEOFDAY(&genesis); 00087 beenhere = 1; 00088 } 00089 *beginning = genesis; 00090 } |
|
Definition at line 47 of file glut_ext.c. Referenced by checkOverlayAcceptability(), getVisualInfoRGB(), and glutGet().
00048 { 00049 #if defined(GLX_VERSION_1_1) 00050 static const char *extensions = NULL; 00051 const char *start; 00052 char *where, *terminator; 00053 int major, minor; 00054 00055 glXQueryVersion(__glutDisplay, &major, &minor); 00056 /* Be careful not to call glXQueryExtensionsString if it 00057 looks like the server doesn't support GLX 1.1. 00058 Unfortunately, the original GLX 1.0 didn't have the notion 00059 of GLX extensions. */ 00060 if ((major == 1 && minor >= 1) || (major > 1)) { 00061 if (!extensions) 00062 extensions = glXQueryExtensionsString(__glutDisplay, __glutScreen); 00063 /* It takes a bit of care to be fool-proof about parsing 00064 the GLX extensions string. Don't be fooled by 00065 sub-strings, etc. */ 00066 start = extensions; 00067 for (;;) { 00068 where = strstr(start, extension); 00069 if (!where) 00070 return 0; 00071 terminator = where + strlen(extension); 00072 if (where == start || *(where - 1) == ' ') { 00073 if (*terminator == ' ' || *terminator == '\0') { 00074 return 1; 00075 } 00076 } 00077 start = terminator; 00078 } 00079 } 00080 #else 00081 /* No GLX extensions before GLX 1.1 */ 00082 #endif 00083 return 0; 00084 } |
|
Definition at line 914 of file glut_menu.c. References _GLUTmenu::anchor, _GLUTmenu::cascade, fontHeight, getMenuItemIndex(), _GLUTmenu::highlighted, _GLUTmenuItem::isTrigger, mapMenu(), _GLUTmenuItem::menu, MENU_ARROW_GAP, MENU_ARROW_WIDTH, MENU_BORDER, MENU_GAP, paintMenuItem(), _GLUTmenu::pixwidth, unmapMenu(), _GLUTmenuItem::value, _GLUTmenu::x, and _GLUTmenu::y. Referenced by processEvents().
00916 { 00917 int alreadyUp = 0; 00918 00919 if (type == EnterNotify) { 00920 GLUTmenuItem *prevItem = item->menu->highlighted; 00921 00922 if (prevItem && prevItem != item) { 00923 /* If there's an already higlighted item in this menu 00924 that is different from this one (we could be 00925 re-entering an item with an already cascaded 00926 submenu!), unhighlight the previous item. */ 00927 item->menu->highlighted = NULL; 00928 paintMenuItem(prevItem, getMenuItemIndex(prevItem)); 00929 } 00930 item->menu->highlighted = item; 00931 __glutItemSelected = item; 00932 if (item->menu->cascade) { 00933 if (!item->isTrigger) { 00934 /* Entered a menu item that is not a submenu trigger, 00935 so pop down the current submenu cascade of this 00936 menu. */ 00937 unmapMenu(item->menu->cascade); 00938 item->menu->cascade = NULL; 00939 } else { 00940 GLUTmenu *submenu = menuList[item->value]; 00941 00942 if (submenu->anchor == item) { 00943 /* We entered the submenu trigger for the submenu 00944 that is already up, so don't take down the 00945 submenu. */ 00946 alreadyUp = 1; 00947 } else { 00948 /* Submenu already popped up for some other submenu 00949 item of this menu; need to pop down that other 00950 submenu cascade. */ 00951 unmapMenu(item->menu->cascade); 00952 item->menu->cascade = NULL; 00953 } 00954 } 00955 } 00956 if (!alreadyUp) { 00957 /* Make sure the menu item gets painted with 00958 highlighting. */ 00959 paintMenuItem(item, num); 00960 } else { 00961 /* If already up, should already be highlighted. */ 00962 } 00963 } else { 00964 /* LeaveNotify: Handle leaving a menu item... */ 00965 if (item->menu->cascade && 00966 item->menu->cascade->anchor == item) { 00967 /* If there is a submenu casacaded from this item, do not 00968 change the highlighting on this item upon leaving. */ 00969 } else { 00970 /* Unhighlight this menu item. */ 00971 item->menu->highlighted = NULL; 00972 paintMenuItem(item, num); 00973 } 00974 __glutItemSelected = NULL; 00975 } 00976 if (item->isTrigger) { 00977 if (type == EnterNotify && !alreadyUp) { 00978 GLUTmenu *submenu = menuList[item->value]; 00979 00980 mapMenu(submenu, 00981 item->menu->x + item->menu->pixwidth + 00982 MENU_ARROW_GAP + MENU_ARROW_WIDTH + 00983 MENU_GAP + MENU_BORDER, 00984 item->menu->y + fontHeight * (num - 1) + MENU_GAP); 00985 item->menu->cascade = submenu; 00986 submenu->anchor = item; 00987 } 00988 } 00989 } |
|
Definition at line 55 of file glut_init.c. References __glutConnectionFD, __glutDisplay, __glutFatalError(), __glutRoot, __glutScreen, __glutScreenHeight, __glutScreenWidth, __glutWMDeleteWindow, and display. Referenced by __glutCreateWindow(), glutCreateMenu(), and glutInit().
00056 { 00057 int errorBase, eventBase; 00058 00059 __glutDisplay = XOpenDisplay(display); 00060 if (!__glutDisplay) 00061 __glutFatalError("could not open display: %s", 00062 XDisplayName(display)); 00063 if (synchronize) 00064 XSynchronize(__glutDisplay, True); 00065 if (!glXQueryExtension(__glutDisplay, &errorBase, &eventBase)) 00066 __glutFatalError( 00067 "OpenGL GLX extension not supported by display: %s", 00068 XDisplayName(display)); 00069 __glutScreen = DefaultScreen(__glutDisplay); 00070 __glutRoot = RootWindow(__glutDisplay, __glutScreen); 00071 __glutScreenWidth = DisplayWidth(__glutDisplay, __glutScreen); 00072 __glutScreenHeight = DisplayHeight(__glutDisplay, 00073 __glutScreen); 00074 __glutConnectionFD = ConnectionNumber(__glutDisplay); 00075 __glutWMDeleteWindow = XInternAtom(__glutDisplay, 00076 "WM_DELETE_WINDOW", False); 00077 } |
|
Definition at line 478 of file glut_menu.c. References blackGC, fontHeight, _GLUTmenu::highlighted, i, _GLUTmenuItem::isTrigger, _GLUTmenuItem::label, _GLUTmenuItem::len, _GLUTmenu::list, _GLUTmenuItem::menu, MENU_ARROW_GAP, MENU_GAP, menuFont, _GLUTmenuItem::next, _GLUTmenu::num, paintMenuItem(), paintSubMenuArrow(), _GLUTmenu::pixwidth, and _GLUTmenu::win. Referenced by processEvents().
00479 { 00480 GLUTmenuItem *item; 00481 int i = menu->num; 00482 int y = MENU_GAP + fontHeight * i - menuFont->descent; 00483 00484 item = menu->list; 00485 while (item) { 00486 if (item->menu->highlighted == item) { 00487 paintMenuItem(item, i); 00488 } else { 00489 /* quick render of the menu item; assume background 00490 already cleared to gray */ 00491 XDrawString(__glutDisplay, menu->win, blackGC, 00492 2, y, item->label, item->len); 00493 if (item->isTrigger) { 00494 paintSubMenuArrow(menu->win, 00495 menu->pixwidth + MENU_ARROW_GAP + 1, y); 00496 } 00497 } 00498 i--; 00499 y -= fontHeight; 00500 item = item->next; 00501 } 00502 } |
|
Definition at line 144 of file glut_event.c. References __glutPutOnWorkList(), GLUT_REDISPLAY_WORK, _GLUTwindow::overlay, _GLUToverlay::shownState, _GLUTwindow::shownState, and _GLUTwindow::visState. Referenced by glutPostOverlayRedisplay(), glutPostRedisplay(), and processEvents().
00145 { 00146 int shown = (layerMask == GLUT_REDISPLAY_WORK) ? window->shownState : window->overlay->shownState; 00147 00148 /* Post a redisplay if the window is visible (or the 00149 visibility of the window is unknown, ie. window->visState 00150 == -1) _and_ the layer is known to be shown. */ 00151 if (window->visState != 0 && shown) 00152 __glutPutOnWorkList(window, layerMask); 00153 } |
|
Definition at line 130 of file glut_event.c. References _GLUTwindow::prevWorkWin, and _GLUTwindow::workMask. Referenced by __glutChangeWindowEventMask(), __glutPostRedisplay(), __glutSetWindow(), glutButtonBoxFunc(), glutCopyColormap(), glutCreateSubWindow(), glutDestroyWindow(), glutDialsFunc(), glutEstablishOverlay(), glutFullScreen(), glutHideWindow(), glutIconifyWindow(), glutPopWindow(), glutPositionWindow(), glutPushWindow(), glutRemoveOverlay(), glutReshapeWindow(), glutSetColor(), glutShowWindow(), glutSpaceballButtonFunc(), glutSpaceballMotionFunc(), glutSpaceballRotateFunc(), glutTabletButtonFunc(), and glutTabletMotionFunc().
00131 { 00132 if (window->workMask) { 00133 /* Already on list; just OR in new workMask. */ 00134 window->workMask |= workMask; 00135 } else { 00136 /* Update work mask and add to window work list. */ 00137 window->workMask = workMask; 00138 window->prevWorkWin = __glutWindowWorkList; 00139 __glutWindowWorkList = window; 00140 } 00141 } |
|
Definition at line 170 of file glut_event.c. References _GLUTeventParser::next. Referenced by addDeviceEventParser().
00171 { 00172 parser->next = eventParserList; 00173 eventParserList = parser; 00174 } |
|
|
|
Definition at line 253 of file glut_menu.c. Referenced by __glutFinishMenu(), __glutStartMenu(), glutCreateMenu(), and glutSetMenu().
00254 { 00255 __glutCurrentMenu = menu; 00256 } |
|
Definition at line 360 of file glut_win.c. References __glutAssociateColormap(), __glutFatalError(), cmap, getenv(), GLUT_WIND_IS_RGB, and i. Referenced by __glutCreateWindow(), and glutEstablishOverlay().
00361 { 00362 Status status; 00363 XStandardColormap *standardCmaps; 00364 int i, numCmaps; 00365 00366 switch (vi->class) { 00367 case PseudoColor: 00368 if (GLUT_WIND_IS_RGB(__glutDisplayMode)) { 00369 /* Mesa might return a PseudoColor visual for RGB mode. */ 00370 *colormap = NULL; 00371 if (MaxCmapsOfScreen(DefaultScreenOfDisplay(__glutDisplay)) == 1 00372 && vi->visual == DefaultVisual(__glutDisplay, __glutScreen)) { 00373 char *private = getenv("MESA_PRIVATE_CMAP"); 00374 00375 if (private) { 00376 /* User doesn't want to share colormaps. */ 00377 *cmap = XCreateColormap(__glutDisplay, __glutRoot, 00378 vi->visual, AllocNone); 00379 } else { 00380 /* Share the root colormap. */ 00381 *cmap = DefaultColormap(__glutDisplay, __glutScreen); 00382 } 00383 } else { 00384 /* Get our own PseudoColor colormap. */ 00385 *cmap = XCreateColormap(__glutDisplay, __glutRoot, 00386 vi->visual, AllocNone); 00387 } 00388 } else { 00389 /* CI mode, real GLX never returns a PseudoColor visual 00390 for RGB mode. */ 00391 *colormap = __glutAssociateColormap(vi); 00392 *cmap = (*colormap)->cmap; 00393 } 00394 break; 00395 case TrueColor: 00396 case DirectColor: 00397 *colormap = NULL; /* NULL if RGBA */ 00398 #ifndef SOLARIS_2_4_BUG 00399 /* Solaris 2.4 has a bug in its XmuLookupStandardColormap 00400 implementation. Please compile your Solaris 2.4 version 00401 of GLUT with -DSOLARIS_2_4_BUG to work around this bug. 00402 The symptom of the bug is that programs will get a 00403 BadMatch error from X_CreateWindow when creating a GLUT 00404 window because Solaris 2.4 creates a corrupted 00405 RGB_DEFAULT_MAP property. Note that this workaround 00406 prevents Colormap sharing between applications, perhaps 00407 leading unnecessary colormap installations or colormap 00408 flashing. */ 00409 status = XmuLookupStandardColormap(__glutDisplay, 00410 vi->screen, vi->visualid, vi->depth, XA_RGB_DEFAULT_MAP, 00411 /* replace */ False, /* retain */ True); 00412 if (status == 1) { 00413 status = XGetRGBColormaps(__glutDisplay, __glutRoot, 00414 &standardCmaps, &numCmaps, XA_RGB_DEFAULT_MAP); 00415 if (status == 1) 00416 for (i = 0; i < numCmaps; i++) 00417 if (standardCmaps[i].visualid == vi->visualid) { 00418 *cmap = standardCmaps[i].colormap; 00419 XFree(standardCmaps); 00420 return; 00421 } 00422 } 00423 #endif 00424 /* If no standard colormap but TrueColor, just make a 00425 private one. */ 00426 /* XXX Should do a better job of internal sharing for 00427 privately allocated TrueColor colormaps. */ 00428 /* XXX DirectColor probably needs ramps hand initialized! */ 00429 *cmap = XCreateColormap(__glutDisplay, __glutRoot, 00430 vi->visual, AllocNone); 00431 break; 00432 case StaticColor: 00433 case StaticGray: 00434 case GrayScale: 00435 /* Mesa supports these visuals */ 00436 *colormap = NULL; 00437 *cmap = XCreateColormap(__glutDisplay, __glutRoot, 00438 vi->visual, AllocNone); 00439 break; 00440 default: 00441 __glutFatalError( 00442 "could not allocate colormap for visual type: %d.", 00443 vi->class); 00444 } 00445 return; 00446 } |
|
Definition at line 121 of file glut_win.c. References __glutPutOnWorkList(), GLUT_DEBUG_WORK, GLUT_FINISH_WORK, _GLUTwindow::isDirect, _GLUTwindow::renderCtx, and _GLUTwindow::renderWin. Referenced by __glutCreateWindow(), __glutFinishMenu(), __glutStartMenu(), glutSetWindow(), glutUseLayer(), processEvents(), processWindowWorkList(), and updateWindowVisibility().
00122 { 00123 /* It is tempting to try to short-circuit the call to 00124 glXMakeCurrent if we "know" we are going to make current 00125 to a window we are already current to. In fact, this 00126 assumption breaks when GLUT is expected to integrated with 00127 other OpenGL windowing APIs that also make current to 00128 OpenGL contexts. Since glXMakeCurrent short-circuits the 00129 "already bound" case, GLUT avoids the temptation to do so 00130 too. */ 00131 __glutCurrentWindow = window; 00132 glXMakeCurrent(__glutDisplay, __glutCurrentWindow->renderWin, 00133 __glutCurrentWindow->renderCtx); 00134 00135 /* We should be careful to force a finish between each 00136 iteration through the GLUT main loop if indirect OpenGL 00137 contexts are in use; indirect contexts tend to have much 00138 longer latency because lots of OpenGL extension requests 00139 can queue up in the X protocol stream. We accomplish this 00140 by posting GLUT_FINISH_WORK to be done. */ 00141 if (!__glutCurrentWindow->isDirect) 00142 __glutPutOnWorkList(__glutCurrentWindow, GLUT_FINISH_WORK); 00143 00144 /* If debugging is enabled, we'll want to check this window 00145 for any OpenGL errors every iteration through the GLUT 00146 main loop. To accomplish this, we post the 00147 GLUT_DEBUG_WORK to be done on this window. */ 00148 if (__glutDebug) 00149 __glutPutOnWorkList(__glutCurrentWindow, GLUT_DEBUG_WORK); 00150 } |
|
Definition at line 403 of file glut_menu.c. References __glutMenuStatusFunc, __glutSetMenu(), __glutSetWindow(), GLUT_MENU_IN_USE, mapMenu(), and menuCursor. Referenced by processEvents().
00405 { 00406 int grab; 00407 00408 assert(__glutMappedMenu == NULL); 00409 grab = XGrabPointer(__glutDisplay, __glutRoot, True, 00410 ButtonPressMask | ButtonReleaseMask, 00411 GrabModeAsync, GrabModeAsync, 00412 __glutRoot, menuCursor, CurrentTime); 00413 if (grab != GrabSuccess) { 00414 /* Somebody else has pointer grabbed, ignore menu 00415 activation. */ 00416 return; 00417 } 00418 __glutMappedMenu = menu; 00419 __glutMenuWindow = window; 00420 __glutItemSelected = NULL; 00421 if (__glutMenuStatusFunc) { 00422 __glutSetMenu(menu); 00423 __glutSetWindow(window); 00424 __glutMenuStatusFunc(GLUT_MENU_IN_USE, x_win, y_win); 00425 } 00426 mapMenu(menu, x, y); 00427 } |
|
Definition at line 680 of file glut_win.c. References _GLUTwindow::parent. Referenced by glutCopyColormap(), glutCreateSubWindow(), glutDestroyWindow(), glutEstablishOverlay(), glutRemoveOverlay(), and glutSetColor().
|
|
Definition at line 404 of file glut_input.c. References __glutDeviceButtonPress, __glutDeviceButtonPressGrab, __glutDeviceButtonRelease, __glutDeviceMotionNotify, __glutDeviceStateNotify, __glutDials, __glutSpaceball, __glutTablet, _GLUTwindow::buttonBox, _GLUTwindow::children, _GLUTwindow::dials, _GLUTwindow::overlay, probeDevices(), _GLUTwindow::siblings, _GLUTwindow::spaceButton, _GLUTwindow::spaceMotion, _GLUTwindow::spaceRotate, _GLUTwindow::tabletButton, _GLUTwindow::tabletMotion, _GLUToverlay::win, and _GLUTwindow::win.
00405 { 00406 /* 5 (dial and buttons) + 5 (tablet locator and buttons) + 5 00407 (Spaceball buttons and axis) = 15 */ 00408 XEventClass eventList[15]; 00409 int rc, numEvents; 00410 00411 rc = probeDevices(); 00412 if (rc) { 00413 numEvents = 0; 00414 if (__glutTablet) { 00415 if (window->tabletMotion) { 00416 DeviceMotionNotify(__glutTablet, __glutDeviceMotionNotify, 00417 eventList[numEvents]); 00418 numEvents++; 00419 } 00420 if (window->tabletButton) { 00421 DeviceButtonPress(__glutTablet, __glutDeviceButtonPress, 00422 eventList[numEvents]); 00423 numEvents++; 00424 DeviceButtonPressGrab(__glutTablet, __glutDeviceButtonPressGrab, 00425 eventList[numEvents]); 00426 numEvents++; 00427 DeviceButtonRelease(__glutTablet, __glutDeviceButtonRelease, 00428 eventList[numEvents]); 00429 numEvents++; 00430 } 00431 if (window->tabletMotion || window->tabletButton) { 00432 DeviceStateNotify(__glutTablet, __glutDeviceStateNotify, 00433 eventList[numEvents]); 00434 numEvents++; 00435 } 00436 } 00437 if (__glutDials) { 00438 if (window->dials) { 00439 DeviceMotionNotify(__glutDials, __glutDeviceMotionNotify, 00440 eventList[numEvents]); 00441 numEvents++; 00442 } 00443 if (window->buttonBox) { 00444 DeviceButtonPress(__glutDials, __glutDeviceButtonPress, 00445 eventList[numEvents]); 00446 numEvents++; 00447 DeviceButtonPressGrab(__glutDials, __glutDeviceButtonPressGrab, 00448 eventList[numEvents]); 00449 numEvents++; 00450 DeviceButtonRelease(__glutDials, __glutDeviceButtonRelease, 00451 eventList[numEvents]); 00452 numEvents++; 00453 } 00454 if (window->dials || window->buttonBox) { 00455 DeviceStateNotify(__glutDials, __glutDeviceStateNotify, 00456 eventList[numEvents]); 00457 numEvents++; 00458 } 00459 } 00460 if (__glutSpaceball) { 00461 if (window->spaceMotion || window->spaceRotate) { 00462 DeviceMotionNotify(__glutSpaceball, __glutDeviceMotionNotify, 00463 eventList[numEvents]); 00464 numEvents++; 00465 } 00466 if (window->spaceButton) { 00467 DeviceButtonPress(__glutSpaceball, __glutDeviceButtonPress, 00468 eventList[numEvents]); 00469 numEvents++; 00470 DeviceButtonPressGrab(__glutSpaceball, __glutDeviceButtonPressGrab, 00471 eventList[numEvents]); 00472 numEvents++; 00473 DeviceButtonRelease(__glutSpaceball, __glutDeviceButtonRelease, 00474 eventList[numEvents]); 00475 numEvents++; 00476 } 00477 if (window->spaceMotion || window->spaceRotate || window->spaceButton) { 00478 DeviceStateNotify(__glutSpaceball, __glutDeviceStateNotify, 00479 eventList[numEvents]); 00480 numEvents++; 00481 } 00482 } 00483 #if 0 00484 if (window->children) { 00485 GLUTwindow *child = window->children; 00486 00487 do { 00488 XChangeDeviceDontPropagateList(__glutDisplay, child->win, 00489 numEvents, eventList, AddToList); 00490 child = child->siblings; 00491 } while (child); 00492 } 00493 #endif 00494 XSelectExtensionEvent(__glutDisplay, window->win, 00495 eventList, numEvents); 00496 if (window->overlay) { 00497 XSelectExtensionEvent(__glutDisplay, window->overlay->win, 00498 eventList, numEvents); 00499 } 00500 } else { 00501 /* X Input extension not supported; no chance for exotic 00502 input devices. */ 00503 } 00504 } |
|
Variable Documentation
|
Definition at line 388 of file glutint.h. Referenced by glutInit(). |
|
Definition at line 386 of file glutint.h. Referenced by glutInit(). |
|
Definition at line 389 of file glutint.h. Referenced by __glutOpenXConnection(). |
|
|
|
|
|
Definition at line 380 of file glutint.h. Referenced by glutInit(). |
|
Definition at line 378 of file glutint.h. Referenced by __glutOpenXConnection(), and glutInit(). |
|
Definition at line 379 of file glutint.h. Referenced by glutInitDisplayMode(). |
|
Definition at line 381 of file glutint.h. Referenced by glutInit(). |
|
Definition at line 411 of file glutint.h. Referenced by destroyWindow(). |
|
Definition at line 382 of file glutint.h. Referenced by glutInit(). |
|
Definition at line 390 of file glutint.h. Referenced by glutInit(), and glutInitWindowSize(). |
|
Definition at line 391 of file glutint.h. Referenced by glutInit(), and glutInitWindowSize(). |
|
Definition at line 392 of file glutint.h. Referenced by glutInit(), and glutInitWindowPosition(). |
|
Definition at line 393 of file glutint.h. Referenced by glutInit(), and glutInitWindowPosition(). |
|
|
|
|
|
Definition at line 405 of file glutint.h. Referenced by __glutFinishMenu(), __glutStartMenu(), glutMenuStateFunc(), and glutMenuStatusFunc(). |
|
|
|
Definition at line 398 of file glutint.h. Referenced by processEvents(). |
|
Definition at line 397 of file glutint.h. Referenced by processWindowWorkList(). |
|
Definition at line 387 of file glutint.h. Referenced by glutInit(). |
|
Definition at line 384 of file glutint.h. Referenced by __glutOpenXConnection(). |
|
Definition at line 394 of file glutint.h. Referenced by __glutOpenXConnection(), and glutInit(). |
|
Definition at line 395 of file glutint.h. Referenced by __glutOpenXConnection(). |
|
Definition at line 396 of file glutint.h. Referenced by __glutOpenXConnection(). |
|
Definition at line 385 of file glutint.h. Referenced by glutInit(), glutInitWindowPosition(), and glutInitWindowSize(). |
|
|
|
Definition at line 383 of file glutint.h. Referenced by glutInit(). |
|
Definition at line 418 of file glutint.h. Referenced by processWindowWorkList(). |
|
Definition at line 370 of file glutint.h. Referenced by processWindowWorkList(). |
|
|
|
Definition at line 410 of file glutint.h. Referenced by __glutGetWindow(), getUnusedWindowSlot(), and glutSetWindow(). |
|
|
|
Definition at line 377 of file glutint.h. Referenced by __glutOpenXConnection(). |