| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
#ifdef HAVE_CONFIG_H |
|---|
| 24 |
#include <config.h> |
|---|
| 25 |
#endif |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
#undef index |
|---|
| 32 |
#undef rindex |
|---|
| 33 |
|
|---|
| 34 |
#include "../src/lisp.h" |
|---|
| 35 |
|
|---|
| 36 |
#include <X11/Xatom.h> |
|---|
| 37 |
#include <X11/IntrinsicP.h> |
|---|
| 38 |
#include <X11/ObjectP.h> |
|---|
| 39 |
#include "lwlib-utils.h" |
|---|
| 40 |
#include "lwlib.h" |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
void |
|---|
| 44 |
XtNoClearRefreshWidget (widget) |
|---|
| 45 |
Widget widget; |
|---|
| 46 |
{ |
|---|
| 47 |
XEvent event; |
|---|
| 48 |
|
|---|
| 49 |
event.type = Expose; |
|---|
| 50 |
event.xexpose.serial = 0; |
|---|
| 51 |
event.xexpose.send_event = 0; |
|---|
| 52 |
event.xexpose.display = XtDisplay (widget); |
|---|
| 53 |
event.xexpose.window = XtWindow (widget); |
|---|
| 54 |
event.xexpose.x = 0; |
|---|
| 55 |
event.xexpose.y = 0; |
|---|
| 56 |
event.xexpose.width = widget->core.width; |
|---|
| 57 |
event.xexpose.height = widget->core.height; |
|---|
| 58 |
event.xexpose.count = 0; |
|---|
| 59 |
|
|---|
| 60 |
(*widget->core.widget_class->core_class.expose) |
|---|
| 61 |
(widget, &event, (Region)NULL); |
|---|
| 62 |
} |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
void |
|---|
| 69 |
XtApplyToWidgets (w, proc, arg) |
|---|
| 70 |
Widget w; |
|---|
| 71 |
XtApplyToWidgetsProc proc; |
|---|
| 72 |
XtPointer arg; |
|---|
| 73 |
{ |
|---|
| 74 |
if (XtIsComposite (w)) |
|---|
| 75 |
{ |
|---|
| 76 |
CompositeWidget cw = (CompositeWidget) w; |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
int nkids = cw->composite.num_children; |
|---|
| 81 |
Widget *kids = (Widget *) malloc (sizeof (Widget) * nkids); |
|---|
| 82 |
int i; |
|---|
| 83 |
lwlib_bcopy ((char *) cw->composite.children, (char *) kids, |
|---|
| 84 |
sizeof (Widget) * nkids); |
|---|
| 85 |
for (i = 0; i < nkids; i++) |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
{ |
|---|
| 89 |
|
|---|
| 90 |
XtApplyToWidgets (kids [i], proc, arg); |
|---|
| 91 |
proc (kids [i], arg); |
|---|
| 92 |
} |
|---|
| 93 |
free (kids); |
|---|
| 94 |
} |
|---|
| 95 |
} |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
void * |
|---|
| 103 |
XtApplyUntilToWidgets (w, proc, arg) |
|---|
| 104 |
Widget w; |
|---|
| 105 |
XtApplyUntilToWidgetsProc proc; |
|---|
| 106 |
XtPointer arg; |
|---|
| 107 |
{ |
|---|
| 108 |
void* result; |
|---|
| 109 |
if (XtIsComposite (w)) |
|---|
| 110 |
{ |
|---|
| 111 |
CompositeWidget cw = (CompositeWidget)w; |
|---|
| 112 |
int i; |
|---|
| 113 |
for (i = 0; i < cw->composite.num_children; i++) |
|---|
| 114 |
if (XtIsWidget (cw->composite.children [i])){ |
|---|
| 115 |
result = proc (cw->composite.children [i], arg); |
|---|
| 116 |
if (result) |
|---|
| 117 |
return result; |
|---|
| 118 |
result = XtApplyUntilToWidgets (cw->composite.children [i], proc, |
|---|
| 119 |
arg); |
|---|
| 120 |
if (result) |
|---|
| 121 |
return result; |
|---|
| 122 |
} |
|---|
| 123 |
} |
|---|
| 124 |
return NULL; |
|---|
| 125 |
} |
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
Widget * |
|---|
| 132 |
XtCompositeChildren (widget, number) |
|---|
| 133 |
Widget widget; |
|---|
| 134 |
unsigned int* number; |
|---|
| 135 |
{ |
|---|
| 136 |
CompositeWidget cw = (CompositeWidget)widget; |
|---|
| 137 |
Widget* result; |
|---|
| 138 |
int n; |
|---|
| 139 |
int i; |
|---|
| 140 |
|
|---|
| 141 |
if (!XtIsComposite (widget)) |
|---|
| 142 |
{ |
|---|
| 143 |
*number = 0; |
|---|
| 144 |
return NULL; |
|---|
| 145 |
} |
|---|
| 146 |
n = cw->composite.num_children; |
|---|
| 147 |
result = (Widget*)XtMalloc (n * sizeof (Widget)); |
|---|
| 148 |
*number = n; |
|---|
| 149 |
for (i = 0; i < n; i++) |
|---|
| 150 |
result [i] = cw->composite.children [i]; |
|---|
| 151 |
return result; |
|---|
| 152 |
} |
|---|
| 153 |
|
|---|
| 154 |
Boolean |
|---|
| 155 |
XtWidgetBeingDestroyedP (widget) |
|---|
| 156 |
Widget widget; |
|---|
| 157 |
{ |
|---|
| 158 |
return widget->core.being_destroyed; |
|---|
| 159 |
} |
|---|
| 160 |
|
|---|
| 161 |
void |
|---|
| 162 |
XtSafelyDestroyWidget (widget) |
|---|
| 163 |
Widget widget; |
|---|
| 164 |
{ |
|---|
| 165 |
#if 0 |
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
XtAppContext app = XtWidgetToApplicationContext(widget); |
|---|
| 170 |
|
|---|
| 171 |
if (app->dispatch_level == 0) |
|---|
| 172 |
{ |
|---|
| 173 |
app->dispatch_level = 1; |
|---|
| 174 |
XtDestroyWidget (widget); |
|---|
| 175 |
|
|---|
| 176 |
XChangeProperty (XtDisplay (widget), XtWindow (widget), |
|---|
| 177 |
XA_STRING, XA_STRING, 32, PropModeAppend, NULL, 0); |
|---|
| 178 |
app->dispatch_level = 0; |
|---|
| 179 |
} |
|---|
| 180 |
else |
|---|
| 181 |
XtDestroyWidget (widget); |
|---|
| 182 |
|
|---|
| 183 |
#else |
|---|
| 184 |
abort (); |
|---|
| 185 |
#endif |
|---|
| 186 |
} |
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
|
|---|