1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * ©1995 Artsoft Development *
6 * 33659 Bielefeld-Senne *
7 * Telefon: (0521) 493245 *
8 * eMail: aeglos@valinor.owl.de *
9 * aeglos@uni-paderborn.de *
10 * q99492@pbhrzx.uni-paderborn.de *
11 *----------------------------------------------------------*
13 ***********************************************************/
26 /* allegro driver declarations */
27 DECLARE_GFX_DRIVER_LIST(GFX_DRIVER_VBEAF GFX_DRIVER_VESA2L GFX_DRIVER_VESA1)
28 DECLARE_COLOR_DEPTH_LIST(COLOR_DEPTH_8)
29 DECLARE_DIGI_DRIVER_LIST(DIGI_DRIVER_SB)
30 DECLARE_MIDI_DRIVER_LIST()
31 DECLARE_JOYSTICK_DRIVER_LIST(JOYSTICK_DRIVER_STANDARD)
33 /* allegro global variables */
34 extern volatile int key_shifts;
35 extern int num_joysticks;
36 extern JOYSTICK_INFO joy[];
37 extern int i_love_bill;
39 /* internal variables of msdos.c */
40 static boolean keyboard_auto_repeat = TRUE;
41 static int key_press_state[MAX_SCANCODES];
42 static XEvent event_buffer[MAX_EVENT_BUFFER];
43 static int pending_events;
44 static boolean joystick_event;
45 static boolean mouse_installed = FALSE;
46 static int last_mouse_pos;
47 static int last_mouse_b;
48 static int last_joystick_state;
49 static BITMAP* video_bitmap;
51 static RGB global_colormap[MAX_COLORS];
52 static int global_colormap_entries_used = 0;
54 boolean wait_for_vsync;
57 extern int playing_sounds;
58 extern struct SoundControl playlist[MAX_SOUNDS_PLAYING];
59 extern struct SoundControl emptySoundControl;
62 static BITMAP *Read_PCX_to_AllegroBitmap(char *);
64 static void allegro_drivers()
68 for (i=0; i<MAX_EVENT_BUFFER; i++)
69 event_buffer[i].type = 0;
71 for (i=0; i<MAX_SCANCODES; i++)
72 key_press_state[i] = KeyReleaseMask;
74 last_mouse_pos = mouse_pos;
80 /* enable Windows friendly timer mode (already default under Windows) */
85 if (install_mouse() > 0)
86 mouse_installed = TRUE;
88 last_joystick_state = 0;
89 joystick_event = FALSE;
91 reserve_voices(MAX_SOUNDS_PLAYING, 0);
92 if (install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL) == -1)
93 if (install_sound(DIGI_SB, MIDI_NONE, NULL) == -1)
94 sound_status = SOUND_OFF;
97 static boolean hide_mouse(Display *display, int x, int y,
98 unsigned int width, unsigned int height)
100 if (mouse_x + display->mouse_ptr->w < x || mouse_x > x + width)
102 if (mouse_y + display->mouse_ptr->h < y || mouse_y > y + height)
110 static void unhide_mouse(Display *display)
113 show_mouse(video_bitmap);
116 static KeySym ScancodeToKeySym(byte scancode)
120 case KEY_ESC: return XK_Escape;
121 case KEY_1: return XK_1;
122 case KEY_2: return XK_2;
123 case KEY_3: return XK_3;
124 case KEY_4: return XK_4;
125 case KEY_5: return XK_5;
126 case KEY_6: return XK_6;
127 case KEY_7: return XK_7;
128 case KEY_8: return XK_8;
129 case KEY_9: return XK_9;
130 case KEY_0: return XK_0;
131 case KEY_MINUS: return XK_minus;
132 case KEY_EQUALS: return XK_equal;
133 case KEY_BACKSPACE: return XK_BackSpace;
134 case KEY_TAB: return XK_Tab;
135 case KEY_Q: return XK_q;
136 case KEY_W: return XK_w;
137 case KEY_E: return XK_e;
138 case KEY_R: return XK_r;
139 case KEY_T: return XK_t;
140 case KEY_Y: return XK_y;
141 case KEY_U: return XK_u;
142 case KEY_I: return XK_i;
143 case KEY_O: return XK_o;
144 case KEY_P: return XK_p;
145 case KEY_OPENBRACE: return XK_braceleft;
146 case KEY_CLOSEBRACE: return XK_braceright;
147 case KEY_ENTER: return XK_Return;
148 case KEY_LCONTROL: return XK_Control_L;
149 case KEY_A: return XK_a;
150 case KEY_S: return XK_s;
151 case KEY_D: return XK_d;
152 case KEY_F: return XK_f;
153 case KEY_G: return XK_g;
154 case KEY_H: return XK_h;
155 case KEY_J: return XK_j;
156 case KEY_K: return XK_k;
157 case KEY_L: return XK_l;
158 case KEY_COLON: return XK_colon;
159 case KEY_QUOTE: return XK_apostrophe;
160 case KEY_TILDE: return XK_asciitilde;
161 case KEY_LSHIFT: return XK_Shift_L;
162 case KEY_BACKSLASH: return XK_backslash;
163 case KEY_Z: return XK_z;
164 case KEY_X: return XK_x;
165 case KEY_C: return XK_c;
166 case KEY_V: return XK_v;
167 case KEY_B: return XK_b;
168 case KEY_N: return XK_n;
169 case KEY_M: return XK_m;
170 case KEY_COMMA: return XK_comma;
171 case KEY_STOP: return XK_period;
172 case KEY_SLASH: return XK_slash;
173 case KEY_RSHIFT: return XK_Shift_R;
174 case KEY_ASTERISK: return XK_KP_Multiply;
175 case KEY_ALT: return XK_Alt_L;
176 case KEY_SPACE: return XK_space;
177 case KEY_CAPSLOCK: return XK_Caps_Lock;
178 case KEY_F1: return XK_F1;
179 case KEY_F2: return XK_F2;
180 case KEY_F3: return XK_F3;
181 case KEY_F4: return XK_F4;
182 case KEY_F5: return XK_F5;
183 case KEY_F6: return XK_F6;
184 case KEY_F7: return XK_F7;
185 case KEY_F8: return XK_F8;
186 case KEY_F9: return XK_F9;
187 case KEY_F10: return XK_F10;
188 case KEY_NUMLOCK: return XK_Num_Lock;
189 case KEY_SCRLOCK: return XK_Scroll_Lock;
190 case KEY_HOME: return XK_Home;
191 case KEY_UP: return XK_Up;
192 case KEY_PGUP: return XK_Page_Up;
193 case KEY_MINUS_PAD: return XK_KP_Subtract;
194 case KEY_LEFT: return XK_Left;
195 case KEY_5_PAD: return XK_KP_5;
196 case KEY_RIGHT: return XK_Right;
197 case KEY_PLUS_PAD: return XK_KP_Add;
198 case KEY_END: return XK_End;
199 case KEY_DOWN: return XK_Down;
200 case KEY_PGDN: return XK_Page_Down;
201 case KEY_INSERT: return XK_Insert;
202 case KEY_DEL: return XK_Delete;
203 case KEY_PRTSCR: return XK_Print;
204 case KEY_F11: return XK_F11;
205 case KEY_F12: return XK_F12;
206 case KEY_LWIN: return XK_Meta_L;
207 case KEY_RWIN: return XK_Meta_R;
208 case KEY_MENU: return XK_Menu;
209 case KEY_PAD: return XK_VoidSymbol;
210 case KEY_RCONTROL: return XK_Control_R;
211 case KEY_ALTGR: return XK_Alt_R;
212 case KEY_SLASH2: return XK_KP_Divide;
213 case KEY_PAUSE: return XK_Pause;
215 case NEW_KEY_BACKSLASH: return XK_backslash;
216 case NEW_KEY_1_PAD: return XK_KP_1;
217 case NEW_KEY_2_PAD: return XK_KP_2;
218 case NEW_KEY_3_PAD: return XK_KP_3;
219 case NEW_KEY_4_PAD: return XK_KP_4;
220 case NEW_KEY_5_PAD: return XK_KP_5;
221 case NEW_KEY_6_PAD: return XK_KP_6;
222 case NEW_KEY_7_PAD: return XK_KP_7;
223 case NEW_KEY_8_PAD: return XK_KP_8;
224 case NEW_KEY_9_PAD: return XK_KP_9;
225 case NEW_KEY_0_PAD: return XK_KP_0;
226 case NEW_KEY_STOP_PAD: return XK_KP_Separator;
227 case NEW_KEY_EQUALS_PAD: return XK_KP_Equal;
228 case NEW_KEY_SLASH_PAD: return XK_KP_Divide;
229 case NEW_KEY_ASTERISK_PAD: return XK_KP_Multiply;
230 case NEW_KEY_ENTER_PAD: return XK_KP_Enter;
232 default: return XK_VoidSymbol;
236 void XMapWindow(Display *display, Window window)
239 unsigned int width, height;
242 x = display->screens[display->default_screen].x;
243 y = display->screens[display->default_screen].y;
244 width = display->screens[display->default_screen].width;
245 height = display->screens[display->default_screen].height;
247 mouse_off = hide_mouse(display, x, y, width, height);
248 blit((BITMAP *)window, video_bitmap, 0, 0, x, y, width, height);
251 unhide_mouse(display);
254 static unsigned long AllocColorCell(int r, int g, int b)
256 byte pixel_mapping = 0;
263 /* try to use existing colors from the global colormap */
264 for (i=0; i<global_colormap_entries_used; i++)
266 if (r == global_colormap[i].r &&
267 g == global_colormap[i].g &&
268 b == global_colormap[i].b) /* color found */
275 if (i == global_colormap_entries_used) /* color not found */
277 if (global_colormap_entries_used < MAX_COLORS)
278 global_colormap_entries_used++;
280 global_colormap[i].r = r;
281 global_colormap[i].g = g;
282 global_colormap[i].b = b;
287 return pixel_mapping;
290 Display *XOpenDisplay(char *display_name)
294 BITMAP *mouse_bitmap = NULL;
297 filename = getPath3(options.ro_base_directory, GRAPHICS_DIRECTORY,
300 mouse_bitmap = Read_PCX_to_AllegroBitmap(filename);
303 if (mouse_bitmap == NULL)
306 screen = malloc(sizeof(Screen));
307 display = malloc(sizeof(Display));
312 screen[0].white_pixel = 0xFF;
313 screen[0].black_pixel = 0x00;
315 screen[0].white_pixel = AllocColorCell(0xFFFF, 0xFFFF, 0xFFFF);
316 screen[0].black_pixel = AllocColorCell(0x0000, 0x0000, 0x0000);
318 screen[0].video_bitmap = NULL;
320 display->default_screen = 0;
321 display->screens = screen;
322 display->mouse_ptr = mouse_bitmap;
328 /* force Windows 95 to switch to fullscreen mode */
329 set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);
331 set_gfx_mode(GFX_AUTODETECT, XRES, YRES, 0, 0);
336 Window XCreateSimpleWindow(Display *display, Window parent, int x, int y,
337 unsigned int width, unsigned int height,
338 unsigned int border_width, unsigned long border,
339 unsigned long background)
341 video_bitmap = create_video_bitmap(XRES, YRES);
342 clear_to_color(video_bitmap, background);
344 display->screens[display->default_screen].video_bitmap = video_bitmap;
345 display->screens[display->default_screen].x = x;
346 display->screens[display->default_screen].y = y;
347 display->screens[display->default_screen].width = XRES;
348 display->screens[display->default_screen].height = YRES;
350 set_mouse_sprite(display->mouse_ptr);
353 set_mouse_sprite_focus(1, 1);
356 set_mouse_speed(1, 1);
357 set_mouse_range(display->screens[display->default_screen].x + 1,
358 display->screens[display->default_screen].y + 1,
359 display->screens[display->default_screen].x + WIN_XSIZE + 1,
360 display->screens[display->default_screen].y + WIN_YSIZE + 1);
362 show_video_bitmap(video_bitmap);
364 return (Window)video_bitmap;
367 Status XStringListToTextProperty(char **list, int count,
368 XTextProperty *text_prop_return)
374 string = malloc(strlen(list[0] + 1));
375 strcpy(string, list[0]);
376 text_prop_return->value = (unsigned char *)string;
380 text_prop_return = NULL;
385 void XFree(void *data)
391 GC XCreateGC(Display *display, Drawable d, unsigned long value_mask,
395 gcv = malloc(sizeof(XGCValues));
396 gcv->foreground = values->foreground;
397 gcv->background = values->background;
398 gcv->graphics_exposures = values->graphics_exposures;
399 gcv->clip_mask = values->clip_mask;
400 gcv->clip_x_origin = values->clip_x_origin;
401 gcv->clip_y_origin = values->clip_y_origin;
402 gcv->value_mask = value_mask;
406 void XSetClipMask(Display *display, GC gc, Pixmap pixmap)
408 XGCValues *gcv = (XGCValues *)gc;
410 gcv->clip_mask = pixmap;
411 gcv->value_mask |= GCClipMask;
414 void XSetClipOrigin(Display *display, GC gc, int x, int y)
416 XGCValues *gcv = (XGCValues *)gc;
418 gcv->clip_x_origin = x;
419 gcv->clip_x_origin = y;
422 void XFillRectangle(Display *display, Drawable d, GC gc, int x, int y,
423 unsigned int width, unsigned int height)
425 boolean mouse_off = FALSE;
427 if ((BITMAP *)d == video_bitmap)
429 x += display->screens[display->default_screen].x;
430 y += display->screens[display->default_screen].y;
431 freeze_mouse_flag = TRUE;
432 mouse_off = hide_mouse(display, x, y, width, height);
435 rectfill((BITMAP *)d, x, y, x + width - 1, y + height - 1,
436 ((XGCValues *)gc)->foreground);
439 unhide_mouse(display);
441 freeze_mouse_flag = FALSE;
444 Pixmap XCreatePixmap(Display *display, Drawable d, unsigned int width,
445 unsigned int height, unsigned int depth)
447 BITMAP *bitmap = NULL;
449 if (gfx_capabilities & GFX_HW_VRAM_BLIT &&
450 width == FXSIZE && height == FYSIZE)
451 bitmap = create_video_bitmap(width, height);
454 bitmap = create_bitmap(width, height);
456 return (Pixmap)bitmap;
459 void XSync(Display *display, Bool discard_events)
461 wait_for_vsync = TRUE;
464 inline void XCopyArea(Display *display, Drawable src, Drawable dest, GC gc,
465 int src_x, int src_y,
466 unsigned int width, unsigned int height,
467 int dest_x, int dest_y)
469 boolean mouse_off = FALSE;
471 if ((BITMAP *)src == video_bitmap)
473 src_x += display->screens[display->default_screen].x;
474 src_y += display->screens[display->default_screen].y;
477 if ((BITMAP *)dest == video_bitmap)
479 dest_x += display->screens[display->default_screen].x;
480 dest_y += display->screens[display->default_screen].y;
481 freeze_mouse_flag = TRUE;
482 mouse_off = hide_mouse(display, dest_x, dest_y, width, height);
487 wait_for_vsync = FALSE;
491 if (((XGCValues *)gc)->value_mask & GCClipMask)
492 masked_blit((BITMAP *)src, (BITMAP *)dest, src_x, src_y, dest_x, dest_y,
495 blit((BITMAP *)src, (BITMAP *)dest, src_x, src_y, dest_x, dest_y,
499 unhide_mouse(display);
501 freeze_mouse_flag = FALSE;
504 static BITMAP *Image_to_AllegroBitmap(Image *image)
507 byte *src_ptr = image->data;
508 byte pixel_mapping[MAX_COLORS];
509 unsigned int depth = 8;
517 /* allocate new allegro bitmap structure */
518 if ((bitmap = create_bitmap_ex(depth, image->width, image->height)) == NULL)
520 errno_pcx = PCX_NoMemory;
526 /* try to use existing colors from the global colormap */
527 for (i=0; i<MAX_COLORS; i++)
534 if (!image->rgb.color_used[i])
539 r = image->rgb.red[i] >> 10;
540 g = image->rgb.green[i] >> 10;
541 b = image->rgb.blue[i] >> 10;
543 for (j=0; j<global_colormap_entries_used; j++)
545 if (r == global_colormap[j].r &&
546 g == global_colormap[j].g &&
547 b == global_colormap[j].b) /* color found */
549 pixel_mapping[i] = j;
554 if (j == global_colormap_entries_used) /* color not found */
556 if (global_colormap_entries_used < MAX_COLORS)
557 global_colormap_entries_used++;
559 global_colormap[j].r = r;
560 global_colormap[j].g = g;
561 global_colormap[j].b = b;
563 pixel_mapping[i] = j;
566 pixel_mapping[i] = AllocColorCell(image->rgb.red[i],
573 /* copy bitmap data */
574 for (y=0; y<image->height; y++)
575 for (x=0; x<image->width; x++)
576 putpixel(bitmap, x, y, pixel_mapping[*src_ptr++]);
581 static BITMAP *Read_PCX_to_AllegroBitmap(char *filename)
586 /* read the graphic file in PCX format to internal image structure */
587 if ((image = Read_PCX_to_Image(filename)) == NULL)
590 /* convert internal image structure to allegro bitmap structure */
591 if ((bitmap = Image_to_AllegroBitmap(image)) == NULL)
594 set_palette(global_colormap);
599 int Read_PCX_to_Pixmap(Display *display, Window window, GC gc, char *filename,
600 Pixmap *pixmap, Pixmap *pixmap_mask)
604 if ((bitmap = Read_PCX_to_AllegroBitmap(filename)) == NULL)
607 *pixmap = (Pixmap)bitmap;
608 *pixmap_mask = (Pixmap)bitmap;
613 int XpmReadFileToPixmap(Display *display, Drawable d, char *filename,
614 Pixmap *pixmap_return, Pixmap *shapemask_return,
615 XpmAttributes *attributes)
619 if ((bitmap = Read_PCX_to_AllegroBitmap(filename)) == NULL)
620 return XpmOpenFailed;
622 *pixmap_return = (Pixmap)bitmap;
627 int XReadBitmapFile(Display *display, Drawable d, char *filename,
628 unsigned int *width_return, unsigned int *height_return,
629 Pixmap *bitmap_return,
630 int *x_hot_return, int *y_hot_return)
634 if ((bitmap = Read_PCX_to_AllegroBitmap(filename)) == NULL)
635 return BitmapOpenFailed;
637 *width_return = bitmap->w;
638 *height_return = bitmap->h;
641 *bitmap_return = (Pixmap)bitmap;
643 return BitmapSuccess;
646 void XFreePixmap(Display *display, Pixmap pixmap)
648 if (pixmap != DUMMY_MASK &&
649 (is_memory_bitmap((BITMAP *)pixmap) ||
650 is_screen_bitmap((BITMAP *)pixmap)))
651 destroy_bitmap((BITMAP *)pixmap);
654 void XFreeGC(Display *display, GC gc)
658 gcv = (XGCValues *)gc;
663 void XCloseDisplay(Display *display)
665 BITMAP *bitmap = video_bitmap;
667 if (is_screen_bitmap(bitmap))
668 destroy_bitmap(bitmap);
670 if (display->screens)
671 free(display->screens);
676 /* return to text mode (or DOS box on Windows screen) */
677 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
680 void XNextEvent(Display *display, XEvent *event_return)
682 while (!pending_events)
685 memcpy(event_return, &event_buffer[pending_events], sizeof(XEvent));
689 static void NewKeyEvent(int key_press_state, KeySym keysym)
693 if (pending_events >= MAX_EVENT_BUFFER)
697 xkey = (XKeyEvent *)&event_buffer[pending_events];
698 xkey->type = key_press_state;
699 xkey->state = (unsigned int)keysym;
702 #define HANDLE_RAW_KB_ALL_KEYS 0
703 #define HANDLE_RAW_KB_MODIFIER_KEYS_ONLY 1
705 static int modifier_scancode[] =
721 static void HandleKeyboardRaw(int mode)
725 for (i=0; i<MAX_SCANCODES; i++)
727 int scancode, new_state, event_type;
730 if (mode == HANDLE_RAW_KB_MODIFIER_KEYS_ONLY)
732 if ((scancode = modifier_scancode[i]) == -1)
738 key_pressed = key[scancode];
739 new_state = (key_pressed ? KeyPressMask : KeyReleaseMask);
740 event_type = (key_pressed ? KeyPress : KeyRelease);
742 if (key_press_state[i] == new_state) /* state not changed */
745 key_press_state[i] = new_state;
747 NewKeyEvent(event_type, ScancodeToKeySym(scancode));
751 static void HandleKeyboardEvent()
755 int key_info = readkey();
756 int scancode = (key_info >> 8);
757 int ascii = (key_info & 0xff);
758 KeySym keysym = ScancodeToKeySym(scancode);
760 if (scancode == KEY_PAD)
762 /* keys on the numeric keypad return just scancode 'KEY_PAD'
763 for some reason, so we must handle them separately */
765 if (ascii >= '0' && ascii <= '9')
766 keysym = XK_KP_0 + (KeySym)(ascii - '0');
767 else if (ascii == '.')
768 keysym = XK_KP_Separator;
770 else if (ascii >= ' ' && ascii <= 'Z')
771 keysym = XK_space + (KeySym)(ascii - ' ');
772 else if (ascii == '^')
773 keysym = XK_asciicircum;
774 else if (ascii == '_')
775 keysym = XK_underscore;
776 else if (ascii == 'Ä')
777 keysym = XK_Adiaeresis;
778 else if (ascii == 'Ö')
779 keysym = XK_Odiaeresis;
780 else if (ascii == 'Ü')
781 keysym = XK_Udiaeresis;
782 else if (ascii == 'ä')
783 keysym = XK_adiaeresis;
784 else if (ascii == 'ö')
785 keysym = XK_odiaeresis;
786 else if (ascii == 'ü')
787 keysym = XK_udiaeresis;
788 else if (ascii == 'ß')
791 NewKeyEvent(KeyPress, keysym);
793 else if (key_shifts & (KB_SHIFT_FLAG | KB_CTRL_FLAG | KB_ALT_FLAG))
795 /* the allegro function keypressed() does not give us single pressed
796 modifier keys, so we must detect them with the internal global
797 allegro variable 'key_shifts' and then handle them separately */
799 HandleKeyboardRaw(HANDLE_RAW_KB_MODIFIER_KEYS_ONLY);
803 int XPending(Display *display)
805 XButtonEvent *xbutton;
806 XMotionEvent *xmotion;
809 /* When using 'HandleKeyboardRaw()', keyboard input is also stored in
810 the allegro keyboard input buffer and would be available a second
811 time by calling 'HandleKeyboardEvent()'. To avoid double keyboard
812 events, the allegro function 'clear_keybuf()' must be called each
813 time when switching from calling 'HandleKeyboardRaw()' to calling
814 'HandleKeyboardEvent()' to get keyboard input, which is actually
815 done by 'XAutoRepeatOn()' which sets keyboard_auto_repeat to TRUE. */
818 if (keyboard_auto_repeat)
819 HandleKeyboardEvent();
821 HandleKeyboardRaw(HANDLE_RAW_KB_ALL_KEYS);
823 /* mouse motion event */
824 if (mouse_pos != last_mouse_pos)
826 last_mouse_pos = mouse_pos;
828 xmotion = (XMotionEvent *)&event_buffer[pending_events];
829 xmotion->type = MotionNotify;
830 xmotion->x = mouse_x - display->screens[display->default_screen].x;
831 xmotion->y = mouse_y - display->screens[display->default_screen].y;
834 /* mouse button event */
835 if (mouse_b != last_mouse_b)
837 for (i=0; i<3; i++) /* check all three mouse buttons */
839 int bitmask = (1 << i);
841 if ((last_mouse_b & bitmask) != (mouse_b & bitmask))
843 int mapping[3] = { 1, 3, 2 };
846 xbutton = (XButtonEvent *)&event_buffer[pending_events];
847 xbutton->type = (mouse_b & bitmask ? ButtonPress : ButtonRelease);
848 xbutton->button = mapping[i];
849 xbutton->x = mouse_x - display->screens[display->default_screen].x;
850 xbutton->y = mouse_y - display->screens[display->default_screen].y;
853 last_mouse_b = mouse_b;
856 return pending_events;
859 KeySym XLookupKeysym(XKeyEvent *key_event, int index)
861 return key_event->state;
864 int XLookupString(XKeyEvent *key_event, char *buffer, int buffer_size,
865 KeySym *key, XComposeStatus *compose)
867 *key = key_event->state;
871 void XSetForeground(Display *display, GC gc, unsigned long pixel)
873 XGCValues *gcv = (XGCValues *)gc;
875 gcv->foreground = pixel;
878 void XDrawLine(Display *display, Drawable d, GC gc,
879 int x1, int y1, int x2, int y2)
881 XGCValues *gcv = (XGCValues *)gc;
882 boolean mouse_off = FALSE;
884 if ((BITMAP *)d == video_bitmap)
886 x1 += display->screens[display->default_screen].x;
887 y1 += display->screens[display->default_screen].y;
888 x2 += display->screens[display->default_screen].x;
889 y2 += display->screens[display->default_screen].y;
890 freeze_mouse_flag = TRUE;
891 mouse_off = hide_mouse(display, MIN(x1, x2), MIN(y1, y2),
892 MAX(x1, x2) - MIN(x1, x2),
893 MAX(y1, y2) - MIN(y1, y2));
896 line((BITMAP *)d, x1, y1, x2, y2, gcv->foreground);
899 unhide_mouse(display);
901 freeze_mouse_flag = FALSE;
904 void XDestroyImage(XImage *ximage)
908 Bool XQueryPointer(Display *display, Window window,
909 Window *root, Window *child, int *root_x, int *root_y,
910 int *win_x, int *win_y, unsigned int *mask)
912 *win_x = mouse_x - display->screens[display->default_screen].x;
913 *win_y = mouse_y - display->screens[display->default_screen].y;
918 void XAutoRepeatOn(Display *display)
920 keyboard_auto_repeat = TRUE;
924 void XAutoRepeatOff(Display *display)
926 keyboard_auto_repeat = FALSE;
929 void NetworkServer(int port, int serveronly)
931 Error(ERR_WARN, "networking not supported in DOS version");