comparison src/frame-x.c @ 2367:ecf1ebac70d8

[xemacs-hg @ 2004-11-04 23:05:23 by ben] commit mega-patch configure.in: Turn off -Winline and -Wchar-subscripts. Use the right set of cflags when compiling modules. Rewrite ldap configuration to separate the inclusion of lber (needed in recent Cygwin) from the basic checks for the needed libraries. add a function for MAKE_JUNK_C; initially code was added to generate xemacs.def using this, but it will need to be rewritten. add an rm -f for junk.c to avoid weird Cygwin bug with cp -f onto an existing file. Sort list of auto-detected functions and eliminate unused checks for stpcpy, setlocale and getwd. Add autodetection of Cygwin scanf problems BETA: Rewrite section on configure to indicate what flags are important and what not. digest-doc.c, make-dump-id.c, profile.c, sorted-doc.c: Add proper decls for main(). make-msgfile.c: Document that this is old junk. Move proposal to text.c. make-msgfile.lex: Move proposal to text.c. make-mswin-unicode.pl: Convert error-generating code so that the entire message will be seen as a single unrecognized token. mule/mule-ccl.el: Update docs. lispref/mule.texi: Update CCL docs. ldap/eldap.c: Mule-ize. Use EXTERNAL_LIST_LOOP_2 instead of deleted EXTERNAL_LIST_LOOP. * XEmacs 21.5.18 "chestnut" is released. --------------------------------------------------------------- MULE-RELATED WORK: --------------------------------------------------------------- --------------------------- byte-char conversion --------------------------- buffer.c, buffer.h, insdel.c, text.c: Port FSF algorithm for byte-char conversion, replacing broken previous version. Track the char position of the gap. Add functions to do char-byte conversion downwards as well as upwards. Move comments about algorithm workings to internals manual. --------------------------- work on types --------------------------- alloc.c, console-x-impl.h, dump-data.c, dump-data.h, dumper.c, dialog-msw.c, dired-msw.c, doc.c, editfns.c, esd.c, event-gtk.h, event-msw.c, events.c, file-coding.c, file-coding.h, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-x.c, glyphs.c, glyphs.h, gui.c, hpplay.c, imgproc.c, intl-win32.c, lrecord.h, lstream.c, keymap.c, lisp.h, libsst.c, linuxplay.c, miscplay.c, miscplay.h, mule-coding.c, nas.c, nt.c, ntheap.c, ntplay.c, objects-msw.c, objects-tty.c, objects-x.c, print.c, process-nt.c, process.c, redisplay.h, select-common.h, select-gtk.c, select-x.c, sgiplay.c, sound.c, sound.h, sunplay.c, sysfile.h, sysdep.c, syswindows.h, text.c, unexnt.c, win32.c, xgccache.c: Further work on types. This creates a full set of types for all the basic semantics of `char' that I have so far identified, so that its semantics can always be identified for the purposes of proper Mule-safe code, and the raw use of `char' always avoided. (1) More type renaming, for consistency of naming. Char_ASCII -> Ascbyte UChar_ASCII -> UAscbyte Char_Binary -> CBinbyte UChar_Binary -> Binbyte SChar_Binary -> SBinbyte (2) Introduce Rawbyte, CRawbyte, Boolbyte, Chbyte, UChbyte, and Bitbyte and use them. (3) New types Itext, Wexttext and Textcount for separating out the concepts of bytes and textual units (different under UTF-16 and UTF-32, which are potential internal encodings). (4) qxestr*_c -> qxestr*_ascii. lisp.h: New; goes with other qxe() functions. #### Maybe goes in a different section. lisp.h: Group generic int-type defs together with EMACS_INT defs. lisp.h: * lisp.h (WEXTTEXT_IS_WIDE) New defns. lisp.h: New type to replace places where int occurs as a boolean. It's signed because occasionally people may want to use -1 as an error value, and because unsigned ints are viral -- see comments in the internals manual against using them. dynarr.c: int -> Bytecount. --------------------------- Mule-izing --------------------------- device-x.c: Partially Mule-ize. dumper.c, dumper.h: Mule-ize. Use Rawbyte. Use stderr_out not printf. Use wext_*(). sysdep.c, syswindows.h, text.c: New Wexttext API for manipulation of external text that may be Unicode (e.g. startup code under Windows). emacs.c: Mule-ize. Properly deal with argv in external encoding. Use wext_*() and Wexttext. Use Rawbyte. #if 0 some old junk on SCO that is unlikely to be correct. Rewrite allocation code in run-temacs. emacs.c, symsinit.h, win32.c: Rename win32 init function and call it even earlier, to initialize mswindows_9x_p even earlier, for use in startup code (XEUNICODE_P). process.c: Use _wenviron not environ under Windows, to get Unicode environment variables. event-Xt.c: Mule-ize drag-n-drop related stuff. dragdrop.c, dragdrop.h, frame-x.c: Mule-ize. text.h: Add some more stand-in defines for particular kinds of conversion; use in Mule-ization work in frame-x.c etc. --------------------------- Freshening --------------------------- intl-auto-encap-win32.c, intl-auto-encap-win32.h: Regenerate. --------------------------- Unicode-work --------------------------- intl-win32.c, syswindows.h: Factor out common options to MultiByteToWideChar and WideCharToMultiByte. Add convert_unicode_to_multibyte_malloc() and convert_unicode_to_multibyte_dynarr() and use. Add stuff for alloca() conversion of multibyte/unicode. alloc.c: Use dfc_external_data_len() in case of unicode coding system. alloc.c, mule-charset.c: Don't zero out and reinit charset Unicode tables. This fucks up dump-time loading. Anyway, either we load them at dump time or run time, never both. unicode.c: Dump the blank tables as well. --------------------------------------------------------------- DOCUMENTATION, MOSTLY MULE-RELATED: --------------------------------------------------------------- EmacsFrame.c, emodules.c, event-Xt.c, fileio.c, input-method-xlib.c, mule-wnnfns.c, redisplay-gtk.c, redisplay-tty.c, redisplay-x.c, regex.c, sysdep.c: Add comment about Mule work needed. text.h: Add more documentation describing why DFC routines were not written to return their value. Add some other DFC documentation. console-msw.c, console-msw.h: Add pointer to docs in win32.c. emacs.c: Add comments on sources of doc info. text.c, charset.h, unicode.c, intl-win32.c, intl-encap-win32.c, text.h, file-coding.c, mule-coding.c: Collect background comments and related to text matters and internationalization, and proposals for work to be done, in text.c or Internals manual, stuff related to specific textual API's in text.h, and stuff related to internal implementation of Unicode conversion in unicode.c. Put lots of pointers to the comments to make them easier to find. s/mingw32.h, s/win32-common.h, s/win32-native.h, s/windowsnt.h, win32.c: Add bunches of new documentation on the different kinds of builds and environments under Windows and how they work. Collect this info in win32.c. Add pointers to these docs in the relevant s/* files. emacs.c: Document places with long comments. Remove comment about exiting, move to internals manual, put in pointer. event-stream.c: Move docs about event queues and focus to internals manual, put in pointer. events.h: Move docs about event stream callbacks to internals manual, put in pointer. profile.c, redisplay.c, signal.c: Move documentation to the Internals manual. process-nt.c: Add pointer to comment in win32-native.el. lisp.h: Add comments about some comment conventions. lisp.h: Add comment about the second argument. device-msw.c, redisplay-msw.c: @@#### comments are out-of-date. --------------------------------------------------------------- PDUMP WORK (MOTIVATED BY UNICODE CHANGES) --------------------------------------------------------------- alloc.c, buffer.c, bytecode.c, console-impl.h, console.c, device.c, dumper.c, lrecord.h, elhash.c, emodules.h, events.c, extents.c, frame.c, glyphs.c, glyphs.h, mule-charset.c, mule-coding.c, objects.c, profile.c, rangetab.c, redisplay.c, specifier.c, specifier.h, window.c, lstream.c, file-coding.h, file-coding.c: PDUMP: Properly implement dump_add_root_block(), which never worked before, and is necessary for dumping Unicode tables. Pdump name changes for accuracy: XD_STRUCT_PTR -> XD_BLOCK_PTR. XD_STRUCT_ARRAY -> XD_BLOCK_ARRAY. XD_C_STRING -> XD_ASCII_STRING. *_structure_* -> *_block_*. lrecord.h: some comments added about dump_add_root_block() vs dump_add_root_block_ptr(). extents.c: remove incorrect comment about pdump problems with gap array. --------------------------------------------------------------- ALLOCATION --------------------------------------------------------------- abbrev.c, alloc.c, bytecode.c, casefiddle.c, device-msw.c, device-x.c, dired-msw.c, doc.c, doprnt.c, dragdrop.c, editfns.c, emodules.c, file-coding.c, fileio.c, filelock.c, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, gui-msw.c, gui-x.c, imgproc.c, intl-win32.c, lread.c, menubar-gtk.c, menubar.c, nt.c, objects-msw.c, objects-x.c, print.c, process-nt.c, process-unix.c, process.c, realpath.c, redisplay.c, search.c, select-common.c, symbols.c, sysdep.c, syswindows.h, text.c, text.h, ui-byhand.c: New macros {alloca,xnew}_{itext,{i,ext,raw,bin,asc}bytes} for more convenient allocation of these commonly requested items. Modify functions to use alloca_ibytes, alloca_array, alloca_extbytes, xnew_ibytes, etc. also XREALLOC_ARRAY, xnew. alloc.c: Rewrite the allocation functions to factor out repeated code. Add assertions for freeing dumped data. lisp.h: Moved down and consolidated with other allocation stuff. lisp.h, dynarr.c: New functions for allocation that's very efficient when mostly in LIFO order. lisp.h, text.c, text.h: Factor out some stuff for general use by alloca()-conversion funs. text.h, lisp.h: Fill out convenience routines for allocating various kinds of bytes and put them in lisp.h. Use them in place of xmalloc(), ALLOCA(). text.h: Fill out the convenience functions so the _MALLOC() kinds match the alloca() kinds. --------------------------------------------------------------- ERROR-CHECKING --------------------------------------------------------------- text.h: Create ASSERT_ASCTEXT_ASCII() and ASSERT_ASCTEXT_ASCII_LEN() from similar Eistring checkers and change the Eistring checkers to use them instead. --------------------------------------------------------------- MACROS IN LISP.H --------------------------------------------------------------- lisp.h: Redo GCPRO declarations. Create a "base" set of functions that can be used to generate any kind of gcpro sets -- regular, ngcpro, nngcpro, private ones used in GC_EXTERNAL_LIST_LOOP_2. buffer.c, callint.c, chartab.c, console-msw.c, device-x.c, dialog-msw.c, dired.c, extents.c, ui-gtk.c, rangetab.c, nt.c, mule-coding.c, minibuf.c, menubar-msw.c, menubar.c, menubar-gtk.c, lread.c, lisp.h, gutter.c, glyphs.c, glyphs-widget.c, fns.c, fileio.c, file-coding.c, specifier.c: Eliminate EXTERNAL_LIST_LOOP, which does not check for circularities. Use EXTERNAL_LIST_LOOP_2 instead or EXTERNAL_LIST_LOOP_3 or EXTERNAL_PROPERTY_LIST_LOOP_3 or GC_EXTERNAL_LIST_LOOP_2 (new macro). Removed/redid comments on EXTERNAL_LIST_LOOP. --------------------------------------------------------------- SPACING FIXES --------------------------------------------------------------- callint.c, hftctl.c, number-gmp.c, process-unix.c: Spacing fixes. --------------------------------------------------------------- FIX FOR GEOMETRY PROBLEM IN FIRST FRAME --------------------------------------------------------------- unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by release 1.5.12 of Cygwin]. toolbar.c: bug fix for problem of initial frame being 77 chars wide on Windows. will be overridden by my other ws. --------------------------------------------------------------- FIX FOR LEAKING PROCESS HANDLES: --------------------------------------------------------------- process-nt.c: Fixes for leaking handles. Inspired by work done by Adrian Aichner <adrian@xemacs.org>. --------------------------------------------------------------- FIX FOR CYGWIN BUG (Unicode-related): --------------------------------------------------------------- unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by release 1.5.12 of Cygwin]. --------------------------------------------------------------- WARNING FIXES: --------------------------------------------------------------- console-stream.c: `reinit' is unused. compiler.h, event-msw.c, frame-msw.c, intl-encap-win32.c, text.h: Add stuff to deal with ANSI-aliasing warnings I got. regex.c: Gather includes together to avoid warning. --------------------------------------------------------------- CHANGES TO INITIALIZATION ROUTINES: --------------------------------------------------------------- buffer.c, emacs.c, console.c, debug.c, device-x.c, device.c, dragdrop.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, font-lock.c, frame-msw.c, glyphs-widget.c, glyphs.c, gui-x.c, insdel.c, lread.c, lstream.c, menubar-gtk.c, menubar-x.c, minibuf.c, mule-wnnfns.c, objects-msw.c, objects.c, print.c, scrollbar-x.c, search.c, select-x.c, text.c, undo.c, unicode.c, window.c, symsinit.h: Call reinit_*() functions directly from emacs.c, for clarity. Factor out some redundant init code. Move disallowed stuff that had crept into vars_of_glyphs() into complex_vars_of_glyphs(). Call init_eval_semi_early() from eval.c not in the middle of vars_of_() in emacs.c since there should be no order dependency in the latter calls. --------------------------------------------------------------- ARMAGEDDON: --------------------------------------------------------------- alloc.c, emacs.c, lisp.h, print.c: Rename inhibit_non_essential_printing_operations to inhibit_non_essential_conversion_operations. text.c: Assert on !inhibit_non_essential_conversion_operations. console-msw.c, print.c: Don't do conversion in SetConsoleTitle or FindWindow to avoid problems during armageddon. Put #errors for NON_ASCII_INTERNAL_FORMAT in places where problems would arise. --------------------------------------------------------------- CHANGES TO THE BUILD PROCEDURE: --------------------------------------------------------------- config.h.in, s/cxux.h, s/usg5-4-2.h, m/powerpc.h: Add comment about correct ordering of this file. Rearrange everything to follow this -- put all #undefs together and before the s&m files. Add undefs for HAVE_ALLOCA, C_ALLOCA, BROKEN_ALLOCA_IN_FUNCTION_CALLS, STACK_DIRECTION. Remove unused HAVE_STPCPY, HAVE_GETWD, HAVE_SETLOCALE. m/gec63.h: Deleted; totally broken, not used at all, not in FSF. m/7300.h, m/acorn.h, m/alliant-2800.h, m/alliant.h, m/altos.h, m/amdahl.h, m/apollo.h, m/att3b.h, m/aviion.h, m/celerity.h, m/clipper.h, m/cnvrgnt.h, m/convex.h, m/cydra5.h, m/delta.h, m/delta88k.h, m/dpx2.h, m/elxsi.h, m/ews4800r.h, m/gould.h, m/hp300bsd.h, m/hp800.h, m/hp9000s300.h, m/i860.h, m/ibmps2-aix.h, m/ibmrs6000.h, m/ibmrt-aix.h, m/ibmrt.h, m/intel386.h, m/iris4d.h, m/iris5d.h, m/iris6d.h, m/irist.h, m/isi-ov.h, m/luna88k.h, m/m68k.h, m/masscomp.h, m/mg1.h, m/mips-nec.h, m/mips-siemens.h, m/mips.h, m/news.h, m/nh3000.h, m/nh4000.h, m/ns32000.h, m/orion105.h, m/pfa50.h, m/plexus.h, m/pmax.h, m/powerpc.h, m/pyrmips.h, m/sequent-ptx.h, m/sequent.h, m/sgi-challenge.h, m/symmetry.h, m/tad68k.h, m/tahoe.h, m/targon31.h, m/tekxd88.h, m/template.h, m/tower32.h, m/tower32v3.h, m/ustation.h, m/vax.h, m/wicat.h, m/xps100.h: Delete C_ALLOCA, HAVE_ALLOCA, STACK_DIRECTION, BROKEN_ALLOCA_IN_FUNCTION_CALLS. All of this is auto-detected. When in doubt, I followed recent FSF sources, which also have these things deleted.
author ben
date Thu, 04 Nov 2004 23:08:28 +0000
parents 04bc9d2f42c7
children 79c79ee56386
comparison
equal deleted inserted replaced
2366:2a392e0c390a 2367:ecf1ebac70d8
1 /* Functions for the X window system. 1 /* Functions for the X window system.
2 Copyright (C) 1989, 1992-5, 1997 Free Software Foundation, Inc. 2 Copyright (C) 1989, 1992-5, 1997 Free Software Foundation, Inc.
3 Copyright (C) 1995, 1996, 2001, 2002 Ben Wing. 3 Copyright (C) 1995, 1996, 2001, 2002, 2004 Ben Wing.
4 4
5 This file is part of XEmacs. 5 This file is part of XEmacs.
6 6
7 XEmacs is free software; you can redistribute it and/or modify it 7 XEmacs is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the 8 under the terms of the GNU General Public License as published by the
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */ 20 Boston, MA 02111-1307, USA. */
21 21
22 /* Synched up with: Not synched with FSF. */ 22 /* Synched up with: Not synched with FSF. */
23 23
24 /* This file has been Mule-ized, Ben Wing, 10-14-04. */
25
24 /* Substantially rewritten for XEmacs. */ 26 /* Substantially rewritten for XEmacs. */
25
26 /* 7-8-00 !!#### This file needs definite Mule review. */
27 27
28 #include <config.h> 28 #include <config.h>
29 #include "lisp.h" 29 #include "lisp.h"
30 30
31 #include "buffer.h" 31 #include "buffer.h"
269 if (!XtIsWMShell (wmshell)) 269 if (!XtIsWMShell (wmshell))
270 abort (); 270 abort ();
271 if (cw <= 0 || ch <= 0) 271 if (cw <= 0 || ch <= 0)
272 abort (); 272 abort ();
273 273
274 XtSetArg (al [0], XtNwidthInc, cw); 274 XtSetArg (al[0], XtNwidthInc, cw);
275 XtSetArg (al [1], XtNheightInc, ch); 275 XtSetArg (al[1], XtNheightInc, ch);
276 XtSetValues (wmshell, al, 2); 276 XtSetValues (wmshell, al, 2);
277 } 277 }
278 278
279 void 279 void
280 x_wm_set_variable_size (Widget wmshell, int width, int height) 280 x_wm_set_variable_size (Widget wmshell, int width, int height)
287 /* See comment in EmacsShell.c */ 287 /* See comment in EmacsShell.c */
288 printf ("x_wm_set_variable_size: %d %d\n", width, height); 288 printf ("x_wm_set_variable_size: %d %d\n", width, height);
289 fflush (stdout); 289 fflush (stdout);
290 #endif 290 #endif
291 291
292 XtSetArg (al [0], XtNwidthCells, width); 292 XtSetArg (al[0], XtNwidthCells, width);
293 XtSetArg (al [1], XtNheightCells, height); 293 XtSetArg (al[1], XtNheightCells, height);
294 XtSetValues (wmshell, al, 2); 294 XtSetValues (wmshell, al, 2);
295 } 295 }
296 296
297 /* If the WM_PROTOCOLS property does not already contain WM_TAKE_FOCUS 297 /* If the WM_PROTOCOLS property does not already contain WM_TAKE_FOCUS
298 and WM_DELETE_WINDOW, then add them. (They may already be present 298 and WM_DELETE_WINDOW, then add them. (They may already be present
312 { 312 {
313 Atom type; 313 Atom type;
314 int format = 0; 314 int format = 0;
315 unsigned long nitems = 0; 315 unsigned long nitems = 0;
316 unsigned long bytes_after; 316 unsigned long bytes_after;
317 unsigned char *prop_return = 0; /* semantically a void* */ 317 Rawbyte *prop_return = 0; /* semantically a void* */
318 318
319 if (Success == XGetWindowProperty (dpy, w, DEVICE_XATOM_WM_PROTOCOLS (d), 319 if (Success == XGetWindowProperty (dpy, w, DEVICE_XATOM_WM_PROTOCOLS (d),
320 0, 100, False, XA_ATOM, 320 0, 100, False, XA_ATOM,
321 &type, &format, &nitems, &bytes_after, 321 &type, &format, &nitems, &bytes_after,
322 &prop_return) 322 &prop_return)
328 if (atoms[nitems] == DEVICE_XATOM_WM_DELETE_WINDOW (d)) 328 if (atoms[nitems] == DEVICE_XATOM_WM_DELETE_WINDOW (d))
329 need_delete = 0; 329 need_delete = 0;
330 else if (atoms[nitems] == DEVICE_XATOM_WM_TAKE_FOCUS (d)) 330 else if (atoms[nitems] == DEVICE_XATOM_WM_TAKE_FOCUS (d))
331 need_focus = 0; 331 need_focus = 0;
332 } 332 }
333 if (prop_return) XFree ((char *) prop_return); 333 if (prop_return) XFree ((CRawbyte *) prop_return);
334 } 334 }
335 { 335 {
336 Atom props [10]; 336 Atom props [10];
337 int count = 0; 337 int count = 0;
338 if (need_delete) props[count++] = DEVICE_XATOM_WM_DELETE_WINDOW (d); 338 if (need_delete) props[count++] = DEVICE_XATOM_WM_DELETE_WINDOW (d);
339 if (need_focus) props[count++] = DEVICE_XATOM_WM_TAKE_FOCUS (d); 339 if (need_focus) props[count++] = DEVICE_XATOM_WM_TAKE_FOCUS (d);
340 if (count) 340 if (count)
341 XChangeProperty (dpy, w, DEVICE_XATOM_WM_PROTOCOLS (d), XA_ATOM, 32, 341 XChangeProperty (dpy, w, DEVICE_XATOM_WM_PROTOCOLS (d), XA_ATOM, 32,
342 PropModeAppend, (unsigned char *) props, count); 342 PropModeAppend, (Rawbyte *) props, count);
343 } 343 }
344 } 344 }
345 345
346 static void 346 static void
347 x_wm_store_class_hints (Widget shell, char *frame_name) 347 x_wm_store_class_hints (Widget shell, Extbyte *frame_name)
348 { 348 {
349 Display *dpy = XtDisplay (shell); 349 Display *dpy = XtDisplay (shell);
350 char *app_name, *app_class; 350 Extbyte *app_name, *app_class;
351 XClassHint classhint; 351 XClassHint classhint;
352 352
353 if (!XtIsWMShell (shell)) 353 if (!XtIsWMShell (shell))
354 abort (); 354 abort ();
355 355
358 classhint.res_class = app_class; 358 classhint.res_class = app_class;
359 XSetClassHint (dpy, XtWindow (shell), &classhint); 359 XSetClassHint (dpy, XtWindow (shell), &classhint);
360 } 360 }
361 361
362 #ifndef HAVE_WMCOMMAND 362 #ifndef HAVE_WMCOMMAND
363
363 static void 364 static void
364 x_wm_maybe_store_wm_command (struct frame *f) 365 x_wm_maybe_store_wm_command (struct frame *f)
365 { 366 {
366 Widget w = FRAME_X_SHELL_WIDGET (f); 367 Widget w = FRAME_X_SHELL_WIDGET (f);
367 struct device *d = XDEVICE (FRAME_DEVICE (f)); 368 struct device *d = XDEVICE (FRAME_DEVICE (f));
370 abort (); 371 abort ();
371 372
372 if (NILP (DEVICE_X_WM_COMMAND_FRAME (d))) 373 if (NILP (DEVICE_X_WM_COMMAND_FRAME (d)))
373 { 374 {
374 int argc; 375 int argc;
375 char **argv; 376 Wexttext **argv;
376 make_argc_argv (Vcommand_line_args, &argc, &argv); 377 make_argc_argv (Vcommand_line_args, &argc, &argv);
377 XSetCommand (XtDisplay (w), XtWindow (w), argv, argc); 378 XSetCommand (XtDisplay (w), XtWindow (w), argv, argc);
378 free_argc_argv (argv); 379 free_argc_argv (argv);
379 DEVICE_X_WM_COMMAND_FRAME (d) = wrap_frame (f); 380 DEVICE_X_WM_COMMAND_FRAME (d) = wrap_frame (f);
380 } 381 }
408 409
409 x_wm_maybe_store_wm_command (f); 410 x_wm_maybe_store_wm_command (f);
410 411
411 } 412 }
412 } 413 }
414
413 #endif /* !HAVE_WMCOMMAND */ 415 #endif /* !HAVE_WMCOMMAND */
414 416
415 int 417 int
416 x_frame_window_state (struct frame *f) 418 x_frame_window_state (struct frame *f)
417 { 419 {
418 Atom actual_type; 420 Atom actual_type;
419 int actual_format; 421 int actual_format;
420 unsigned long nitems, bytesafter; 422 unsigned long nitems, bytesafter;
421 unsigned char *datap = 0; 423 Rawbyte *datap = 0;
422 Widget widget; 424 Widget widget;
423 int result = -1; 425 int result = -1;
424 struct device *d = XDEVICE (FRAME_DEVICE (f)); 426 struct device *d = XDEVICE (FRAME_DEVICE (f));
425 427
426 widget = FRAME_X_SHELL_WIDGET (f); 428 widget = FRAME_X_SHELL_WIDGET (f);
432 && datap) 434 && datap)
433 { 435 {
434 unsigned long *ul_result_ptr = (unsigned long *) datap; 436 unsigned long *ul_result_ptr = (unsigned long *) datap;
435 if (nitems <= 2) /* "suggested" by ICCCM version 1 */ 437 if (nitems <= 2) /* "suggested" by ICCCM version 1 */
436 result = (int) ul_result_ptr[0]; 438 result = (int) ul_result_ptr[0];
437 XFree ((char *) datap); 439 XFree ((CRawbyte *) datap);
438 } 440 }
439 441
440 return result; 442 return result;
441 } 443 }
442 444
641 Ibyte *ptr; 643 Ibyte *ptr;
642 /* Optimize for common ASCII case */ 644 /* Optimize for common ASCII case */
643 for (ptr = value; *ptr; ptr++) 645 for (ptr = value; *ptr; ptr++)
644 if (!byte_ascii_p (*ptr)) 646 if (!byte_ascii_p (*ptr))
645 { 647 {
646 const char * tmp; 648 const Extbyte *tmp;
647 encoding = DEVICE_XATOM_COMPOUND_TEXT (XDEVICE (FRAME_DEVICE (f))); 649 encoding = DEVICE_XATOM_COMPOUND_TEXT (XDEVICE (FRAME_DEVICE (f)));
648 C_STRING_TO_EXTERNAL (value, tmp, Qctext); 650 C_STRING_TO_EXTERNAL (value, tmp, Qctext);
649 new_XtValue = (String) tmp; 651 new_XtValue = (String) tmp;
650 break; 652 break;
651 } 653 }
683 685
684 static void 686 static void
685 x_set_initial_frame_size (struct frame *f, int flags, int x, int y, 687 x_set_initial_frame_size (struct frame *f, int flags, int x, int y,
686 int w, int h) 688 int w, int h)
687 { 689 {
688 char shell_geom [255]; 690 Ascbyte shell_geom[255];
689 int xval, yval; 691 int xval, yval;
690 char xsign, ysign; 692 Ascbyte xsign, ysign;
691 char uspos = !!(flags & (XValue | YValue)); 693 Boolbyte uspos = !!(flags & (XValue | YValue));
692 char ussize = !!(flags & (WidthValue | HeightValue)); 694 Boolbyte ussize = !!(flags & (WidthValue | HeightValue));
693 char *temp; 695 Ascbyte *temp;
694 696
695 /* assign the correct size to the EmacsFrame widget ... */ 697 /* assign the correct size to the EmacsFrame widget ... */
696 EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), w, h); 698 EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), w, h);
697 699
698 /* and also set the WMShell's geometry */ 700 /* and also set the WMShell's geometry */
706 else if (ussize) 708 else if (ussize)
707 sprintf (shell_geom, "=%dx%d", w, h); 709 sprintf (shell_geom, "=%dx%d", w, h);
708 710
709 if (uspos || ussize) 711 if (uspos || ussize)
710 { 712 {
711 temp = (char *) xmalloc (1 + strlen (shell_geom)); 713 temp = xnew_ascbytes (1 + strlen (shell_geom));
712 strcpy (temp, shell_geom); 714 strcpy (temp, shell_geom);
713 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp; 715 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp;
714 } 716 }
715 else 717 else
716 temp = NULL; 718 temp = NULL;
740 Lisp_Object prop = Fcar (tail); 742 Lisp_Object prop = Fcar (tail);
741 Lisp_Object val = Fcar (Fcdr (tail)); 743 Lisp_Object val = Fcar (Fcdr (tail));
742 744
743 if (STRINGP (prop)) 745 if (STRINGP (prop))
744 { 746 {
745 const char *extprop; 747 const Extbyte *extprop;
746 748
747 if (XSTRING_LENGTH (prop) == 0) 749 if (XSTRING_LENGTH (prop) == 0)
748 continue; 750 continue;
749 751
750 LISP_STRING_TO_EXTERNAL (prop, extprop, Qctext); 752 LISP_STRING_TO_EXTERNAL (prop, extprop, Qxt_widget_arg_encoding);
751 if (STRINGP (val)) 753 if (STRINGP (val))
752 { 754 {
753 const Extbyte *extval; 755 const Extbyte *extval;
754 Bytecount extvallen; 756 Bytecount extvallen;
755 757
758 /* !!#### I seriously doubt there is a single external format
759 for the value of a widget argument; it depends on the
760 semantics of the argument. So use of
761 Qxt_widget_arg_encoding is totally bogus. --ben */
756 TO_EXTERNAL_FORMAT (LISP_STRING, val, 762 TO_EXTERNAL_FORMAT (LISP_STRING, val,
757 ALLOCA, (extval, extvallen), 763 ALLOCA, (extval, extvallen),
758 Qctext); 764 Qxt_widget_arg_encoding);
759 XtVaSetValues (w, XtVaTypedArg, extprop, 765 XtVaSetValues (w, XtVaTypedArg, extprop,
766 /* !!#### Verify this + 1 and document
767 as zero-termination */
760 XtRString, extval, extvallen + 1, 768 XtRString, extval, extvallen + 1,
761 (XtArgVal) NULL); 769 (XtArgVal) NULL);
762 } 770 }
763 else 771 else
764 XtVaSetValues (w, XtVaTypedArg, extprop, XtRInt, 772 XtVaSetValues (w, XtVaTypedArg, extprop, XtRInt,
767 } 775 }
768 else if (SYMBOLP (prop)) 776 else if (SYMBOLP (prop))
769 { 777 {
770 Lisp_Object str = Fget (prop, Qx_resource_name, Qnil); 778 Lisp_Object str = Fget (prop, Qx_resource_name, Qnil);
771 int int_p = !NILP (Fget (prop, Qintegerp, Qnil)); 779 int int_p = !NILP (Fget (prop, Qintegerp, Qnil));
780 Extbyte *strext;
772 781
773 if (NILP (prop) || NILP (str)) 782 if (NILP (prop) || NILP (str))
774 { 783 {
775 /* Kludge to handle the font property. */ 784 /* Kludge to handle the font property. */
776 if (EQ (prop, Qfont)) 785 if (EQ (prop, Qfont))
794 } 803 }
795 CHECK_STRING (str); 804 CHECK_STRING (str);
796 805
797 /* Kludge the width/height so that we interpret them in characters 806 /* Kludge the width/height so that we interpret them in characters
798 instead of pixels. Yuck yuck yuck. */ 807 instead of pixels. Yuck yuck yuck. */
799 if (!strcmp ((char *) XSTRING_DATA (str), "width")) 808 if (!qxestrcmp_ascii (XSTRING_DATA (str), "width"))
800 { 809 {
801 CHECK_INT (val); 810 CHECK_INT (val);
802 width = XINT (val); 811 width = XINT (val);
803 width_specified_p = True; 812 width_specified_p = True;
804 continue; 813 continue;
805 } 814 }
806 if (!strcmp ((char *) XSTRING_DATA (str), "height")) 815 if (!qxestrcmp_ascii (XSTRING_DATA (str), "height"))
807 { 816 {
808 CHECK_INT (val); 817 CHECK_INT (val);
809 height = XINT (val); 818 height = XINT (val);
810 height_specified_p = True; 819 height_specified_p = True;
811 continue; 820 continue;
812 } 821 }
813 /* Further kludge the x/y. */ 822 /* Further kludge the x/y. */
814 if (!strcmp ((char *) XSTRING_DATA (str), "x")) 823 if (!qxestrcmp_ascii (XSTRING_DATA (str), "x"))
815 { 824 {
816 CHECK_INT (val); 825 CHECK_INT (val);
817 x = (Position) XINT (val); 826 x = (Position) XINT (val);
818 x_position_specified_p = True; 827 x_position_specified_p = True;
819 continue; 828 continue;
820 } 829 }
821 if (!strcmp ((char *) XSTRING_DATA (str), "y")) 830 if (!qxestrcmp_ascii (XSTRING_DATA (str), "y"))
822 { 831 {
823 CHECK_INT (val); 832 CHECK_INT (val);
824 y = (Position) XINT (val); 833 y = (Position) XINT (val);
825 y_position_specified_p = True; 834 y_position_specified_p = True;
826 continue; 835 continue;
827 } 836 }
828 /* Have you figured out by now that this entire function is 837 /* Have you figured out by now that this entire function is
829 one gigantic kludge? */ 838 one gigantic kludge? */
830 if (!strcmp ((char *) XSTRING_DATA (str), 839 if (!qxestrcmp_ascii (XSTRING_DATA (str), "internalBorderWidth"))
831 "internalBorderWidth"))
832 { 840 {
833 internal_border_width_specified = True; 841 internal_border_width_specified = True;
834 } 842 }
835 843
844 LISP_STRING_TO_EXTERNAL (str, strext, Qxt_widget_arg_encoding);
836 if (int_p) 845 if (int_p)
837 { 846 {
838 CHECK_INT (val); 847 CHECK_INT (val);
839 Xt_SET_VALUE (w, (char *) XSTRING_DATA (str), XINT (val)); 848 Xt_SET_VALUE (w, strext, XINT (val));
840 } 849 }
841 else if (EQ (val, Qt)) 850 else if (EQ (val, Qt))
842 { 851 {
843 Xt_SET_VALUE (w, (char *) XSTRING_DATA (str), True); /* XtN...*/ 852 Xt_SET_VALUE (w, strext, True); /* XtN...*/
844 } 853 }
845 else if (EQ (val, Qnil)) 854 else if (EQ (val, Qnil))
846 { 855 {
847 Xt_SET_VALUE (w, (char *) XSTRING_DATA (str), False); /* XtN...*/ 856 Xt_SET_VALUE (w, strext, False); /* XtN...*/
848 } 857 }
849 else 858 else
850 { 859 {
851 CHECK_STRING (val); 860 CHECK_STRING (val);
861 const Extbyte *extval;
862 Bytecount extvallen;
863
864 TO_EXTERNAL_FORMAT (LISP_STRING, val,
865 ALLOCA, (extval, extvallen),
866 Qxt_widget_arg_encoding);
852 XtVaSetValues (w, XtVaTypedArg, 867 XtVaSetValues (w, XtVaTypedArg,
853 /* XtN... */ 868 /* XtN... */
854 (char *) XSTRING_DATA (str), 869 strext,
855 XtRString, 870 /* !!#### Verify this + 1 and document
856 XSTRING_DATA (val), 871 as zero-termination */
857 XSTRING_LENGTH (val) + 1, 872 XtRString, extval, extvallen + 1,
858 (XtArgVal) NULL); 873 (XtArgVal) NULL);
859 } 874 }
860 875
861 #ifdef HAVE_SCROLLBARS 876 #ifdef HAVE_SCROLLBARS
862 if (!strcmp ((char *) XSTRING_DATA (str), "scrollBarWidth") 877 if (!qxestrcmp_ascii (XSTRING_DATA (str), "scrollBarWidth")
863 || !strcmp ((char *) XSTRING_DATA (str), 878 || !qxestrcmp_ascii (XSTRING_DATA (str), "scrollBarHeight"))
864 "scrollBarHeight"))
865 { 879 {
866 x_update_frame_scrollbars (f); 880 x_update_frame_scrollbars (f);
867 } 881 }
868 #endif /* HAVE_SCROLLBARS */ 882 #endif /* HAVE_SCROLLBARS */
869 } 883 }
939 */ 953 */
940 954
941 if (!frame_title_format_already_set) 955 if (!frame_title_format_already_set)
942 { 956 {
943 /* No doubt there's a less stupid way to do this. */ 957 /* No doubt there's a less stupid way to do this. */
944 char *results [2]; 958 Extbyte *results[2];
945 XtResource resources [2]; 959 XtResource resources[2];
946 results [0] = results [1] = 0; 960 results[0] = results[1] = 0;
947 resources [0].resource_name = XtNtitle; 961 resources[0].resource_name = XtNtitle;
948 resources [0].resource_class = XtCTitle; 962 resources[0].resource_class = XtCTitle;
949 resources [0].resource_type = XtRString; 963 resources[0].resource_type = XtRString;
950 resources [0].resource_size = sizeof (String); 964 resources[0].resource_size = sizeof (String);
951 resources [0].resource_offset = 0; 965 resources[0].resource_offset = 0;
952 resources [0].default_type = XtRString; 966 resources[0].default_type = XtRString;
953 resources [0].default_addr = 0; 967 resources[0].default_addr = 0;
954 resources [1].resource_name = XtNiconName; 968 resources[1].resource_name = XtNiconName;
955 resources [1].resource_class = XtCIconName; 969 resources[1].resource_class = XtCIconName;
956 resources [1].resource_type = XtRString; 970 resources[1].resource_type = XtRString;
957 resources [1].resource_size = sizeof (String); 971 resources[1].resource_size = sizeof (String);
958 resources [1].resource_offset = sizeof (char *); 972 resources[1].resource_offset = sizeof (Extbyte *);
959 resources [1].default_type = XtRString; 973 resources[1].default_type = XtRString;
960 resources [1].default_addr = 0; 974 resources[1].default_addr = 0;
961 XtGetSubresources (XtParent (shell), (XtPointer) results, 975 XtGetSubresources (XtParent (shell), (XtPointer) results,
962 shell->core.name, 976 shell->core.name,
963 shell->core.widget_class->core_class.class_name, 977 shell->core.widget_class->core_class.class_name,
964 resources, XtNumber (resources), 0, 0); 978 resources, XtNumber (resources), 0, 0);
965 if (results[0]) 979 if (results[0])
966 Vframe_title_format = build_string (results[0]); 980 Vframe_title_format = build_ext_string (results[0], Qctext);
967 if (results[1]) 981 if (results[1])
968 Vframe_icon_title_format = build_string (results[1]); 982 Vframe_icon_title_format = build_ext_string (results[1], Qctext);
969 } 983 }
970 984
971 frame_title_format_already_set = 1; 985 frame_title_format_already_set = 1;
972 } 986 }
987
988 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND)
989
990 static Extbyte *
991 start_drag_internal_1 (Lisp_Object event, Lisp_Object data,
992 Lisp_Object encoding, XEvent *x_event, int listp,
993 Widget *wid_out, Bytecount *len_out,
994 int *num_items_out)
995 {
996 struct frame *f;
997 Widget wid;
998 struct device *d;
999 struct x_device *xd;
1000 XWindowAttributes win_attrib;
1001 int modifier = 0, state = 0;
1002 Extbyte *dnd_data;
1003 Lisp_Event *lisp_event;
1004
1005 CHECK_EVENT (event);
1006 lisp_event = XEVENT (event);
1007 if (EVENT_TYPE (lisp_event) != button_press_event)
1008 invalid_argument ("Need button-press event for drag", event);
1009 f = decode_x_frame (FW_FRAME (EVENT_CHANNEL (lisp_event)));
1010 wid = FRAME_X_TEXT_WIDGET (f);
1011 d = XDEVICE (FRAME_DEVICE (f));
1012 xd = DEVICE_X_DATA (d);
1013 *num_items_out = 0;
1014
1015 if (listp)
1016 {
1017 DECLARE_EISTRING (ei);
1018
1019 EXTERNAL_LIST_LOOP_2 (elt, data)
1020 {
1021 CHECK_STRING (elt);
1022 eicat_lstr (ei, elt);
1023 eicat_ch (ei, '\0');
1024 (*num_items_out)++;
1025 }
1026 eicat_ch (ei, '\0');
1027 SIZED_C_STRING_TO_SIZED_EXTERNAL_MALLOC (eidata (ei), eilen (ei),
1028 dnd_data, *len_out,
1029 encoding);
1030 }
1031 else
1032 {
1033 CHECK_STRING (data);
1034 LISP_STRING_TO_SIZED_EXTERNAL_MALLOC (data, dnd_data, *len_out,
1035 encoding);
1036 *len_out += EXTTEXT_ZTERM_SIZE;
1037 (*num_items_out)++;
1038 }
1039
1040 /* not so gross hack that converts an emacs event back to a XEvent */
1041
1042 x_event->xbutton.type = ButtonPress;
1043 x_event->xbutton.send_event = False;
1044 x_event->xbutton.display = XtDisplayOfObject (wid);
1045 x_event->xbutton.window = XtWindowOfObject (wid);
1046 x_event->xbutton.root = XRootWindow (x_event->xbutton.display, 0);
1047 x_event->xbutton.subwindow = 0;
1048 x_event->xbutton.time = lisp_event->timestamp;
1049 x_event->xbutton.x = EVENT_BUTTON_X (lisp_event);
1050 x_event->xbutton.y = EVENT_BUTTON_Y (lisp_event);
1051 if (Success == XGetWindowAttributes (x_event->xbutton.display,
1052 x_event->xbutton.window,
1053 &win_attrib))
1054 {
1055 x_event->xbutton.x_root = win_attrib.x + EVENT_BUTTON_X (lisp_event);
1056 x_event->xbutton.y_root = win_attrib.y + EVENT_BUTTON_Y (lisp_event);
1057 }
1058 else
1059 {
1060 x_event->xbutton.x_root = EVENT_BUTTON_X (lisp_event); /* this is wrong */
1061 x_event->xbutton.y_root = EVENT_BUTTON_Y (lisp_event);
1062 }
1063
1064 modifier = EVENT_BUTTON_MODIFIERS (lisp_event);
1065 if (modifier & XEMACS_MOD_SHIFT) state |= ShiftMask;
1066 if (modifier & XEMACS_MOD_CONTROL) state |= ControlMask;
1067 if (modifier & XEMACS_MOD_META) state |= xd->MetaMask;
1068 if (modifier & XEMACS_MOD_SUPER) state |= xd->SuperMask;
1069 if (modifier & XEMACS_MOD_HYPER) state |= xd->HyperMask;
1070 if (modifier & XEMACS_MOD_ALT) state |= xd->AltMask;
1071 state |= Button1Mask << (EVENT_BUTTON_BUTTON (lisp_event) - 1);
1072
1073 x_event->xbutton.state = state;
1074 x_event->xbutton.button = EVENT_BUTTON_BUTTON (lisp_event);
1075 x_event->xbutton.same_screen = True;
1076
1077 *wid_out = wid;
1078 return dnd_data;
1079 }
1080
1081 #endif /* defined (HAVE_CDE) || defined (HAVE_OFFIX_DND) */
973 1082
974 #ifdef HAVE_CDE 1083 #ifdef HAVE_CDE
975 #include <Dt/Dt.h> 1084 #include <Dt/Dt.h>
976 #include <Dt/Dnd.h> 1085 #include <Dt/Dnd.h>
977 1086
983 static void 1092 static void
984 x_cde_destroy_callback (Widget widget, XtPointer clientData, 1093 x_cde_destroy_callback (Widget widget, XtPointer clientData,
985 XtPointer callData) 1094 XtPointer callData)
986 { 1095 {
987 DtDndDragFinishCallbackStruct *dragFinishInfo = 1096 DtDndDragFinishCallbackStruct *dragFinishInfo =
988 (DtDndDragFinishCallbackStruct *)callData; 1097 (DtDndDragFinishCallbackStruct *) callData;
989 DtDndContext *dragData = dragFinishInfo->dragData; 1098 DtDndContext *dragData = dragFinishInfo->dragData;
990 int i; 1099 int i;
991 1100
992 /* free the items */ 1101 /* free the items */
993 if (callData != NULL && dragData != NULL) 1102 if (callData != NULL && dragData != NULL)
994 { 1103 {
995 if (dragData->protocol == DtDND_BUFFER_TRANSFER) 1104 if (dragData->protocol == DtDND_BUFFER_TRANSFER)
996 { 1105 {
997 for (i = 0; i < dragData->numItems; i++) 1106 for (i = 0; i < dragData->numItems; i++)
998 { 1107 {
999 XtFree((char *) dragData->data.buffers[i].bp); 1108 XtFree ((CRawbyte *) dragData->data.buffers[i].bp);
1000 if (dragData->data.buffers[i].name) 1109 if (dragData->data.buffers[i].name)
1001 XtFree(dragData->data.buffers[i].name); 1110 XtFree(dragData->data.buffers[i].name);
1002 } 1111 }
1003 } 1112 }
1004 else 1113 else
1018 x_cde_convert_callback (Widget widget, XtPointer clientData, 1127 x_cde_convert_callback (Widget widget, XtPointer clientData,
1019 XtPointer callData) 1128 XtPointer callData)
1020 { 1129 {
1021 DtDndConvertCallbackStruct *convertInfo = 1130 DtDndConvertCallbackStruct *convertInfo =
1022 (DtDndConvertCallbackStruct *) callData; 1131 (DtDndConvertCallbackStruct *) callData;
1023 char *textdata = (char *) clientData; 1132 Extbyte *textdata = (Extbyte *) clientData;
1024 char *textptr = NULL; 1133 Extbyte *textptr = NULL;
1025 int i; 1134 int i;
1026 1135
1027 if (convertInfo == NULL) 1136 if (convertInfo == NULL)
1028 { 1137 {
1029 return; 1138 return;
1034 (convertInfo->reason != DtCR_DND_CONVERT_DATA)) 1143 (convertInfo->reason != DtCR_DND_CONVERT_DATA))
1035 { 1144 {
1036 return; 1145 return;
1037 } 1146 }
1038 1147
1039 for (textptr=textdata, i=0; 1148 for (textptr = textdata, i = 0;
1040 i<convertInfo->dragData->numItems; 1149 i < convertInfo->dragData->numItems;
1041 textptr+=strlen(textptr)+1, i++) 1150 textptr += strlen (textptr) + 1, i++)
1042 { 1151 {
1043 if (convertInfo->dragData->protocol == DtDND_BUFFER_TRANSFER) 1152 if (convertInfo->dragData->protocol == DtDND_BUFFER_TRANSFER)
1044 { 1153 {
1045 convertInfo->dragData->data.buffers[i].bp = XtNewString(textptr); 1154 convertInfo->dragData->data.buffers[i].bp = XtNewString (textptr);
1046 convertInfo->dragData->data.buffers[i].size = strlen(textptr); 1155 convertInfo->dragData->data.buffers[i].size = strlen (textptr);
1047 convertInfo->dragData->data.buffers[i].name = NULL; 1156 convertInfo->dragData->data.buffers[i].name = NULL;
1048 } 1157 }
1049 else 1158 else
1050 { 1159 {
1051 convertInfo->dragData->data.files[i] = XtNewString(textptr); 1160 convertInfo->dragData->data.files[i] = XtNewString (textptr);
1052 } 1161 }
1053 } 1162 }
1054 1163
1055 convertInfo->status = DtDND_SUCCESS; 1164 convertInfo->status = DtDND_SUCCESS;
1056 } 1165 }
1057 1166
1058 static Lisp_Object 1167 static Lisp_Object
1059 abort_current_drag(Lisp_Object arg) 1168 abort_current_drag (Lisp_Object arg)
1060 { 1169 {
1061 if (CurrentDragWidget && drag_not_done) 1170 if (CurrentDragWidget && drag_not_done)
1062 { 1171 {
1063 XmDragCancel(CurrentDragWidget); 1172 XmDragCancel(CurrentDragWidget);
1064 CurrentDragWidget = NULL; 1173 CurrentDragWidget = NULL;
1075 and the third argument is a list of data strings. 1184 and the third argument is a list of data strings.
1076 WARNING: can only handle plain/text and file: transfers! 1185 WARNING: can only handle plain/text and file: transfers!
1077 */ 1186 */
1078 (event, dragtype, dragdata)) 1187 (event, dragtype, dragdata))
1079 { 1188 {
1080 if (EVENTP (event)) 1189 Extbyte *dnd_data;
1081 { 1190 XEvent x_event;
1082 struct frame *f = decode_x_frame (Fselected_frame (Qnil)); 1191 Bytecount dnd_len;
1083 XEvent x_event; 1192 Widget wid;
1084 Widget wid = FRAME_X_TEXT_WIDGET (f); 1193 int num_items;
1085 Display *display = XtDisplayOfObject (wid); 1194
1086 struct device *d = get_device_from_display (display); 1195 dnd_data = start_drag_internal_1 (event, dragdata, Qdt_dnd_encoding,
1087 struct x_device *xd = DEVICE_X_DATA (d); 1196 &x_event, 1,
1088 XWindowAttributes win_attrib; 1197 &wid, &dnd_len, &num_items);
1089 int modifier = 0, state = 0; 1198
1090 char *Ctext; 1199 dnd_convert_cb_rec[0].callback = x_cde_convert_callback;
1091 int numItems = 0, textlen = 0, pos = 0; 1200 dnd_convert_cb_rec[0].closure = (XtPointer) dnd_data;
1092 Lisp_Event *lisp_event = XEVENT (event); 1201 dnd_convert_cb_rec[1].callback = NULL;
1093 Lisp_Object item = Qnil; 1202 dnd_convert_cb_rec[1].closure = NULL;
1094 struct gcpro gcpro1; 1203
1095 1204 dnd_destroy_cb_rec[0].callback = x_cde_destroy_callback;
1096 /* only drag if this is really a press */ 1205 dnd_destroy_cb_rec[0].closure = (XtPointer) dnd_data;
1097 if (EVENT_TYPE(lisp_event) != button_press_event 1206 dnd_destroy_cb_rec[1].callback = NULL;
1098 || !LISTP(dragdata)) 1207 dnd_destroy_cb_rec[1].closure = NULL;
1099 return Qnil; 1208
1100 1209 CurrentDragWidget =
1101 GCPRO1 (item); 1210 DtDndDragStart (wid, &x_event,
1102 1211 (NILP (dragtype) ? DtDND_BUFFER_TRANSFER :
1103 /* 1212 DtDND_FILENAME_TRANSFER),
1104 * not so cross hack that converts a emacs event back to a XEvent 1213 num_items,
1105 */ 1214 XmDROP_COPY,
1106 1215 dnd_convert_cb_rec,
1107 x_event.xbutton.type = ButtonPress; 1216 dnd_destroy_cb_rec,
1108 x_event.xbutton.send_event = False; 1217 NULL, 0);
1109 x_event.xbutton.display = XtDisplayOfObject(wid); 1218
1110 x_event.xbutton.window = XtWindowOfObject(wid); 1219 xfree (dnd_data, Extbyte *);
1111 x_event.xbutton.root = XRootWindow(x_event.xbutton.display, 0); 1220
1112 x_event.xbutton.subwindow = 0; 1221 return num_items ? Qt : Qnil;
1113 x_event.xbutton.time = lisp_event->timestamp;
1114 x_event.xbutton.x = EVENT_BUTTON_X (lisp_event);
1115 x_event.xbutton.y = EVENT_BUTTON_Y (lisp_event);
1116 if (Success == XGetWindowAttributes (x_event.xbutton.display,
1117 x_event.xbutton.window,
1118 &win_attrib))
1119 {
1120 x_event.xbutton.x_root = win_attrib.x + EVENT_BUTTON_X (lisp_event);
1121 x_event.xbutton.y_root = win_attrib.y + EVENT_BUTTON_Y (lisp_event);
1122 }
1123 else
1124 {
1125 x_event.xbutton.x_root = EVENT_BUTTON_X (lisp_event); /* this is wrong */
1126 x_event.xbutton.y_root = EVENT_BUTTON_Y (lisp_event);
1127 }
1128 modifier = EVENT_BUTTON_MODIFIERS (lisp_event);
1129 if (modifier & XEMACS_MOD_SHIFT) state |= ShiftMask;
1130 if (modifier & XEMACS_MOD_CONTROL) state |= ControlMask;
1131 if (modifier & XEMACS_MOD_META) state |= xd->MetaMask;
1132 if (modifier & XEMACS_MOD_SUPER) state |= xd->SuperMask;
1133 if (modifier & XEMACS_MOD_HYPER) state |= xd->HyperMask;
1134 if (modifier & XEMACS_MOD_ALT) state |= xd->AltMask;
1135 state |= Button1Mask << (EVENT_BUTTON_BUTTON (lisp_event)-1);
1136
1137 x_event.xbutton.state = state;
1138 x_event.xbutton.button = EVENT_BUTTON_BUTTON (lisp_event);
1139 x_event.xkey.same_screen = True;
1140
1141 /* convert data strings into a big string */
1142 item = dragdata;
1143 while (!NILP (item))
1144 {
1145 if (!STRINGP (XCAR (item)))
1146 {
1147 numItems=0;
1148 break;
1149 }
1150 textlen += XSTRING_LENGTH (XCAR (item)) + 1;
1151 numItems++;
1152 item = XCDR (item);
1153 }
1154
1155 if (numItems)
1156 {
1157 /*
1158 * concatenate all strings given to one large string, with
1159 * \0 as separator. List is ended by \0.
1160 */
1161 Ctext = (char *)xmalloc (textlen+1);
1162 Ctext[0] = 0;
1163
1164 item = dragdata;
1165 while (!NILP (item))
1166 {
1167 if (!STRINGP (XCAR (item)))
1168 {
1169 numItems=0;
1170 xfree(Ctext, char *);
1171 Ctext=NULL;
1172 break;
1173 }
1174 strcpy (Ctext+pos, (const char *)XSTRING_DATA (XCAR (item)));
1175 pos += XSTRING_LENGTH (XCAR (item)) + 1;
1176 item = XCDR (item);
1177 }
1178 Ctext[pos] = 0;
1179
1180 dnd_convert_cb_rec[0].callback = x_cde_convert_callback;
1181 dnd_convert_cb_rec[0].closure = (XtPointer) Ctext;
1182 dnd_convert_cb_rec[1].callback = NULL;
1183 dnd_convert_cb_rec[1].closure = NULL;
1184
1185 dnd_destroy_cb_rec[0].callback = x_cde_destroy_callback;
1186 dnd_destroy_cb_rec[0].closure = (XtPointer) Ctext;
1187 dnd_destroy_cb_rec[1].callback = NULL;
1188 dnd_destroy_cb_rec[1].closure = NULL;
1189
1190 CurrentDragWidget =
1191 DtDndDragStart (wid, &x_event,
1192 (NILP(dragtype)?DtDND_BUFFER_TRANSFER:DtDND_FILENAME_TRANSFER),
1193 numItems,
1194 XmDROP_COPY,
1195 dnd_convert_cb_rec,
1196 dnd_destroy_cb_rec,
1197 NULL, 0);
1198 }
1199
1200 UNGCPRO;
1201
1202 return numItems?Qt:Qnil;
1203 }
1204
1205 return Qnil;
1206 } 1222 }
1207 1223
1208 static void 1224 static void
1209 x_cde_transfer_callback (Widget widget, XtPointer clientData, 1225 x_cde_transfer_callback (Widget widget, XtPointer clientData,
1210 XtPointer callData) 1226 XtPointer callData)
1211 { 1227 {
1212 char *filePath, *hurl; 1228 int ii, enqueue = 1;
1213 int ii, enqueue=1;
1214 Lisp_Object frame = Qnil; 1229 Lisp_Object frame = Qnil;
1215 Lisp_Object l_type = Qnil; 1230 Lisp_Object l_type = Qnil;
1216 Lisp_Object l_data = Qnil; 1231 Lisp_Object l_data = Qnil;
1217 DtDndTransferCallbackStruct *transferInfo = NULL; 1232 DtDndTransferCallbackStruct *transferInfo = NULL;
1218 struct gcpro gcpro1, gcpro2, gcpro3; 1233 struct gcpro gcpro1, gcpro2, gcpro3;
1237 { 1252 {
1238 l_type = Qdragdrop_URL; 1253 l_type = Qdragdrop_URL;
1239 1254
1240 for (ii = 0; ii < transferInfo->dropData->numItems; ii++) 1255 for (ii = 0; ii < transferInfo->dropData->numItems; ii++)
1241 { 1256 {
1242 filePath = transferInfo->dropData->data.files[ii]; 1257 Ibyte *fileint;
1243 hurl = dnd_url_hexify_string ((char *)filePath, "file:"); 1258 Ibyte *hurl;
1244 /* #### Mule-izing required */ 1259
1245 l_data = Fcons (make_string ((Ibyte* )hurl, 1260 EXTERNAL_TO_C_STRING (transferInfo->dropData->data.files[ii],
1246 strlen (hurl)), 1261 fileint, Qfile_name);
1247 l_data); 1262
1248 xfree (hurl, char *); 1263 hurl = dnd_url_hexify_string (fileint, "file:");
1264 l_data = Fcons (build_intstring (hurl), l_data);
1265 xfree (hurl, Ibyte *);
1249 } 1266 }
1250 } 1267 }
1251 else if (transferInfo->dropData->protocol == DtDND_BUFFER_TRANSFER) 1268 else if (transferInfo->dropData->protocol == DtDND_BUFFER_TRANSFER)
1252 { 1269 {
1253 int speccount = specpdl_depth(); 1270 int speccount = specpdl_depth ();
1254 1271
1255 /* Problem: all buffers a treated as text/plain!!! 1272 /* !!#### Problem: all buffers a treated as text/plain!!!
1256 Solution: Also support DtDND_TEXT_TRANSFER 1273 Not appropriate for intl text. Note that there is a function
1274 DtDtsBufferToDataType(), but I don't know what the possible
1275 return values are.
1276 Solution (?): Also support DtDND_TEXT_TRANSFER (compound text)
1257 perhaps implementation of the Motif protocol 1277 perhaps implementation of the Motif protocol
1258 (which is the base of CDE) will clear this */ 1278 (which is the base of CDE) will clear this */
1259 l_type = Qdragdrop_MIME; 1279 l_type = Qdragdrop_MIME;
1260 record_unwind_protect(abort_current_drag, Qnil); 1280 record_unwind_protect (abort_current_drag, Qnil);
1261 drag_not_done = 1; 1281 drag_not_done = 1;
1262 for (ii = 0; ii < transferInfo->dropData->numItems; ii++) 1282 for (ii = 0; ii < transferInfo->dropData->numItems; ii++)
1263 { 1283 {
1264 /* let us forget this name thing for now... */ 1284 /* let us forget this name thing for now... */
1265 /* filePath = transferInfo->dropData->data.buffers[ii].name; 1285 /* filePath = transferInfo->dropData->data.buffers[ii].name;
1266 path = (filePath == NULL) ? Qnil 1286 path = (filePath == NULL) ? Qnil
1267 : make_string ((Ibyte *)filePath, strlen (filePath)); */ 1287 : build_ext_string (filePath, Q???); */
1268 /* what, if the data is no text, and how can I tell it? */ 1288 /* what, if the data is no text, and how can I tell it? */
1269 l_data = Fcons ( list3 ( list1 ( make_string ((Ibyte *)"text/plain", 10) ), 1289 l_data =
1270 make_string ((Ibyte *)"8bit", 4), 1290 Fcons (list3 (list1 (build_string ("text/plain")),
1271 make_string ((Ibyte *)transferInfo->dropData->data.buffers[ii].bp, 1291 build_string ("8bit"),
1272 transferInfo->dropData->data.buffers[ii].size) ), 1292 make_ext_string
1273 l_data ); 1293 (transferInfo->dropData->data.buffers[ii].bp,
1294 transferInfo->dropData->data.buffers[ii].size,
1295 /* !!#### what goes here? */
1296 Qdt_dnd_encoding)),
1297 l_data);
1274 } 1298 }
1275 drag_not_done = 0; 1299 drag_not_done = 0;
1276 unbind_to (speccount); 1300 unbind_to (speccount);
1277 } 1301 }
1278 else /* the other cases: NOOP_TRANSFER */ 1302 else /* the other cases: NOOP_TRANSFER */
1279 enqueue=0; 1303 enqueue = 0;
1280 1304
1281 /* The Problem: no button and mods from CDE... */ 1305 /* The Problem: no button and mods from CDE... */
1282 if (enqueue) 1306 if (enqueue)
1283 enqueue_misc_user_event_pos ( frame, Qdragdrop_drop_dispatch, 1307 enqueue_misc_user_event_pos (frame, Qdragdrop_drop_dispatch,
1284 Fcons (l_type, l_data), 1308 Fcons (l_type, l_data),
1285 0 /* this is the button */, 1309 0 /* this is the button */,
1286 0 /* these are the mods */, 1310 0 /* these are the mods */,
1287 transferInfo->x, 1311 transferInfo->x,
1288 transferInfo->y); 1312 transferInfo->y);
1289 1313
1290 UNGCPRO; 1314 UNGCPRO;
1291 return; 1315 return;
1292 } 1316 }
1293 #endif /* HAVE_CDE */ 1317 #endif /* HAVE_CDE */
1301 is the type of the data (this should be an int). 1325 is the type of the data (this should be an int).
1302 The type defaults to DndText (4). 1326 The type defaults to DndText (4).
1303 */ 1327 */
1304 (event, data, dtyp)) 1328 (event, data, dtyp))
1305 { 1329 {
1306 if (EVENTP(event)) 1330 Extbyte *dnd_data;
1307 { 1331 XEvent x_event;
1308 struct frame *f = decode_x_frame (Fselected_frame (Qnil)); 1332 Bytecount dnd_len;
1309 XEvent x_event; 1333 Widget wid;
1310 Widget wid = FRAME_X_TEXT_WIDGET (f); 1334 int num_items;
1311 Display *display = XtDisplayOfObject (wid); 1335 int dnd_type = DndText;
1312 struct device *d = get_device_from_display (display); 1336
1313 struct x_device *xd = DEVICE_X_DATA (d); 1337 if (!NILP (dtyp))
1314 XWindowAttributes win_attrib; 1338 {
1315 int modifier = 0, state = 0; 1339 CHECK_INT (dtyp);
1316 char *dnd_data = NULL; 1340 dnd_type = XINT (dtyp);
1317 long dnd_len = 0; 1341 }
1318 int dnd_typ = DndText, dnd_dealloc = 0; 1342
1319 Lisp_Event *lisp_event = XEVENT (event); 1343 dnd_data = start_drag_internal_1 (event, data, Qoffix_dnd_encoding,
1320 1344 &x_event, dnd_type == DndFiles,
1321 /* only drag if this is really a press */ 1345 &wid, &dnd_len, &num_items);
1322 if (EVENT_TYPE(lisp_event) != button_press_event) 1346
1323 return Qnil; 1347 DndSetData (dnd_type, (UExtbyte *) dnd_data, dnd_len);
1324 1348 xfree (dnd_data, Extbyte *);
1325 /* get the desired type */ 1349
1326 if (!NILP (dtyp) && INTP (dtyp)) 1350 /* the next thing blocks everything... */
1327 dnd_typ = XINT (dtyp); 1351 if (DndHandleDragging (wid, &x_event))
1328 1352 return Qt;
1329 if (dnd_typ == DndFiles) 1353
1330 {
1331 Lisp_Object run = data;
1332 int len = 0;
1333
1334 if (NILP ( Flistp (data)))
1335 return Qnil;
1336
1337 /* construct the data from a list of files */
1338 dnd_len = 1;
1339 dnd_data = (char *) xmalloc (1);
1340 *dnd_data = 0;
1341 while (!NILP (run))
1342 {
1343 if (!STRINGP (XCAR (run)))
1344 {
1345 xfree (dnd_data, char *);
1346 return Qnil;
1347 }
1348 len = XSTRING_LENGTH (XCAR (run)) + 1;
1349 dnd_data = (char *) xrealloc (dnd_data, dnd_len + len);
1350 strcpy (dnd_data + dnd_len - 1, (const char *)XSTRING_DATA (XCAR (run)));
1351 dnd_len += len;
1352 run = XCDR (run);
1353 }
1354
1355 dnd_data[dnd_len - 1] = 0; /* the list-ending zero */
1356 dnd_dealloc = 1;
1357
1358 }
1359 else
1360 {
1361 if (!STRINGP (data))
1362 return Qnil;
1363
1364 /* and what's with MULE data ??? */
1365 dnd_data = (char *)XSTRING_DATA (data);
1366 dnd_len = XSTRING_LENGTH (data) + 1; /* the zero */
1367
1368 }
1369
1370 /* not so gross hack that converts an emacs event back to a XEvent */
1371
1372 x_event.xbutton.type = ButtonPress;
1373 x_event.xbutton.send_event = False;
1374 x_event.xbutton.display = XtDisplayOfObject(wid);
1375 x_event.xbutton.window = XtWindowOfObject(wid);
1376 x_event.xbutton.root = XRootWindow(x_event.xkey.display, 0);
1377 x_event.xbutton.subwindow = 0;
1378 x_event.xbutton.time = lisp_event->timestamp;
1379 x_event.xbutton.x = EVENT_BUTTON_X (lisp_event);
1380 x_event.xbutton.y = EVENT_BUTTON_Y (lisp_event);
1381 if (Success == XGetWindowAttributes (x_event.xbutton.display,
1382 x_event.xbutton.window,
1383 &win_attrib))
1384 {
1385 x_event.xbutton.x_root = win_attrib.x + EVENT_BUTTON_X (lisp_event);
1386 x_event.xbutton.y_root = win_attrib.y + EVENT_BUTTON_Y (lisp_event);
1387 }
1388 else
1389 {
1390 x_event.xbutton.x_root = EVENT_BUTTON_X (lisp_event); /* this is wrong */
1391 x_event.xbutton.y_root = EVENT_BUTTON_Y (lisp_event);
1392 }
1393
1394 modifier = EVENT_BUTTON_MODIFIERS (lisp_event);
1395 if (modifier & XEMACS_MOD_SHIFT) state |= ShiftMask;
1396 if (modifier & XEMACS_MOD_CONTROL) state |= ControlMask;
1397 if (modifier & XEMACS_MOD_META) state |= xd->MetaMask;
1398 if (modifier & XEMACS_MOD_SUPER) state |= xd->SuperMask;
1399 if (modifier & XEMACS_MOD_HYPER) state |= xd->HyperMask;
1400 if (modifier & XEMACS_MOD_ALT) state |= xd->AltMask;
1401 state |= Button1Mask << (EVENT_BUTTON_BUTTON (lisp_event)-1);
1402
1403 x_event.xbutton.state = state;
1404 x_event.xbutton.button = EVENT_BUTTON_BUTTON (lisp_event);
1405 x_event.xkey.same_screen = True;
1406
1407 DndSetData(dnd_typ, (unsigned char *)dnd_data, dnd_len);
1408 if (dnd_dealloc)
1409 xfree (dnd_data, char *);
1410
1411 /* the next thing blocks everything... */
1412 if (DndHandleDragging(wid, &x_event))
1413 return Qt;
1414 }
1415 return Qnil; 1354 return Qnil;
1416 } 1355 }
1417 1356
1418 #endif /* HAVE_OFFIX_DND */ 1357 #endif /* HAVE_OFFIX_DND */
1419 1358
1514 int y = 0; 1453 int y = 0;
1515 unsigned int w = 80; 1454 unsigned int w = 80;
1516 unsigned int h = 40; 1455 unsigned int h = 40;
1517 int flags = 0; 1456 int flags = 0;
1518 1457
1519 char *geom = 0, *ew_geom = 0; 1458 Ascbyte *geom = 0, *ew_geom = 0;
1520 Boolean iconic_p = False, ew_iconic_p = False; 1459 Boolean iconic_p = False, ew_iconic_p = False;
1521 1460
1522 Widget wmshell = FRAME_X_SHELL_WIDGET (f); 1461 Widget wmshell = FRAME_X_SHELL_WIDGET (f);
1523 /* #### This may not be an ApplicationShell any more, with the 'popup 1462 /* #### This may not be an ApplicationShell any more, with the 'popup
1524 frame property. */ 1463 frame property. */
1844 int depth = DEVICE_X_DEPTH (d); 1783 int depth = DEVICE_X_DEPTH (d);
1845 Colormap cmap = DEVICE_X_COLORMAP (d); 1784 Colormap cmap = DEVICE_X_COLORMAP (d);
1846 #ifdef EXTERNAL_WIDGET 1785 #ifdef EXTERNAL_WIDGET
1847 Window window_id = 0; 1786 Window window_id = 0;
1848 #endif 1787 #endif
1849 const char *name; 1788 const Extbyte *name;
1850 Arg al [25]; 1789 Arg al[25];
1851 int ac = 0; 1790 int ac = 0;
1852 Widget text, container, shell; 1791 Widget text, container, shell;
1853 Widget parentwid = 0; 1792 Widget parentwid = 0;
1854 #ifdef HAVE_MENUBARS 1793 #ifdef HAVE_MENUBARS
1855 int menubar_visible; 1794 int menubar_visible;
1877 the shell) is also called that. So we just set the WM_CLASS property. 1816 the shell) is also called that. So we just set the WM_CLASS property.
1878 */ 1817 */
1879 1818
1880 #ifndef EXTERNAL_WIDGET 1819 #ifndef EXTERNAL_WIDGET
1881 if (!NILP (lisp_window_id)) 1820 if (!NILP (lisp_window_id))
1882 signal_error (Qunimplemented, "support for external widgets was not enabled at compile-time", Qunbound); 1821 signal_error
1822 (Qunimplemented,
1823 "support for external widgets was not enabled at compile-time",
1824 Qunbound);
1883 #else 1825 #else
1884 if (!NILP (lisp_window_id)) 1826 if (!NILP (lisp_window_id))
1885 { 1827 {
1886 char *string; 1828 Ibyte *string;
1887 1829
1888 CHECK_STRING (lisp_window_id); 1830 CHECK_STRING (lisp_window_id);
1889 string = (char *) XSTRING_DATA (lisp_window_id); 1831 string = XSTRING_DATA (lisp_window_id);
1890 if (string[0] == '0' && (string[1] == 'x' || string[1] == 'X')) 1832 if (string[0] == '0' && (string[1] == 'x' || string[1] == 'X'))
1891 sscanf (string+2, "%lxu", &window_id); 1833 qxesscanf_ascii_1 (string + 2, "%lxu", &window_id);
1892 #if 0 1834 #if 0
1893 else if (string[0] == 'w') 1835 else if (string[0] == 'w')
1894 { 1836 {
1895 sscanf (string+1, "%x", &parent_widget); 1837 qxesscanf_ascii (string + 1, "%x", &parent_widget);
1896 if (parent_widget) 1838 if (parent_widget)
1897 window_id = XtWindow (parent_widget); 1839 window_id = XtWindow (parent_widget);
1898 } 1840 }
1899 #endif 1841 #endif
1900 else 1842 else
1901 sscanf (string, "%lu", &window_id); 1843 qxesscanf_ascii_1 (string, "%lu", &window_id);
1902 if (!is_valid_window (window_id, d)) 1844 if (!is_valid_window (window_id, d))
1903 signal_ferror (Qinvalid_argument, "Invalid window %lu", 1845 signal_ferror (Qinvalid_argument, "Invalid window %lu",
1904 (unsigned long) window_id); 1846 (unsigned long) window_id);
1905 FRAME_X_EXTERNAL_WINDOW_P (f) = 1; 1847 FRAME_X_EXTERNAL_WINDOW_P (f) = 1;
1906 } else 1848 } else
2007 xemacs_XtPopup (Widget widget) 1949 xemacs_XtPopup (Widget widget)
2008 { 1950 {
2009 ShellWidget shell_widget = (ShellWidget) widget; 1951 ShellWidget shell_widget = (ShellWidget) widget;
2010 XtGrabKind call_data = XtGrabNone; 1952 XtGrabKind call_data = XtGrabNone;
2011 1953
2012 XtCallCallbacks (widget, XtNpopupCallback, (XtPointer)&call_data); 1954 XtCallCallbacks (widget, XtNpopupCallback, (XtPointer) &call_data);
2013 1955
2014 shell_widget->shell.popped_up = TRUE; 1956 shell_widget->shell.popped_up = TRUE;
2015 shell_widget->shell.grab_kind = XtGrabNone; 1957 shell_widget->shell.grab_kind = XtGrabNone;
2016 shell_widget->shell.spring_loaded = False; 1958 shell_widget->shell.spring_loaded = False;
2017 1959
2018 if (shell_widget->shell.create_popup_child_proc != NULL) 1960 if (shell_widget->shell.create_popup_child_proc != NULL)
2019 (*(shell_widget->shell.create_popup_child_proc))(widget); 1961 (*(shell_widget->shell.create_popup_child_proc)) (widget);
2020 1962
2021 /* The XtSetValues below are not in XtPopup menu. We just want to 1963 /* The XtSetValues below are not in XtPopup menu. We just want to
2022 make absolutely sure... */ 1964 make absolutely sure... */
2023 Xt_SET_VALUE (widget, XtNmappedWhenManaged, False); 1965 Xt_SET_VALUE (widget, XtNmappedWhenManaged, False);
2024 XtRealizeWidget (widget); 1966 XtRealizeWidget (widget);
2111 propertyNotify event so that the event_stream server timestamp will 2053 propertyNotify event so that the event_stream server timestamp will
2112 be initialized to something relevant to the time we created the window. 2054 be initialized to something relevant to the time we created the window.
2113 */ 2055 */
2114 XChangeProperty (XtDisplay (frame_widget), XtWindow (frame_widget), 2056 XChangeProperty (XtDisplay (frame_widget), XtWindow (frame_widget),
2115 DEVICE_XATOM_WM_PROTOCOLS (d), XA_ATOM, 32, PropModeAppend, 2057 DEVICE_XATOM_WM_PROTOCOLS (d), XA_ATOM, 32, PropModeAppend,
2116 (unsigned char*) NULL, 0); 2058 (Rawbyte *) NULL, 0);
2117 2059
2118 x_send_synthetic_mouse_event (f); 2060 x_send_synthetic_mouse_event (f);
2119 } 2061 }
2120 2062
2121 static void 2063 static void
2223 x_mask = 0; 2165 x_mask = 0;
2224 } 2166 }
2225 2167
2226 /* Store the X data into the widget. */ 2168 /* Store the X data into the widget. */
2227 { 2169 {
2228 Arg al [2]; 2170 Arg al[2];
2229 XtSetArg (al [0], XtNiconPixmap, x_pixmap); 2171 XtSetArg (al[0], XtNiconPixmap, x_pixmap);
2230 XtSetArg (al [1], XtNiconMask, x_mask); 2172 XtSetArg (al[1], XtNiconMask, x_mask);
2231 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2); 2173 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2);
2232 } 2174 }
2233 } 2175 }
2234 2176
2235 static void 2177 static void
2288 Display *dpy = XtDisplay (w); 2230 Display *dpy = XtDisplay (w);
2289 Dimension frame_w = DisplayWidth (dpy, DefaultScreen (dpy)); 2231 Dimension frame_w = DisplayWidth (dpy, DefaultScreen (dpy));
2290 Dimension frame_h = DisplayHeight (dpy, DefaultScreen (dpy)); 2232 Dimension frame_h = DisplayHeight (dpy, DefaultScreen (dpy));
2291 Dimension shell_w, shell_h, shell_bord; 2233 Dimension shell_w, shell_h, shell_bord;
2292 int win_gravity; 2234 int win_gravity;
2293 Arg al [3]; 2235 Arg al[3];
2294 2236
2295 XtSetArg (al [0], XtNwidth, &shell_w); 2237 XtSetArg (al[0], XtNwidth, &shell_w);
2296 XtSetArg (al [1], XtNheight, &shell_h); 2238 XtSetArg (al[1], XtNheight, &shell_h);
2297 XtSetArg (al [2], XtNborderWidth, &shell_bord); 2239 XtSetArg (al[2], XtNborderWidth, &shell_bord);
2298 XtGetValues (w, al, 3); 2240 XtGetValues (w, al, 3);
2299 2241
2300 win_gravity = 2242 win_gravity =
2301 xoff >= 0 && yoff >= 0 ? NorthWestGravity : 2243 xoff >= 0 && yoff >= 0 ? NorthWestGravity :
2302 xoff >= 0 ? SouthWestGravity : 2244 xoff >= 0 ? SouthWestGravity :
2309 2251
2310 /* Update the hints so that, if this window is currently iconified, it will 2252 /* Update the hints so that, if this window is currently iconified, it will
2311 come back at the right place. We can't look at s->visible to determine 2253 come back at the right place. We can't look at s->visible to determine
2312 whether it is iconified because it might not be up-to-date yet (the queue 2254 whether it is iconified because it might not be up-to-date yet (the queue
2313 might not be processed). */ 2255 might not be processed). */
2314 XtSetArg (al [0], XtNwinGravity, win_gravity); 2256 XtSetArg (al[0], XtNwinGravity, win_gravity);
2315 XtSetArg (al [1], XtNx, xoff); 2257 XtSetArg (al[1], XtNx, xoff);
2316 XtSetArg (al [2], XtNy, yoff); 2258 XtSetArg (al[2], XtNy, yoff);
2317 XtSetValues (w, al, 3); 2259 XtSetValues (w, al, 3);
2318 2260
2319 /* Sometimes you will find that 2261 /* Sometimes you will find that
2320 2262
2321 (set-frame-position (selected-frame) -50 -50) 2263 (set-frame-position (selected-frame) -50 -50)
2682 2624
2683 FRAME_X_SHELL_WIDGET (f) = 0; 2625 FRAME_X_SHELL_WIDGET (f) = 0;
2684 2626
2685 if (FRAME_X_GEOM_FREE_ME_PLEASE (f)) 2627 if (FRAME_X_GEOM_FREE_ME_PLEASE (f))
2686 { 2628 {
2687 xfree (FRAME_X_GEOM_FREE_ME_PLEASE (f), char *); 2629 xfree (FRAME_X_GEOM_FREE_ME_PLEASE (f), Ascbyte *);
2688 FRAME_X_GEOM_FREE_ME_PLEASE (f) = 0; 2630 FRAME_X_GEOM_FREE_ME_PLEASE (f) = 0;
2689 } 2631 }
2690 2632
2691 if (f->frame_data) 2633 if (f->frame_data)
2692 { 2634 {
2694 f->frame_data = 0; 2636 f->frame_data = 0;
2695 } 2637 }
2696 } 2638 }
2697 2639
2698 static void 2640 static void
2699 x_update_frame_external_traits (struct frame* frm, Lisp_Object name) 2641 x_update_frame_external_traits (struct frame *frm, Lisp_Object name)
2700 { 2642 {
2701 Arg al[10]; 2643 Arg al[10];
2702 int ac = 0; 2644 int ac = 0;
2703 Lisp_Object frame = wrap_frame (frm); 2645 Lisp_Object frame = wrap_frame (frm);
2704 2646