--- KXL-1.1.7.old/KXL.m4 +++ KXL-1.1.7/KXL.m4 @@ -3,7 +3,7 @@ dnl Test for libKXL, and define KXL_CFLAGS and KXL_LIBS as appropriate. dnl enables arguments --with-kxl-prefix= -with-kxl-inc-prefix= dnl -AC_DEFUN(AM_PATH_KXL, +AC_DEFUN([AM_PATH_KXL], [dnl dnl Get the cfags and libraries for KXL dnl --- KXL-1.1.7.old/src/KXL.h +++ KXL-1.1.7/src/KXL.h @@ -2,8 +2,10 @@ #define _KXLIB_H_ #include +#include #include #include +#include #include @@ -150,12 +152,12 @@ #define KXL_KEY_Braceright 0x07d #define KXL_KEY_Asciitilde 0x07e // Type of variable -typedef signed char Sint8; -typedef unsigned char Uint8; -typedef signed short Sint16; -typedef unsigned short Uint16; -typedef signed long Sint32; -typedef unsigned long Uint32; +typedef int8_t Sint8; +typedef uint8_t Uint8; +typedef int16_t Sint16; +typedef uint16_t Uint16; +typedef int32_t Sint32; +typedef uint32_t Uint32; // Image typedef struct { Pixmap Buffer; // Drawing image @@ -205,6 +207,7 @@ KXL_Frame *Frame; // Pointer of frame structure GC FontGC; // GC of font XFontStruct *WinFont; // Pointer of font structrue + Bool DetectAutoRepeat; // Does the server have detectable auto repeat } KXL_Window; // RGBE palette typedef struct { --- KXL-1.1.7.old/src/KXLimage.c +++ KXL-1.1.7/src/KXLimage.c @@ -1,4 +1,5 @@ #include +#include #include "KXL.h" extern KXL_Window *KXL_Root; --- KXL-1.1.7.old/src/KXLsound.c +++ KXL-1.1.7/src/KXLsound.c @@ -1,6 +1,9 @@ #include +#include #include #include +#include +#include #include #include #include @@ -22,7 +25,7 @@ struct { Uint16 ListCnt; Sint32 ID; - Sint32 Pipe[2]; + int Pipe[2]; Sint32 Device; Uint16 PlayCnt; KXL_SoundControl PlaySound[MAX_SOUNDS_PLAYING]; @@ -242,11 +245,19 @@ KXL_SoundOk = False; KXL_LoadSoundData(path, fname); - // device check - if ((KXL_SoundData.Device = open("/dev/dsp", O_WRONLY)) == -1) { - fprintf(stderr, "KXL error message\nnot found sound card\n"); + // Open the sound device in non-blocking mode, because ALSA's OSS + // emulation and some broken OSS drivers would make a blocking call + // wait forever until the device is available. Since this breaks the + // OSS spec, we immediately put it back to blocking mode if the + // operation was successful. + KXL_SoundData.Device = open("/dev/dsp", O_WRONLY|O_NDELAY); + if (KXL_SoundData.Device < 0) { + fprintf(stderr, "KXL error message\ncould not open sound card (%s)\n", + strerror(errno)); return; } + fcntl( KXL_SoundData.Device, F_SETFL, + fcntl( KXL_SoundData.Device, F_GETFL ) &~ FNDELAY ); // create pipe if (pipe(KXL_SoundData.Pipe) < 0) { fprintf(stderr, "KXL error message\npipe error\n"); --- KXL-1.1.7.old/src/KXLvisual.c +++ KXL-1.1.7/src/KXLvisual.c @@ -1,4 +1,6 @@ #include +#include +#include #include "KXL.h" //================================================================ @@ -364,7 +366,11 @@ KXL_ReSizeFrame(w, h); KXL_Clear_Frame(0, 0, w, h); // Auto repeat off - XAutoRepeatOff(KXL_Root->Display); + XkbSetDetectableAutoRepeat(KXL_Root->Display, True, + &KXL_Root->DetectAutoRepeat); + if(!KXL_Root->DetectAutoRepeat) { + XAutoRepeatOff(KXL_Root->Display); + } } //============================================================== @@ -377,7 +383,9 @@ XFreeGC(KXL_Root->Display, KXL_Root->Frame->Gc); KXL_Free(KXL_Root->Frame); // Auto repeat on - XAutoRepeatOn(KXL_Root->Display); + if(!KXL_Root->DetectAutoRepeat) { + XAutoRepeatOn(KXL_Root->Display); + } // Delete font XFreeGC(KXL_Root->Display, KXL_Root->FontGC); // Delete window @@ -429,9 +437,12 @@ 0, 0); KXL_Root->WinFont = XLoadQueryFont(KXL_Root->Display, str); if (KXL_Root->WinFont == (XFontStruct *)NULL) { + KXL_Root->WinFont = XLoadQueryFont(KXL_Root->Display, "fixed"); + } + if (KXL_Root->WinFont == (XFontStruct *)NULL) { fprintf(stderr, "KXL error message\n" - "loading font error (%s)\n", + "loading font error (%s), fallback failed\n", str); exit(-1); }