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