@@ -2062,6 +2062,17 @@ static int x2sqKeyPlain(XKeyEvent *xevt, KeySym *symbolic)
20622062 return -1 ; /* unknown key */
20632063 if ((charCode == 127 ) && mapDelBs )
20642064 charCode = 8 ;
2065+ if (charCode >= 1 && charCode <= 26 ) {
2066+ /* check for Ctrl-letter that gets translated into charCode 1-26 instead of letters a-z */
2067+ KeySym keysym = * symbolic ;
2068+ if (keysym >= XK_a && keysym <= XK_z )
2069+ return (int )'a' + (keysym - XK_a );
2070+ if (keysym >= XK_A && keysym <= XK_Z )
2071+ return (int )'A' + (keysym - XK_A );
2072+ }
2073+ if (charCode >= 246 /* XK_Alt_R */ && charCode <= 255 /* XK_Shift_L */ ) /* hard coded values from translateCode */
2074+ /* The shift, ctrl, alt keys shouldn't be translated by the recode below */
2075+ return charCode ;
20652076 return nConv == 0 && (modifierState & (CommandKeyBit + CtrlKeyBit + OptionKeyBit ))
20662077 ? charCode
20672078 : recode (charCode );
@@ -4792,7 +4803,7 @@ static sqInt display_ioFormPrint(sqInt bitsIndex, sqInt width, sqInt height, sqI
47924803 copyFn copy = ((depth > 0 ) && (depth <= 32 )) ? copyFns [depth ] : 0 ;
47934804 if (!copy )
47944805 {
4795- fprintf (stderr , "ioFormPrint: depth %d not supported\n" , depth );
4806+ fprintf (stderr , "ioFormPrint: depth %ld not supported\n" , depth );
47964807 return false;
47974808 }
47984809
@@ -4834,7 +4845,7 @@ static sqInt display_ioFormPrint(sqInt bitsIndex, sqInt width, sqInt height, sqI
48344845 }
48354846
48364847 /* print the PPM magic number */
4837- fprintf (ppm , "P3\n%d %d 255\n" , width , height );
4848+ fprintf (ppm , "P3\n%ld %ld 255\n" , width , height );
48384849
48394850 /* write the pixmap */
48404851 {
@@ -5485,7 +5496,7 @@ static sqInt display_ioShowDisplay(sqInt dispBitsIndex, sqInt width, sqInt heigh
54855496 if (!(depth == 1 || depth == 2 || depth == 4
54865497 || depth == 8 || depth == 16 || depth == 32 ))
54875498 {
5488- fprintf (stderr , "depth %d is not supported\n" , depth );
5499+ fprintf (stderr , "depth %ld is not supported\n" , depth );
54895500 exit (1 );
54905501 return 0 ;
54915502 }
@@ -5818,7 +5829,7 @@ static sqInt display_ioHasDisplayDepth(sqInt i)
58185829
58195830static sqInt display_ioSetDisplayMode (sqInt width , sqInt height , sqInt depth , sqInt fullscreenFlag )
58205831{
5821- fprintf (stderr , "ioSetDisplayMode(%d , %d , %d , %d )\n" ,
5832+ fprintf (stderr , "ioSetDisplayMode(%ld , %ld , %ld , %ld )\n" ,
58225833 width , height , depth , fullscreenFlag );
58235834 setSavedWindowSize ((width << 16 ) + (height & 0xFFFF ));
58245835 setFullScreenFlag (fullScreen );
@@ -6925,6 +6936,7 @@ closelog(void)
69256936static int
69266937myPrint3Dlog (char * fmt , ...)
69276938{ va_list args ;
6939+ int n ;
69286940
69296941 if (!logfile ) {
69306942 char * slash ;
@@ -6949,10 +6961,11 @@ myPrint3Dlog(char *fmt, ...)
69496961 atexit (closelog );
69506962 }
69516963 va_start (args ,fmt );
6952- vfprintf (logfile , fmt , args );
6964+ n = vfprintf (logfile , fmt , args );
69536965 va_end (args );
69546966 if (forceFlush ) /* from sqOpenGLRenderer.h */
69556967 fflush (logfile );
6968+ return n ;
69566969}
69576970
69586971# include <GL/gl.h>
@@ -7261,7 +7274,7 @@ static long display_hostWindowSetTitle(long windowIndex, char *newTitle, long si
72617274 XChangeProperty (stDisplay , stParent ,
72627275 XInternAtom (stDisplay , "_NET_WM_NAME" , False ),
72637276 XInternAtom (stDisplay , "UTF8_STRING" , False ),
7264- 8 , PropModeReplace , newTitle , sizeOfTitle );
7277+ 8 , PropModeReplace , ( unsigned char * ) newTitle , sizeOfTitle );
72657278
72667279 return 0 ;
72677280}
@@ -7279,7 +7292,7 @@ static long display_ioSizeOfNativeWindow(void *windowHandle)
72797292 * width.
72807293 */
72817294 real_border_width = attrs .border_width ? attrs .border_width : attrs .x ;
7282- return (attrs .width + 2 * real_border_width << 16 )
7295+ return (( attrs .width + 2 * real_border_width ) << 16 )
72837296 | (attrs .height + attrs .y + real_border_width );
72847297}
72857298
@@ -7295,7 +7308,7 @@ static long display_ioPositionOfNativeWindow(void *windowHandle)
72957308 & rootx , & rooty , & neglected_child ))
72967309 return -1 ;
72977310
7298- return (rootx - attrs .x << 16 ) | (rooty - attrs .y );
7311+ return (( rootx - attrs .x ) << 16 ) | (rooty - attrs .y );
72997312}
73007313
73017314#endif /* (SqDisplayVersionMajor >= 1 && SqDisplayVersionMinor >= 2) */
0 commit comments