#include <X11/Intrinsic.h>#include <X11/Xfuncproto.h>Include dependency graph for StdSel.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| _XFUNCPROTOBEGIN Boolean | XmuConvertStandardSelection (Widget w, Time timev, Atom *selection, Atom *target, Atom *type_return, XPointer *value_return, unsigned long *length_return, int *format_return) |
| _XFUNCPROTOBEGIN Boolean XmuConvertStandardSelection | ( | Widget | w, | |
| Time | timev, | |||
| Atom * | selection, | |||
| Atom * | target, | |||
| Atom * | type_return, | |||
| XPointer * | value_return, | |||
| unsigned long * | length_return, | |||
| int * | format_return | |||
| ) |
Definition at line 190 of file CvtStdSel.c.
References get_os_name(), getenv(), i, isApplicationShell(), len, name, NULL, NUM_TARGETS, void(), XA_CLASS, XA_CLIENT_WINDOW, XA_DECNET_ADDRESS, XA_HOSTNAME, XA_IP_ADDRESS, XA_NAME, XA_NET_ADDRESS, XA_OWNER_OS, XA_TARGETS, XA_TIMESTAMP, XA_USER, and XmuGetHostname().
Referenced by ConvertSelection().
00193 { 00194 Display *d = XtDisplay(w); 00195 if (*target == XA_TIMESTAMP(d)) { 00196 *value = XtMalloc(4); 00197 if (sizeof(long) == 4) 00198 *(long*)*value = time; 00199 else { 00200 long temp = time; 00201 (void) memmove((char*)*value, ((char*)&temp)+sizeof(long)-4, 4); 00202 } 00203 *type = XA_INTEGER; 00204 *length = 1; 00205 *format = 32; 00206 return True; 00207 } 00208 if (*target == XA_HOSTNAME(d)) { 00209 char hostname[1024]; 00210 hostname[0] = '\0'; 00211 *length = XmuGetHostname (hostname, sizeof hostname); 00212 *value = XtNewString(hostname); 00213 *type = XA_STRING; 00214 *format = 8; 00215 return True; 00216 } 00217 #if defined(TCPCONN) 00218 if (*target == XA_IP_ADDRESS(d)) { 00219 char hostname[1024]; 00220 #ifdef XTHREADS_NEEDS_BYNAMEPARAMS 00221 _Xgethostbynameparams hparams; 00222 #endif 00223 struct hostent *hostp; 00224 00225 hostname[0] = '\0'; 00226 (void) XmuGetHostname (hostname, sizeof hostname); 00227 00228 if ((hostp = _XGethostbyname (hostname,hparams)) == NULL) 00229 return False; 00230 00231 if (hostp->h_addrtype != AF_INET) return False; 00232 *length = hostp->h_length; 00233 *value = XtMalloc(*length); 00234 (void) memmove (*value, hostp->h_addr, *length); 00235 *type = XA_NET_ADDRESS(d); 00236 *format = 8; 00237 return True; 00238 } 00239 #endif 00240 #ifdef DNETCONN 00241 if (*target == XA_DECNET_ADDRESS(d)) { 00242 return False; /* XXX niy */ 00243 } 00244 #endif 00245 if (*target == XA_USER(d)) { 00246 char *name = (char*)getenv("USER"); 00247 if (name == NULL) return False; 00248 *value = XtNewString(name); 00249 *type = XA_STRING; 00250 *length = strlen(name); 00251 *format = 8; 00252 return True; 00253 } 00254 if (*target == XA_CLASS(d)) { 00255 Widget parent = XtParent(w); 00256 char *class; 00257 int len; 00258 while (parent != NULL && !isApplicationShell(w)) { 00259 w = parent; 00260 parent = XtParent(w); 00261 } 00262 if (isApplicationShell(w)) 00263 class = ((ApplicationShellWidget) w)->application.class; 00264 else 00265 class = XtClass(w)->core_class.class_name; 00266 *length = (len=strlen(w->core.name)) + strlen(class) + 2; 00267 *value = XtMalloc(*length); 00268 strcpy( (char*)*value, w->core.name ); 00269 strcpy( (char*)*value+len+1, class ); 00270 *type = XA_STRING; 00271 *format = 8; 00272 return True; 00273 } 00274 if (*target == XA_NAME(d)) { 00275 Widget parent = XtParent(w); 00276 00277 while (parent != NULL && !XtIsWMShell(w)) { 00278 w = parent; 00279 parent = XtParent(w); 00280 } 00281 if (!XtIsWMShell(w)) return False; 00282 *value = XtNewString( ((WMShellWidget) w)->wm.title ); 00283 *length = strlen(*value); 00284 *type = XA_STRING; 00285 *format = 8; 00286 return True; 00287 } 00288 if (*target == XA_CLIENT_WINDOW(d)) { 00289 Widget parent = XtParent(w); 00290 while (parent != NULL) { 00291 w = parent; 00292 parent = XtParent(w); 00293 } 00294 *value = XtMalloc(sizeof(Window)); 00295 *(Window*)*value = w->core.window; 00296 *type = XA_WINDOW; 00297 *length = 1; 00298 *format = 32; 00299 return True; 00300 } 00301 if (*target == XA_OWNER_OS(d)) { 00302 *value = get_os_name(); 00303 if (*value == NULL) return False; 00304 *type = XA_STRING; 00305 *length = strlen(*value); 00306 *format = 8; 00307 return True; 00308 } 00309 if (*target == XA_TARGETS(d)) { 00310 #if defined(unix) && defined(DNETCONN) 00311 # define NUM_TARGETS 9 00312 #else 00313 # if defined(unix) || defined(DNETCONN) 00314 # define NUM_TARGETS 8 00315 # else 00316 # define NUM_TARGETS 7 00317 # endif 00318 #endif 00319 Atom* std_targets = (Atom*)XtMalloc(NUM_TARGETS*sizeof(Atom)); 00320 int i = 0; 00321 std_targets[i++] = XA_TIMESTAMP(d); 00322 std_targets[i++] = XA_HOSTNAME(d); 00323 std_targets[i++] = XA_IP_ADDRESS(d); 00324 std_targets[i++] = XA_USER(d); 00325 std_targets[i++] = XA_CLASS(d); 00326 std_targets[i++] = XA_NAME(d); 00327 std_targets[i++] = XA_CLIENT_WINDOW(d); 00328 #ifdef unix 00329 std_targets[i++] = XA_OWNER_OS(d); 00330 #endif 00331 #ifdef DNETCONN 00332 std_targets[i++] = XA_DECNET_ADDRESS(d); 00333 #endif 00334 *value = (XPointer)std_targets; 00335 *type = XA_ATOM; 00336 *length = NUM_TARGETS; 00337 *format = 32; 00338 return True; 00339 } 00340 /* else */ 00341 return False; 00342 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.5.1