annotate src/gui-msw.c @ 1066:5de13d96e131

[xemacs-hg @ 2002-10-24 13:49:07 by youngs] 2002-10-24 Andy Piper <andy@xemacs.org> * dialog.el (make-dialog-box): for general dialogs only delete-frame-hook will be run.
author youngs
date Thu, 24 Oct 2002 13:49:13 +0000
parents 8d610ea37af8
children e22b0213b713
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* mswindows GUI code. (menubars, scrollbars, toolbars, dialogs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1998 Andy Piper.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
23 /* This file essentially Mule-ized (except perhaps some Unicode splitting).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
24 5-2000. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
25
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include "lisp.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 826
diff changeset
28 #include "console-msw-impl.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
29 #include "redisplay.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "gui.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
31 #include "glyphs.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 826
diff changeset
32 #include "frame-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include "elhash.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
34 #include "events.h"
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
35 #include "buffer.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 * Return value is Qt if we have dispatched the command,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 * or Qnil if id has not been mapped to a callback.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 * Window procedure may try other targets to route the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 * command if we return nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 Lisp_Object
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
44 mswindows_handle_gui_wm_command (struct frame *f, HWND ctrl, LPARAM id)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 /* Try to map the command id through the proper hash table */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
47 Lisp_Object callback, callback_ex, image_instance, frame, event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
48
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
49 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 793
diff changeset
51 image_instance = Fgethash (make_int_verify (id),
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
52 FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f), Qnil);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
53 /* It is possible for a widget action to cause it to get out of sync
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
54 with its instantiator. Thus it is necessary to signal this
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
55 possibility. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
56 if (IMAGE_INSTANCEP (image_instance))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
57 XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (image_instance) = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
58 callback = Fgethash (make_int (id),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
59 FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), Qnil);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
60 callback_ex = Fgethash (make_int (id),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
61 FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f), Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
63 if (!NILP (callback_ex) && !UNBOUNDP (callback_ex))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
64 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
65 event = Fmake_event (Qnil, Qnil);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
66
964
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
67 #ifdef USE_KKCC
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
68 XSET_EVENT_TYPE (event, misc_user_event);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
69 XSET_EVENT_CHANNEL (event, frame);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
70 XSET_EVENT_TIMESTAMP (event, GetTickCount());
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
71 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (event), Qeval);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
72 XSET_MISC_USER_DATA_OBJECT (XEVENT_DATA (event),
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
73 list4 (Qfuncall, callback_ex, image_instance, event));
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
74 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
75 XEVENT (event)->event_type = misc_user_event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
76 XEVENT (event)->channel = frame;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
77 XEVENT (event)->timestamp = GetTickCount ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
78 XEVENT (event)->event.eval.function = Qeval;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
79 XEVENT (event)->event.eval.object =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
80 list4 (Qfuncall, callback_ex, image_instance, event);
964
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
81 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
82 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
83 else if (NILP (callback) || UNBOUNDP (callback))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
84 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
85 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
86 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
87 Lisp_Object fn, arg;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
88
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
89 event = Fmake_event (Qnil, Qnil);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
90
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
91 get_gui_callback (callback, &fn, &arg);
964
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
92 #ifdef USE_KKCC
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
93 XSET_EVENT_TYPE (event, misc_user_event);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
94 XSET_EVENT_CHANNEL (event, frame);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
95 XSET_EVENT_TIMESTAMP (event, GetTickCount());
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
96 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (event), fn);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
97 XSET_MISC_USER_DATA_OBJECT (XEVENT_DATA (event), arg);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
98 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
99 XEVENT (event)->event_type = misc_user_event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
100 XEVENT (event)->channel = frame;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
101 XEVENT (event)->timestamp = GetTickCount ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
102 XEVENT (event)->event.eval.function = fn;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
103 XEVENT (event)->event.eval.object = arg;
964
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
104 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
105 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
106
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
107 mswindows_enqueue_dispatch_event (event);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
108 /* The result of this evaluation could cause other instances to change so
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
109 enqueue an update callback to check this. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
110 enqueue_magic_eval_event (update_widget_instances, frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
111 return Qt;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
112 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
113
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
114 void
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
115 syms_of_gui_mswindows (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
116 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
117 }