annotate src/ExternalClient.c @ 5353:38e24b8be4ea

Improve the lexical scoping in #'block, #'return-from. lisp/ChangeLog addition: 2011-02-07 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el: * bytecomp.el (byte-compile-initial-macro-environment): Shadow `block', `return-from' here, we implement them differently when byte-compiling. * bytecomp.el (byte-compile-active-blocks): New. * bytecomp.el (byte-compile-block-1): New. * bytecomp.el (byte-compile-return-from-1): New. * bytecomp.el (return-from-1): New. * bytecomp.el (block-1): New. These are two aliases that exist to have their own associated byte-compile functions, which functions implement `block' and `return-from'. * cl-extra.el (cl-macroexpand-all): Fix a bug here when macros in the environment have been compiled. * cl-macs.el (block): * cl-macs.el (return): * cl-macs.el (return-from): Be more careful about lexical scope in these macros. * cl.el: * cl.el ('cl-block-wrapper): Removed. * cl.el ('cl-block-throw): Removed. These aren't needed in code generated by this XEmacs. They shouldn't be needed in code generated by XEmacs 21.4, but if it turns out the packages do need them, we can put them back. 2011-01-30 Mike Sperber <mike@xemacs.org> * font-lock.el (font-lock-fontify-pending-extents): Don't fail if `font-lock-mode' is unset, which can happen in the middle of `revert-buffer'. 2011-01-23 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (delete): * cl-macs.el (delq): * cl-macs.el (remove): * cl-macs.el (remq): Don't use the compiler macro if these functions were given the wrong number of arguments, as happens in lisp-tests.el. * cl-seq.el (remove, remq): Removed. I added these to subr.el, and forgot to remove them from here. 2011-01-22 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-setq, byte-compile-set): Remove kludge allowing keywords' values to be set, all the code that does that is gone. * cl-compat.el (elt-satisfies-test-p): * faces.el (set-face-parent): * faces.el (face-doc-string): * gtk-font-menu.el: * gtk-font-menu.el (gtk-reset-device-font-menus): * msw-font-menu.el: * msw-font-menu.el (mswindows-reset-device-font-menus): * package-get.el (package-get-installedp): * select.el (select-convert-from-image-data): * sound.el: * sound.el (load-sound-file): * x-font-menu.el (x-reset-device-font-menus-core): Don't quote keywords, they're self-quoting, and the win from backward-compatibility is sufficiently small now that the style problem overrides it. 2011-01-22 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (block, return-from): Require that NAME be a symbol in these macros, as always documented in the #'block docstring and as required by Common Lisp. * descr-text.el (unidata-initialize-unihan-database): Correct the use of non-symbols in #'block and #'return-from in this function. 2011-01-15 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (concatenate): Accept more complicated TYPEs in this function, handing the sequences over to #'coerce if we don't understand them here. * cl-macs.el (inline): Don't proclaim #'concatenate as inline, its compiler macro is more useful than doing that. 2011-01-11 Aidan Kehoe <kehoea@parhasard.net> * subr.el (delete, delq, remove, remq): Move #'remove, #'remq here, they don't belong in cl-seq.el; move #'delete, #'delq here from fns.c, implement them in terms of #'delete*, allowing support for sequences generally. * update-elc.el (do-autoload-commands): Use #'delete*, not #'delq here, now the latter's no longer dumped. * cl-macs.el (delete, delq): Add compiler macros transforming #'delete and #'delq to #'delete* calls. 2011-01-10 Aidan Kehoe <kehoea@parhasard.net> * dialog.el (make-dialog-box): Correct a misplaced parenthesis here, thank you Mats Lidell in 87zkr9gqrh.fsf@mail.contactor.se ! 2011-01-02 Aidan Kehoe <kehoea@parhasard.net> * dialog.el (make-dialog-box): * list-mode.el (display-completion-list): These functions used to use cl-parsing-keywords; change them to use defun* instead, fixing the build. (Not sure what led to me not including this change in d1b17a33450b!) 2011-01-02 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (define-star-compiler-macros): Make sure the form has ITEM and LIST specified before attempting to change to calls with explicit tests; necessary for some tests in lisp-tests.el to compile correctly. (stable-union, stable-intersection): Add compiler macros for these functions, in the same way we do for most of the other functions in cl-seq.el. 2011-01-01 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (dolist, dotimes, do-symbols, macrolet) (symbol-macrolet): Define these macros with defmacro* instead of parsing the argument list by hand, for the sake of style and readability; use backquote where appropriate, instead of calling #'list and and friends, for the same reason. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * x-misc.el (device-x-display): Provide this function, documented in the Lispref for years, but not existing previously. Thank you Julian Bradfield, thank you Jeff Mincy. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * cl-seq.el: Move the heavy lifting from this file to C. Dump the cl-parsing-keywords macro, but don't use defun* for the functions we define that do take keywords, dynamic scope lossage makes that not practical. * subr.el (sort, fillarray): Move these aliases here. (map-plist): #'nsublis is now built-in, but at this point #'eql isn't necessarily available as a test; use #'eq. * obsolete.el (cl-delete-duplicates): Make this available for old compiler macros and old code. (memql): Document that this is equivalent to #'member*, and worse. * cl.el (adjoin, subst): Removed. These are in C. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * simple.el (assoc-ignore-case): Remove a duplicate definition of this function (it's already in subr.el). * iso8859-1.el (char-width): On non-Mule, make this function equivalent to that produced by (constantly 1), but preserve its docstring. * subr.el (subst-char-in-string): Define this in terms of #'substitute, #'nsubstitute. (string-width): Define this using #'reduce and #'char-width. (char-width): Give this a simpler definition, it makes far more sense to check for mule at load time and redefine, as we do in iso8859-1.el. (store-substring): Implement this in terms of #'replace, now #'replace is cheap. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * update-elc.el (lisp-files-needed-for-byte-compilation) (lisp-files-needing-early-byte-compilation): cl-macs belongs in the former, not the latter, it is as fundamental as bytecomp.el. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * cl.el: Provde the Common Lisp program-error, type-error as error symbols. This doesn't nearly go far enough for anyone using the Common Lisp errors. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (delete-duplicates): If the form has an incorrect number of arguments, don't attempt a compiler macroexpansion. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (cl-safe-expr-p): Forms that start with the symbol lambda are also safe. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (= < > <= >=): For these functions' compiler macros, the optimisation is safe even if the first and the last arguments have side effects, since they're only used the once. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (inline-side-effect-free-compiler-macros): Unroll a loop here at macro-expansion time, so these compiler macros are compiled. Use #'eql instead of #'eq in a couple of places for better style. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (notany, notevery): Avoid some dynamic scope stupidity with local variable names in these functions, when they weren't prefixed with cl-; go into some more detail in the doc strings. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (side-effect-free-fns): #'remove, #'remq are free of side-effects. (side-effect-and-error-free-fns): Drop dot, dot-marker from the list. 2010-11-17 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (coerce): In the argument list, name the first argument OBJECT, not X; the former name was always used in the doc string and is clearer. Handle vector type specifications which include the length of the target sequence, error if there's a mismatch. * cl-macs.el (cl-make-type-test): Handle type specifications starting with the symbol 'eql. 2010-11-14 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (eql): Don't remove the byte-compile property of this symbol. That was necessary to override a bug in bytecomp.el where #'eql was confused with #'eq, which bug we no longer have. If neither expression is constant, don't attempt to handle the expression in this compiler macro, leave it to byte-compile-eql, which produces better code anyway. * bytecomp.el (eq): #'eql is not the function associated with the byte-eq byte code. (byte-compile-eql): Add an explicit compile method for this function, for cases where the cl-macs compiler macro hasn't reduced it to #'eq or #'equal. 2010-10-25 Aidan Kehoe <kehoea@parhasard.net> Add compiler macros and compilation sanity-checking for various functions that take keywords. * byte-optimize.el (side-effect-free-fns): #'symbol-value is side-effect free and not error free. * bytecomp.el (byte-compile-normal-call): Check keyword argument lists for sanity; store information about the positions where keyword arguments start using the new byte-compile-keyword-start property. * cl-macs.el (cl-const-expr-val): Take a new optional argument, cl-not-constant, defaulting to nil, in this function; return it if the expression is not constant. (cl-non-fixnum-number-p): Make this into a separate function, we want to pass it to #'every. (eql): Use it. (define-star-compiler-macros): Use the same code to generate the member*, assoc* and rassoc* compiler macros; special-case some code in #'add-to-list in subr.el. (remove, remq): Add compiler macros for these two functions, in preparation for #'remove being in C. (define-foo-if-compiler-macros): Transform (remove-if-not ...) calls to (remove ... :if-not) at compile time, which will be a real win once the latter is in C. (define-substitute-if-compiler-macros) (define-subst-if-compiler-macros): Similarly for these functions. (delete-duplicates): Change this compiler macro to use #'plists-equal; if we don't have information about the type of SEQUENCE at compile time, don't bother attempting to inline the call, the function will be in C soon enough. (equalp): Remove an old commented-out compiler macro for this, if we want to see it it's in version control. (subst-char-in-string): Transform this to a call to nsubstitute or nsubstitute, if that is appropriate. * cl.el (ldiff): Don't call setf here, this makes for a load-time dependency problem in cl-macs.el 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * term/vt100.el: Refer to XEmacs, not GNU Emacs, in permissions. * term/bg-mouse.el: * term/sup-mouse.el: Put copyright notice in canonical "Copyright DATE AUTHOR" form. Refer to XEmacs, not GNU Emacs, in permissions. * site-load.el: Add permission boilerplate. * mule/canna-leim.el: * alist.el: Refer to XEmacs, not APEL/this program, in permissions. * mule/canna-leim.el: Remove my copyright, I've assigned it to the FSF. 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * gtk.el: * gtk-widget-accessors.el: * gtk-package.el: * gtk-marshal.el: * gtk-compose.el: * gnome.el: Add copyright notice based on internal evidence. 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * easymenu.el: Add reference to COPYING to permission notice. * gutter.el: * gutter-items.el: * menubar-items.el: Fix typo "Xmacs" in permissions notice. 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * auto-save.el: * font.el: * fontconfig.el: * mule/kinsoku.el: Add "part of XEmacs" text to permission notice. 2010-10-14 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (side-effect-free-fns): * cl-macs.el (remf, getf): * cl-extra.el (tailp, cl-set-getf, cl-do-remf): * cl.el (ldiff, endp): Tighten up Common Lisp compatibility for #'ldiff, #'endp, #'tailp; add circularity checking for the first two. #'cl-set-getf and #'cl-do-remf were Lisp implementations of #'plist-put and #'plist-remprop; change the names to aliases, changes the macros that use them to using #'plist-put and #'plist-remprop directly. 2010-10-12 Aidan Kehoe <kehoea@parhasard.net> * abbrev.el (fundamental-mode-abbrev-table, global-abbrev-table): Create both these abbrev tables using the usual #'define-abbrev-table calls, rather than attempting to special-case them. * cl-extra.el: Force cl-macs to be loaded here, if cl-extra.el is being loaded interpreted. Previously other, later files would redundantly call (load "cl-macs") when interpreted, it's more reasonable to do it here, once. * cmdloop.el (read-quoted-char-radix): Use defcustom here, we don't have any dump-order dependencies that would prevent that. * custom.el (eval-when-compile): Don't load cl-macs when interpreted or when byte-compiling, rely on cl-extra.el in the former case and the appropriate entry in bytecomp-load-hook in the latter. Get rid of custom-declare-variable-list, we have no dump-time dependencies that would require it. * faces.el (eval-when-compile): Don't load cl-macs when interpreted or when byte-compiling. * packages.el: Remove some inaccurate comments. * post-gc.el (cleanup-simple-finalizers): Use #'delete-if-not here, now the order of preloaded-file-list has been changed to make it available. * subr.el (custom-declare-variable-list): Remove. No need for it. Also remove a stub define-abbrev-table from this file, given the current order of preloaded-file-list there's no need for it. 2010-10-10 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-constp) Forms quoted with FUNCTION are also constant. (byte-compile-initial-macro-environment): In #'the, if FORM is constant and does not match TYPE, warn at byte-compile time. 2010-10-10 Aidan Kehoe <kehoea@parhasard.net> * backquote.el (bq-vector-contents, bq-list*): Remove; the former is equivalent to (append VECTOR nil), the latter to (list* ...). (bq-process-2): Use (append VECTOR nil) instead of using #'bq-vector-contents to convert to a list. (bq-process-1): Now we use list* instead of bq-list * subr.el (list*): Moved from cl.el, since it is now required to be available the first time a backquoted form is encountered. * cl.el (list*): Move to subr.el. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * test-harness.el (Check-Message): Add an omitted comma here, thank you the buildbot. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * hash-table.el (hash-table-key-list, hash-table-value-list) (hash-table-key-value-alist, hash-table-key-value-plist): Remove some useless #'nreverse calls in these files; our hash tables have no order, it's not helpful to pretend they do. * behavior.el (read-behavior): Do the same in this file, in some code evidently copied from hash-table.el. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * info.el (Info-insert-dir): * format.el (format-deannotate-region): * files.el (cd, save-buffers-kill-emacs): Use #'some, #'every and related functions for applying boolean operations to lists, instead of rolling our own ones that cons and don't short-circuit. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-initial-macro-environment): * cl-macs.el (the): Rephrase the docstring, make its implementation when compiling files a little nicer. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * descr-text.el (unidata-initialize-unicodedata-database) (unidata-initialize-unihan-database, describe-char-unicode-data) (describe-char-unicode-data): Wrap calls to the database functions with (with-fboundp ...), avoiding byte compile warnings on builds without support for the database functions. (describe-char): (reduce #'max ...), not (apply #'max ...), no need to cons needlessly. (describe-char): Remove a redundant lambda wrapping #'extent-properties. (describe-char-unicode-data): Call #'nsubst when replacing "" with nil in the result of #'split-string, instead of consing inside mapcar. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * x-faces.el (x-available-font-sizes): * specifier.el (let-specifier): * package-ui.el (pui-add-required-packages): * msw-faces.el (mswindows-available-font-sizes): * modeline.el (modeline-minor-mode-menu): * minibuf.el (minibuf-directory-files): Replace the O2N (delq nil (mapcar (lambda (W) (and X Y)) Z)) with the ON (mapcan (lambda (W) (and X (list Y))) Z) in these files. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (= < > <= >=): When these functions are handed more than two arguments, and those arguments have no side effects, transform to a series of two argument calls, avoiding funcall in the byte-compiled code. * mule/mule-cmds.el (finish-set-language-environment): Take advantage of this change in a function called 256 times at startup. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-function-form, byte-compile-quote) (byte-compile-quote-form): Warn at compile time, and error at runtime, if a (quote ...) or a (function ...) form attempts to quote more than one object. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (byte-optimize-apply): Transform (apply 'nconc (mapcar ...)) to (mapcan ...); warn about use of the first idiom. * update-elc.el (do-autoload-commands): * packages.el (packages-find-package-library-path): * frame.el (frame-list): * extents.el (extent-descendants): * etags.el (buffer-tag-table-files): * dumped-lisp.el (preloaded-file-list): * device.el (device-list): * bytecomp-runtime.el (proclaim-inline, proclaim-notinline) Use #'mapcan, not (apply #'nconc (mapcar ...) in all these files. * bytecomp-runtime.el (eval-when-compile, eval-and-compile): In passing, mention that these macros also evaluate the body when interpreted. tests/ChangeLog addition: 2011-02-07 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Test lexical scope for `block', `return-from'; add a Known-Bug-Expect-Failure for a contorted example that fails when byte-compiled.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 07 Feb 2011 12:01:24 +0000
parents facf3239ba30
children 2aa9cd456ae7
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 /* External client widget.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994 Sun Microsystems, Inc.
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 library is free software; you can redistribute it and/or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 modify it under the terms of the GNU Library General Public
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 License as published by the Free Software Foundation; either
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 version 2 of the License, or (at your option) any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 This library is distributed in the hope that it will be useful,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 Library General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 You should have received a copy of the GNU Library General Public
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 License along with this library; if not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 /* Synched up with: Not in FSF. */
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 /* Written by Ben Wing, September 1993. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 #ifdef emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #ifndef EXTERNAL_WIDGET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ERROR! This ought not be getting compiled if EXTERNAL_WIDGET is undefined
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #endif /* emacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include <string.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include <stdlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 # include <Xm/XmP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 # include <Xm/PrimitiveP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 # include <X11/keysym.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 # include "xintrinsicp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 # include <X11/StringDefs.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
2299
a640f9c13696 [xemacs-hg @ 2004-09-22 03:04:35 by james]
james
parents: 2286
diff changeset
45 #include "compiler.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 #include "ExternalClientP.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 #include "extw-Xt.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 #ifdef TOOLTALK
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
50 #include TT_C_H_FILE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 /* This is the client widget, used to communicate with an ExternalShell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 widget. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 #define NOTIFY(w, type, l0, l1, l2) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 extw_send_notify_3(XtDisplay((Widget)(w)), XtWindow((Widget)(w)),\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 type, l0, l1, l2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
60 static void externalClientInitialize (Widget req, Widget new_, ArgList args,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 Cardinal *num_args);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 static void externalClientRealize (Widget widget, XtValueMask *mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 XSetWindowAttributes *attrs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 static void Destroy (Widget w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 static void EventHandler (Widget wid, XtPointer closure, XEvent *event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 Boolean *continue_to_dispatch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 static void MaskableEventHandler (Widget wid, XtPointer closure, XEvent *event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 Boolean *continue_to_dispatch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 static XtGeometryResult QueryGeometry(Widget, XtWidgetGeometry *,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 XtWidgetGeometry *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 static void ExternalClientFocusIn (Widget, XEvent *, String *, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 static void ExternalClientFocusOut (Widget, XEvent *, String *, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 static void ExternalClientEnter (Widget, XEvent *, String *, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 static void ExternalClientLeave (Widget, XEvent *, String *, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 static int my_error_handler(Display *display, XErrorEvent *xev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 static int (*error_old_handler)(Display *, XErrorEvent *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 static XtResource resources[] = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 #define offset(field) XtOffset(ExternalClientWidget, externalClient.field)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
81 { XtNshellTimeout, XtCShellTimeout,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
82 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
83 offset(shell_timeout), XtRImmediate,(XtPointer)DEFAULT_WM_TIMEOUT },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
84 { XtNdeadShell, XtCDeadShell,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
85 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
86 offset(dead_shell), XtRImmediate, (XtPointer)False },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 #ifdef EXTW_USES_MOTIF
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
88 { XmNnavigationType, XmCNavigationType,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
89 XmRNavigationType, sizeof (XmNavigationType),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
90 XtOffset (ExternalClientWidget, primitive.navigation_type),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
91 XtRImmediate, (XtPointer)XmTAB_GROUP },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
93 { XtNemacsProcID, XtCEmacsProcID,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
94 XtRString, sizeof (String),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
95 offset(emacs_procid), XtRImmediate, (XtPointer)NULL },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
96 { XtNshellReadyCallback, XtCCallback,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
97 XtRCallback, sizeof (XtCallbackList),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
98 offset(shell_ready_callback), XtRImmediate, (XtPointer)NULL },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
99 { XtNshellName, XtCShellName,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
100 XtRString, sizeof (String),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
101 offset(shell_name), XtRImmediate, (XtPointer)NULL },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
102 { XtNuseToolTalk, XtCUseToolTalk,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
103 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
104 offset(use_tooltalk), XtRImmediate, (XtPointer)False }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 static XtActionsRec actions[] = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 {"focusIn", ExternalClientFocusIn},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 {"focusOut", ExternalClientFocusOut},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 {"enter", ExternalClientEnter},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 {"leave", ExternalClientLeave},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 ExternalClientClassRec externalClientClassRec = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 { /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 * core_class fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 /* superclass */ (WidgetClass) &xmPrimitiveClassRec,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 /* superclass */ (WidgetClass) &coreClassRec,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 /* class_name */ "ExternalClient",
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
124 /* size */ sizeof (ExternalClientRec),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 /* Class Initializer */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 /* class_part_initialize*/ NULL, /* XtInheritClassPartInitialize, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 /* Class init'ed ? */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 /* initialize */ externalClientInitialize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 /* initialize_notify */ NULL,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
130 /* realize */ externalClientRealize,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 /* actions */ actions,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 /* num_actions */ XtNumber (actions),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 /* resources */ resources,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 /* resource_count */ XtNumber (resources),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 /* xrm_class */ NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 /* compress_motion */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 /* compress_exposure */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 /* compress_enterleave*/ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 /* visible_interest */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 /* destroy */ Destroy, /* XtInheritDestroy, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 /* resize */ XtInheritResize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 /* expose */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 /* set_values */ NULL, /* XtInheritSetValues, */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
144 /* set_values_hook */ NULL,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
145 /* set_values_almost */ XtInheritSetValuesAlmost,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
146 /* get_values_hook */ NULL,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 /* accept_focus */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 /* intrinsics version */ XtVersion,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 /* callback offsets */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 /* tm_table */ "", /* MUST NOT BE NULL or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 XtInheritTranslations in Motif!!!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 Otherwise keyboard focus translations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 will not work. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 /* query_geometry */ QueryGeometry,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 /* display_accelerator*/ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 XmInheritBorderHighlight,/* Primitive border_highlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 XmInheritBorderHighlight,/* Primitive border_unhighlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 XtInheritTranslations, /* translations */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 NULL, /* arm_and_activate */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 NULL, /* get resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 0, /* num get_resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 NULL, /* extension */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 WidgetClass externalClientWidgetClass = (WidgetClass) &externalClientClassRec;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 static void
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
177 externalClientInitialize (Widget UNUSED (req), Widget new_,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
178 ArgList UNUSED (args), Cardinal *UNUSED (num_args))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 {
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
180 ExternalClientWidget ecw = (ExternalClientWidget) new_;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 static int error_handler_added = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
183 extw_initialize_atoms (XtDisplay (new_));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 extw_which_side = extw_client_send;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 /* yes I know this is horrible. However, the XmPrimitive class adds
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 the Tab translation in its initialization routine, so we have to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 override it here. This is all the fault of Xt, which doesn't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 provide a proper inheritance mechanism for translations.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 -- BPW
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
196
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
197 XtOverrideTranslations (new_,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 XtParseTranslationTable ("None<Key>Tab:\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 "<FocusIn>:focusIn()\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 "<FocusOut>:focusOut()\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 "<Enter>:enter()\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 "<Leave>:leave()\n"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
205
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
206 XtAddEventHandler (new_, 0, TRUE, EventHandler, (XtPointer) NULL);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 ecw->externalClient.shell_ready = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 ecw->externalClient.has_focus = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 if (!error_handler_added)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 error_handler_added = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 error_old_handler = XSetErrorHandler (my_error_handler);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 #ifdef TOOLTALK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 static Tt_callback_action
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
221 tt_callback(Tt_message m, Tt_pattern UNUSED (p))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 ExternalClientWidget ecw = (ExternalClientWidget)tt_message_user (m, 0);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
224
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 switch (tt_message_state(m))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 case TT_FAILED:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 /* handle errors here */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 case TT_HANDLED:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 ecw->externalClient.shell_name = tt_message_arg_val (m, 2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 XtCallCallbackList ((Widget) ecw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 ecw->externalClient.shell_ready_callback, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
236
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 tt_message_destroy (m);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 return TT_CALLBACK_PROCESSED;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 send_tooltalk_handshake (ExternalClientWidget ecw, Window win, char *name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 Tt_message m = tt_message_create ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 tt_message_op_set (m, "emacs-make-client-screen");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 tt_message_scope_set (m, TT_SESSION);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 tt_message_class_set (m, TT_REQUEST);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 tt_message_arg_add (m, TT_IN, "string", name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 tt_message_iarg_add (m, TT_IN, "int", win);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
251 tt_message_arg_add (m, TT_OUT, "string", NULL);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 tt_message_user_set (m, 0, (void *)ecw);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 tt_message_callback_add (m, tt_callback);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 if (ecw->externalClient.emacs_procid)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 tt_message_address_set (m, TT_HANDLER);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 tt_message_handler_set (m, ecw->externalClient.emacs_procid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 tt_message_address_set (m, TT_PROCEDURE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 tt_message_send (m);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 externalClientRealize (Widget w, XtValueMask *vm, XSetWindowAttributes *attrs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 {
1094
4f4c898836ab [xemacs-hg @ 2002-11-11 15:34:11 by stephent]
stephent
parents: 442
diff changeset
270 #ifdef TOOLTALK
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 ExternalClientWidget ecw = (ExternalClientWidget)w;
1094
4f4c898836ab [xemacs-hg @ 2002-11-11 15:34:11 by stephent]
stephent
parents: 442
diff changeset
272 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
273
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
274 #ifdef EXTW_USES_MOTIF
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 (*xmPrimitiveWidgetClass->core_class.realize) (w, vm, attrs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 (*coreWidgetClass->core_class.realize) (w, vm, attrs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 #ifdef TOOLTALK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 /* Make sure that the server actually knows about this window id before
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 * telling Emacs about it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 if (ecw->externalClient.use_tooltalk)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 XSync (XtDisplay (w), False);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 send_tooltalk_handshake (ecw, XtWindow (w), XtName (w));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
289 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 /***********************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 /* window-to-widget list. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 struct ww_list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 Window win;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 Widget wid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 struct ww_list *next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 struct ww_list ww_list[1];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 add_ww (Window win, Widget wid)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 struct ww_list *ww = (struct ww_list *) malloc (sizeof (struct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 ww_list));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 if (!ww)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 ww->win = win;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 ww->wid = wid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 ww->next = ww_list->next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 ww_list->next = ww;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 static Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 remove_ww (Window win)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 struct ww_list *w1, *w2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 Widget wid = 0;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
325
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 for (w1=ww_list, w2=w1->next; w2; w1=w2, w2=w2->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 if (w2->win == win)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 w1->next = w2->next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 wid = w2->wid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 free (w2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 return wid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 /***********************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 /* stolen outright from Intrinsic.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
341 static void
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
342 ComputeWindowAttributes (Widget widget, XtValueMask *value_mask,
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
343 XSetWindowAttributes *values)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 *value_mask = CWEventMask | CWColormap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 (*values).event_mask = XtBuildEventMask(widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 (*values).colormap = widget->core.colormap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 if (widget->core.background_pixmap != XtUnspecifiedPixmap) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 *value_mask |= CWBackPixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 (*values).background_pixmap = widget->core.background_pixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 } else {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 *value_mask |= CWBackPixel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 (*values).background_pixel = widget->core.background_pixel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 if (widget->core.border_pixmap != XtUnspecifiedPixmap) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 *value_mask |= CWBorderPixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 (*values).border_pixmap = widget->core.border_pixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 } else {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 *value_mask |= CWBorderPixel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 (*values).border_pixel = widget->core.border_pixel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 if (widget->core.widget_class->core_class.expose == (XtExposeProc) NULL) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 /* Try to avoid redisplay upon resize by making bit_gravity the same
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 as the default win_gravity */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 *value_mask |= CWBitGravity;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 (*values).bit_gravity = NorthWestGravity;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 } /* ComputeWindowAttributes */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 end_connection (ExternalClientWidget w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 XSetWindowAttributes xswa;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 XtValueMask mask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 Widget wid = (Widget) w;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
376
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 w->externalClient.shell_ready = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 XtRemoveEventHandler (wid, w->externalClient.event_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 FALSE, MaskableEventHandler, (XtPointer) NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 ComputeWindowAttributes (wid, &mask, &xswa);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 XChangeWindowAttributes (XtDisplay (wid), XtWindow (wid), mask, &xswa);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 XClearArea (XtDisplay (wid), XtWindow (wid), 0, 0, 0, 0, True);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 my_error_handler (Display *display, XErrorEvent *xev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 Widget wid;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
389
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 if (xev->error_code != BadWindow)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 goto call_old;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 wid = remove_ww (xev->resourceid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 if (wid)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 end_connection ((ExternalClientWidget) wid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
398
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 call_old:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 return error_old_handler (display, xev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
404 MaskableEventHandler (Widget wid, XtPointer UNUSED (closure), XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
405 Boolean *UNUSED (continue_to_dispatch))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 ExternalClientWidget w = (ExternalClientWidget) wid;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
408
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 if (w->externalClient.shell_ready)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 if (event->type == KeyPress || event->type == KeyRelease ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 event->type == ButtonPress || event->type == ButtonRelease ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 event->type == MotionNotify)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 event->xkey.subwindow = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 /* hackkkkkkkkkkkkkk! Suppress CTRL-TAB, SHIFT-TAB, etc. so that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 Emacs doesn't attempt to interpret focus-change keystrokes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 if (event->type == KeyPress &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 XLookupKeysym ((XKeyEvent *) event, 0) == XK_Tab &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 (event->xkey.state & ControlMask ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 event->xkey.state & ShiftMask))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 event->xany.window = w->core.window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 XSendEvent (XtDisplay (wid), w->externalClient.event_window, FALSE, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 XSync (XtDisplay (wid), 0); /* make sure that any BadWindow errors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 (meaning the server died) get handled
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 before XSendEvent is called again. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
430
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
435 EventHandler (Widget wid, XtPointer UNUSED (closure), XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
436 Boolean *UNUSED (continue_to_dispatch))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 ExternalClientWidget w = (ExternalClientWidget) wid;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
439
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 if (w->core.window != event->xany.window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 XtAppErrorMsg (XtWidgetToApplicationContext (wid),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 "invalidWindow","eventHandler",XtCXtToolkitError,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 "Event with wrong window",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 (String *)NULL, (Cardinal *)NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
448
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 if (event->type == ClientMessage &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 event->xclient.message_type == a_EXTW_NOTIFY &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 event->xclient.data.l[0] == extw_shell_send)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 switch (event->xclient.data.l[1])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
454
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 case extw_notify_qg:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 /* shell is alive again. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
457
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 w->externalClient.dead_shell = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 break;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
460
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 case extw_notify_gm:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 XtWidgetGeometry xwg, xwg_return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 XtGeometryResult result;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
465
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 extw_get_geometry_value (XtDisplay (wid), XtWindow (wid),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 a_EXTW_GEOMETRY_MANAGER, &xwg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 result = XtMakeGeometryRequest (wid, &xwg, &xwg_return);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
469
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 extw_send_geometry_value (XtDisplay (wid), XtWindow (wid),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 a_EXTW_GEOMETRY_MANAGER, extw_notify_gm,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 result == XtGeometryAlmost ? &xwg_return :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 NULL, result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
476
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 case extw_notify_init:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 w->externalClient.shell_ready = True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 w->externalClient.event_window = event->xclient.data.l[2];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 w->externalClient.event_mask = event->xclient.data.l[3];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 add_ww (w->externalClient.event_window, (Widget) w);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
482
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 XtAddEventHandler (wid, w->externalClient.event_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 FALSE, MaskableEventHandler, (XtPointer) NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 NOTIFY (w, extw_notify_init,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 EXTW_TYPE_MOTIF,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 NOTIFY (w, extw_notify_init,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 EXTW_TYPE_XT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 break;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
495
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 case extw_notify_end:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 end_connection (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 remove_ww (w->externalClient.event_window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 break;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
500
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 case extw_notify_set_focus:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 XmProcessTraversal (wid, XmTRAVERSE_CURRENT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 XtSetKeyboardFocus (wid, None);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 break;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
508
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
512 static void Destroy (Widget wid)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 ExternalClientWidget w = (ExternalClientWidget)wid;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
515
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 NOTIFY(w, extw_notify_end, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
519 static XtGeometryResult
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
520 QueryGeometry (Widget gw, XtWidgetGeometry *request, XtWidgetGeometry *reply)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 {
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
522 ExternalClientWidget w = (ExternalClientWidget) gw;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 XEvent event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 unsigned long request_num;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 Display *display = XtDisplay(gw);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 XtWidgetGeometry req = *request; /* don't modify caller's structure */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
527
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 if (!XtIsRealized((Widget)w) || !w->externalClient.shell_ready)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 return XtGeometryYes;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
530
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 if (w->externalClient.dead_shell == TRUE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 /* The shell is sick. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 return XtGeometryNo;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
534
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 req.sibling = None;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 req.request_mode &= ~CWSibling;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 request_num = NextRequest(display);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 extw_send_geometry_value(XtDisplay(gw), XtWindow(gw), a_EXTW_QUERY_GEOMETRY,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 extw_notify_qg, &req, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 if (extw_wait_for_response(gw, &event, request_num, extw_notify_qg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 w->externalClient.shell_timeout)) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 XtGeometryResult result = (XtGeometryResult) event.xclient.data.l[0];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 if (result == XtGeometryAlmost) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 extw_get_geometry_value(XtDisplay(gw), XtWindow(gw),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 a_EXTW_QUERY_GEOMETRY, reply);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 return result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 } else {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 w->externalClient.dead_shell = TRUE; /* timed out; must be broken */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 return XtGeometryNo;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
556 #ifdef EXTW_USES_MOTIF
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
557 # define USED_IF_MOTIF(decl) decl
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
558 #else
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
559 # define USED_IF_MOTIF(decl) UNUSED (decl)
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
560 #endif
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
561
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
562 static void ExternalClientFocusIn (Widget w, XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
563 String *USED_IF_MOTIF (params),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
564 Cardinal *USED_IF_MOTIF (num_params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 ExternalClientWidget ecw = (ExternalClientWidget) w;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
567
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 if (event->xfocus.send_event && !ecw->externalClient.has_focus) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 ecw->externalClient.has_focus = True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 NOTIFY(ecw, extw_notify_focus_in, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 _XmPrimitiveFocusIn (w, event, params, num_params);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
577 static void ExternalClientFocusOut (Widget w, XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
578 String *USED_IF_MOTIF (params),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
579 Cardinal *USED_IF_MOTIF (num_params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 ExternalClientWidget ecw = (ExternalClientWidget) w;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
582
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 if (event->xfocus.send_event && ecw->externalClient.has_focus) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 ecw->externalClient.has_focus = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 NOTIFY(ecw, extw_notify_focus_out, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 _XmPrimitiveFocusOut(w, event, params, num_params);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
592 static void ExternalClientEnter (Widget w, XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
593 String *USED_IF_MOTIF (params),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
594 Cardinal *USED_IF_MOTIF (num_params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 ExternalClientWidget ecw = (ExternalClientWidget) w;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
597
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 if (
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 _XmGetFocusPolicy (w) != XmEXPLICIT &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 !ecw->externalClient.has_focus &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 event->xcrossing.focus && event->xcrossing.detail != NotifyInferior) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 ecw->externalClient.has_focus = True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 NOTIFY(ecw, extw_notify_focus_in, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 _XmPrimitiveEnter (w, event, params, num_params);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
612 static void ExternalClientLeave (Widget w, XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
613 String *USED_IF_MOTIF (params),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
614 Cardinal *USED_IF_MOTIF (num_params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 ExternalClientWidget ecw = (ExternalClientWidget) w;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
617
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 if (
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 _XmGetFocusPolicy (w) != XmEXPLICIT &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 ecw->externalClient.has_focus &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 event->xcrossing.focus && event->xcrossing.detail != NotifyInferior) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 ecw->externalClient.has_focus = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 NOTIFY(ecw, extw_notify_focus_out, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 _XmPrimitiveLeave (w, event, params, num_params);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 }