home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / src / extw-Xlib.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-29  |  2.4 KB  |  85 lines

  1. /* Common code between client and shell widgets; not Xt-specific.
  2.    Copyright (C) 1993, 1994 Sun Microsystems, Inc.
  3.  
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8.  
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free
  16. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
  17.  
  18. /* Synched up with: Not in FSF. */
  19.  
  20. /* Written by Ben Wing, September 1993. */
  21.  
  22. #ifdef emacs
  23.  
  24. #include <config.h>
  25.  
  26. #ifndef EXTERNAL_WIDGET
  27. ERROR!  This ought not be getting compiled if EXTERNAL_WIDGET is undefined
  28. #endif
  29.  
  30. #endif
  31.  
  32. #include <X11/Xlib.h>
  33. #include "extw-Xlib.h"
  34.  
  35. int extw_which_side;
  36.  
  37. static int atoms_initialized;
  38. Atom a_EXTW_QUERY_GEOMETRY, a_EXTW_GEOMETRY_MANAGER, a_EXTW_WIDGET_GEOMETRY,
  39.      a_EXTW_NOTIFY;
  40.  
  41. void
  42. extw_initialize_atoms(Display *display)
  43. {
  44.   if (!atoms_initialized) {
  45.     a_EXTW_QUERY_GEOMETRY =
  46.       XInternAtom(display, "EXTW_QUERY_GEOMETRY", False);
  47.     a_EXTW_GEOMETRY_MANAGER =
  48.       XInternAtom(display, "EXTW_GEOMETRY_MANAGER", False);
  49.     a_EXTW_WIDGET_GEOMETRY =
  50.       XInternAtom(display, "EXTW_WIDGET_GEOMETRY", False);
  51.     a_EXTW_NOTIFY =
  52.       XInternAtom(display, "EXTW_NOTIFY", False);
  53.     atoms_initialized = 1;
  54.   }
  55.  
  56. }
  57.  
  58. /* send a notification to the other-side widget. */
  59.  
  60. void
  61. extw_send_notify_3(Display *display, Window win, en_extw_notify type,
  62.            long data0, long data1, long data2)
  63. {
  64.   XClientMessageEvent xev;
  65.   
  66.   xev.type = ClientMessage;
  67.   xev.message_type = a_EXTW_NOTIFY;
  68.   xev.format = 32;
  69.   xev.display = display;
  70.   xev.window = win;
  71.   xev.data.l[0] = extw_which_side;
  72.   xev.data.l[1] = type;
  73.   xev.data.l[2] = data0;
  74.   xev.data.l[3] = data1;
  75.   xev.data.l[4] = data2;
  76.  
  77.   /* UGGGHHHH!  All I want to do is ensure that the ClientMessage gets
  78.      received.  Unfortunately X doesn't provide any simple way to do
  79.      that but instead has this event_mask bogosity in XSendEvent. */
  80.  
  81.   XSendEvent(display, win, False,
  82.          extw_which_side == extw_shell_send ? 0 : StructureNotifyMask,
  83.          (XEvent *) &xev);
  84. }
  85.