CVS: tvision/classes/x11 x11src.cc,1.63.2.35,1.63.2.36
Brought to you by:
set
From: Salvador E. T. <se...@us...> - 2017-07-30 17:11:42
|
Update of /cvsroot/tvision/tvision/classes/x11 In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11140/classes/x11 Modified Files: Tag: r2_0_1u x11src.cc Log Message: * Modified: [X11] Eliminated the cursorGC. * Modified: [X11] Avoided X11 calls when setting colors in truecolor mode. Index: x11src.cc =================================================================== RCS file: /cvsroot/tvision/tvision/classes/x11/x11src.cc,v retrieving revision 1.63.2.35 retrieving revision 1.63.2.36 diff -C2 -d -r1.63.2.35 -r1.63.2.36 *** x11src.cc 30 Jul 2017 16:43:17 -0000 1.63.2.35 --- x11src.cc 30 Jul 2017 17:11:38 -0000 1.63.2.36 *************** *** 118,122 **** uint32 TScreenX11::gcForeground; // Last values used uint32 TScreenX11::gcBackground; - GC TScreenX11::cursorGC=NULL; XIC TScreenX11::xic=NULL; XIM TScreenX11::xim=NULL; --- 118,121 ---- *************** *** 187,192 **** } - if (cursorGC) - XFreeGC(disp,cursorGC); XDestroyWindow(disp,mainWin); XCloseDisplay(disp); //This could do all of the above for us, but anyway... --- 186,189 ---- *************** *** 1573,1577 **** gc=DefaultGC(disp,screen); visual=DefaultVisual(disp,screen); ! isTrueColor=DefaultDepth(disp,screen)>=24 && useTrueColorXImage; if (useX11Font) XSetFont(disp,gc,x11Font); --- 1570,1575 ---- gc=DefaultGC(disp,screen); visual=DefaultVisual(disp,screen); ! isTrueColor=DefaultDepth(disp,screen)>=24 && useTrueColorXImage && ! !useX11Font; if (useX11Font) XSetFont(disp,gc,x11Font); *************** *** 1693,1702 **** memcpy(ActualPalette,pal,sizeof(ActualPalette)); - /* A graphics context for the text cursor */ - cursorGC=XCreateGC(disp,mainWin,0,0); - if (useX11Font) - /* Select the same font for this context */ - XSetFont(disp,cursorGC,x11Font); - /* Create the cursor timer */ gettimeofday(&refCursorTime,0); --- 1691,1694 ---- *************** *** 1864,1869 **** uchar newChar=theChar[charPos]; uchar newAttr=theChar[attrPos]; ! XSetBgFgC(newAttr); ! drawChar(cursorGC,cursorX*fontW,cursorY*fontH,newChar,newAttr); } else --- 1856,1861 ---- uchar newChar=theChar[charPos]; uchar newAttr=theChar[attrPos]; ! XSetBgFg(newAttr); ! drawChar(gc,cursorX*fontW,cursorY*fontH,newChar,newAttr); } else *************** *** 1879,1884 **** uchar newChar=buf[charPos]; uchar newAttr=buf[attrPos]; ! XSetBgFgC(newAttr); ! drawCharU16(cursorGC,cursorX*fontW,cursorY*fontH,newChar); } } --- 1871,1876 ---- uchar newChar=buf[charPos]; uchar newAttr=buf[attrPos]; ! XSetBgFg(newAttr); ! drawCharU16(gc,cursorX*fontW,cursorY*fontH,newChar); } } *************** *** 1888,1911 **** } - void TScreenX11::XSetBgFgC(uint16 attr) - { - int bg=attr>>4; - int fg=attr & 0xF; - if (bg==fg) - fg=~bg & 0xF; - gcForeground=(uint32)colorMap[fg]; - gcBackground=(uint32)colorMap[bg]; - XSetBackground(disp,cursorGC,colorMap[bg]); - XSetForeground(disp,cursorGC,colorMap[fg]); - } - void TScreenX11::XSetBgFg(uint16 attr) { int bg=attr>>4; int fg=attr & 0xF; ! gcForeground=(uint32)colorMap[fg]; ! gcBackground=(uint32)colorMap[bg]; ! XSetBackground(disp,gc,colorMap[bg]); ! XSetForeground(disp,gc,colorMap[fg]); } --- 1880,1897 ---- } void TScreenX11::XSetBgFg(uint16 attr) { int bg=attr>>4; int fg=attr & 0xF; ! if (isTrueColor) ! { ! gcForeground=(uint32)colorMap[fg]; ! gcBackground=(uint32)colorMap[bg]; ! } ! else ! { ! XSetBackground(disp,gc,colorMap[bg]); ! XSetForeground(disp,gc,colorMap[fg]); ! } } *************** *** 1938,1945 **** if (cursorInScreen) { ! XSetBgFgC(attr); int y; for (y=cShapeFrom; y<cShapeTo; y++) ! XDrawLine(disp,mainWin,cursorGC,cursorPX,cursorPY+y,cursorPX+fontW-1,cursorPY+y); } XFlush(disp); --- 1924,1931 ---- if (cursorInScreen) { ! XSetBgFg(attr); int y; for (y=cShapeFrom; y<cShapeTo; y++) ! XDrawLine(disp,mainWin,gc,cursorPX,cursorPY+y,cursorPX+fontW-1,cursorPY+y); } XFlush(disp); *************** *** 1953,1957 **** } } ! XSetBgFgC(attr); //fprintf(stderr,"DrawCursor: cursorInScreen=%d from/to %d/%d\n",cursorInScreen,cShapeFrom,cShapeTo); --- 1939,1943 ---- } } ! XSetBgFg(attr); //fprintf(stderr,"DrawCursor: cursorInScreen=%d from/to %d/%d\n",cursorInScreen,cShapeFrom,cShapeTo); |