X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fx11.h;h=4ef96acbd976f5553dcbb751d58375626bb51c7e;hb=608be3bcd270eb45628a274eddb6dbcc8940accf;hp=9903e8c977ca172acab32a7f74ed68a694e814c7;hpb=681721dddc91bcdaef50002d1e861cc8d484e938;p=rocksndiamonds.git diff --git a/src/libgame/x11.h b/src/libgame/x11.h index 9903e8c9..4ef96acb 100644 --- a/src/libgame/x11.h +++ b/src/libgame/x11.h @@ -1,7 +1,7 @@ /*********************************************************** * Artsoft Retro-Game Library * *----------------------------------------------------------* -* (c) 1994-2001 Artsoft Entertainment * +* (c) 1994-2002 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * @@ -34,15 +34,28 @@ #define TARGET_STRING "X11" #endif +#if defined(PLATFORM_UNIX) +/* This triggers some stuff that is needed because X11 (XSetClipOrigin(), + to be precise) is often very slow when preparing a masked XCopyArea() + for big Pixmaps. + To prevent this, small (tile-sized) mask Pixmaps are created which will + then be set much faster with XSetClipOrigin() and speed things up a lot. */ +#define TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND +#endif + #define FULLSCREEN_STATUS FULLSCREEN_NOT_AVAILABLE +#define CURSOR_MAX_WIDTH 32 +#define CURSOR_MAX_HEIGHT 32 + /* X11 type definitions */ typedef struct X11DrawableInfo Bitmap; typedef struct X11DrawableInfo DrawWindow; typedef struct X11DrawableInfo DrawBuffer; -/* "Pixel" is already defined in X11/Intrinsic.h */ +/* "Pixel" is already defined */ +/* "Cursor" is already defined */ typedef KeySym Key; @@ -59,6 +72,9 @@ typedef XClientMessageEvent ClientMessageEvent; struct X11DrawableInfo { + char *source_filename; + + int width, height; Drawable drawable; Drawable clip_mask; GC gc; /* GC for normal drawing (inheritated from 'window') */ @@ -67,6 +83,15 @@ struct X11DrawableInfo GC clip_gc; /* can be 'stored_clip_gc' or one-tile-only clip GC */ }; +struct MouseCursorInfo +{ + int width, height; + int hot_x, hot_y; + + char data[CURSOR_MAX_WIDTH * CURSOR_MAX_HEIGHT / 8]; + char mask[CURSOR_MAX_WIDTH * CURSOR_MAX_HEIGHT / 8]; +}; + struct XY { short x, y; @@ -75,6 +100,9 @@ struct XY /* X11 symbol definitions */ +#define BLACK_PIXEL BlackPixel(display, screen) +#define WHITE_PIXEL WhitePixel(display, screen) + #define EVENT_BUTTONPRESS ButtonPress #define EVENT_BUTTONRELEASE ButtonRelease #define EVENT_MOTIONNOTIFY MotionNotify @@ -283,11 +311,29 @@ struct XY #define KSYM_F23 XK_F23 #define KSYM_F24 XK_F24 +#define KSYM_FKEY_FIRST KSYM_F1 +#define KSYM_FKEY_LAST KSYM_F24 +#define KSYM_NUM_FKEYS (KSYM_FKEY_LAST - KSYM_FKEY_FIRST + 1) + /* X11 function definitions */ inline void X11InitVideoDisplay(void); inline void X11InitVideoBuffer(DrawBuffer **, DrawWindow **); + +void X11ZoomBitmap(Bitmap *, Bitmap *); Bitmap *X11LoadImage(char *); +inline void X11CreateBitmapContent(Bitmap *, int, int, int); +inline void X11FreeBitmapPointers(Bitmap *); +inline void X11CopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int); +inline void X11FillRectangle(Bitmap *, int, int, int, int, Pixel); +inline void X11DrawSimpleLine(Bitmap *, int, int, int, int, Pixel); +inline Pixel X11GetPixel(Bitmap *, int, int); +inline Pixel X11GetPixelFromRGB(unsigned int, unsigned int, unsigned int); + +#if defined(TARGET_X11_NATIVE) +void X11SetMouseCursor(struct MouseCursorInfo *); +#endif + #endif /* X11_H */