Mercurial > hg > xemacs-beta
comparison src/gpmevent.c @ 440:8de8e3f6228a r21-2-28
Import from CVS: tag r21-2-28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:33:38 +0200 |
parents | 84b14dcb0985 |
children | abe6d1db359e |
comparison
equal
deleted
inserted
replaced
439:357dd071b03c | 440:8de8e3f6228a |
---|---|
1 /* GPM functions | 1 /* GPM (General purpose mouse) functions |
2 Copyright (C) 1997 William M. Perry <wmperry@gnu.org> | 2 Copyright (C) 1997 William M. Perry <wmperry@gnu.org> |
3 Copyright (C) 1999 Free Software Foundation, Inc. | 3 Copyright (C) 1999 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of XEmacs. | 5 This file is part of XEmacs. |
6 | 6 |
50 | 50 |
51 extern int gpm_tried; | 51 extern int gpm_tried; |
52 extern void *gpm_stack; | 52 extern void *gpm_stack; |
53 | 53 |
54 static int (*orig_event_pending_p) (int); | 54 static int (*orig_event_pending_p) (int); |
55 static void (*orig_next_event_cb) (struct Lisp_Event *); | 55 static void (*orig_next_event_cb) (Lisp_Event *); |
56 | 56 |
57 static Lisp_Object gpm_event_queue; | 57 static Lisp_Object gpm_event_queue; |
58 static Lisp_Object gpm_event_queue_tail; | 58 static Lisp_Object gpm_event_queue_tail; |
59 | 59 |
60 struct __gpm_state { | 60 struct __gpm_state { |
93 gpm_fd = gpm_consolefd = -1; | 93 gpm_fd = gpm_consolefd = -1; |
94 gpm_stack = NULL; | 94 gpm_stack = NULL; |
95 } | 95 } |
96 | 96 |
97 static int | 97 static int |
98 get_process_infd (struct Lisp_Process *p) | 98 get_process_infd (Lisp_Process *p) |
99 { | 99 { |
100 Lisp_Object instr, outstr; | 100 Lisp_Object instr, outstr; |
101 get_process_streams (p, &instr, &outstr); | 101 get_process_streams (p, &instr, &outstr); |
102 assert (!NILP (instr)); | 102 assert (!NILP (instr)); |
103 return filedesc_stream_fd (XLSTREAM (instr)); | 103 return filedesc_stream_fd (XLSTREAM (instr)); |
111 { | 111 { |
112 Gpm_Event ev; | 112 Gpm_Event ev; |
113 int modifiers = 0; | 113 int modifiers = 0; |
114 int button = 1; | 114 int button = 1; |
115 Lisp_Object fake_event; | 115 Lisp_Object fake_event; |
116 struct Lisp_Event *event = NULL; | 116 Lisp_Event *event = NULL; |
117 struct gcpro gcpro1; | 117 struct gcpro gcpro1; |
118 static int num_events; | 118 static int num_events; |
119 | 119 |
120 CHECK_PROCESS (process); | 120 CHECK_PROCESS (process); |
121 | 121 |
367 } | 367 } |
368 | 368 |
369 static void | 369 static void |
370 tty_set_mouse_position (struct window *w, int x, int y) | 370 tty_set_mouse_position (struct window *w, int x, int y) |
371 { | 371 { |
372 /* | 372 /* |
373 #### I couldn't find any GPM functions that set the mouse position. | 373 #### I couldn't find any GPM functions that set the mouse position. |
374 #### Mr. Perry had left this function empty; that must be why. | 374 #### Mr. Perry had left this function empty; that must be why. |
375 #### karlheg | 375 #### karlheg |
376 */ | 376 */ |
377 } | 377 } |
388 } | 388 } |
389 } | 389 } |
390 return (orig_event_pending_p (user_p)); | 390 return (orig_event_pending_p (user_p)); |
391 } | 391 } |
392 | 392 |
393 static void gpm_next_event_cb (struct Lisp_Event *event) | 393 static void gpm_next_event_cb (Lisp_Event *event) |
394 { | 394 { |
395 /* #### It would be nice to preserve some sort of ordering of the | 395 /* #### It would be nice to preserve some sort of ordering of the |
396 ** #### different types of events, but that would be quite a bit | 396 ** #### different types of events, but that would be quite a bit |
397 ** #### of work, and would more than likely break the abstraction | 397 ** #### of work, and would more than likely break the abstraction |
398 ** #### between the other event loops and this one. | 398 ** #### between the other event loops and this one. |
399 */ | 399 */ |
400 | 400 |
401 if (!NILP (gpm_event_queue)) | 401 if (!NILP (gpm_event_queue)) |
402 { | 402 { |
403 Lisp_Object queued_event = dequeue_event (&gpm_event_queue, &gpm_event_queue_tail); | 403 Lisp_Object queued_event = dequeue_event (&gpm_event_queue, &gpm_event_queue_tail); |
404 *event = *(XEVENT (queued_event)); | 404 *event = *(XEVENT (queued_event)); |
405 | 405 |
577 | 577 |
578 /* Make sure Gpm_Open() does ioctl() on the correct | 578 /* Make sure Gpm_Open() does ioctl() on the correct |
579 ** descriptor, or it can get the wrong terminal sizes, etc. | 579 ** descriptor, or it can get the wrong terminal sizes, etc. |
580 */ | 580 */ |
581 gpm_consolefd = fd; | 581 gpm_consolefd = fd; |
582 | 582 |
583 /* We have to pass the virtual console manually, otherwise if you | 583 /* We have to pass the virtual console manually, otherwise if you |
584 ** use 'gnuclient -nw' to connect to an XEmacs that is running in | 584 ** use 'gnuclient -nw' to connect to an XEmacs that is running in |
585 ** X, Gpm_Open() tries to use ttyname(0 | 1 | 2) to find out which | 585 ** X, Gpm_Open() tries to use ttyname(0 | 1 | 2) to find out which |
586 ** console you are using, which is of course not correct for the | 586 ** console you are using, which is of course not correct for the |
587 ** new tty device. | 587 ** new tty device. |