Atom * WSMGetTargetList(Widget w, Boolean include_defaults, unsigned long *len_ret) { WSMDispInfo *disp_info = _WSMGetDispInfo(XtDisplay(w)); register int i; Atom *list; *len_ret = NUM_WSM_TARGETS; if (include_defaults) *len_ret += NUM_EXTRA_TARGETS; list = (Atom *) XtMalloc(sizeof(Atom) * (*len_ret)); i = 0; list[i++] = disp_info->connect; list[i++] = disp_info->extensions; list[i++] = disp_info->config_fmt; list[i++] = disp_info->get_state; list[i++] = disp_info->set_state; list[i++] = disp_info->reg_window; list[i++] = disp_info->get_background; list[i++] = disp_info->set_background; list[i++] = disp_info->wm_windows; list[i++] = disp_info->wm_focus; list[i++] = disp_info->wm_pointer; if (include_defaults) { list[i++] = disp_info->targets; list[i++] = disp_info->multiple; list[i++] = disp_info->timestamp; } return(list); }
Boolean WSMIsKnownTarget(Widget w, Atom target) { WSMDispInfo * disp_info = _WSMGetDispInfo(XtDisplay(w)); /* * Can't switch on dynamic data, sigh... */ if (disp_info->connect == target) return(True); if (disp_info->extensions == target) return(True); if (disp_info->config_fmt == target) return(True); if (disp_info->get_state == target) return(True); if (disp_info->set_state == target) return(True); if (disp_info->reg_window == target) return(True); if (disp_info->get_background == target) return(True); if (disp_info->set_background == target) return(True); if (disp_info->wm_windows == target) return(True); if (disp_info->wm_focus == target) return(True); if (disp_info->wm_pointer == target) return(True); return(False); }
void _WSMClearConfigScreenInfo(Display *dpy, int screen_number) { WSMDispInfo * disp_info = _WSMGetDispInfo(dpy); WSMScreenInfo *screen_info; if (disp_info->screen_info != NULL) { screen_info = disp_info->screen_info; /* * Hunt through the screen info structs on this display until we * find one that matches the screen num passed. */ while (True) { if (screen_info->screen_num == screen_number) break; if (screen_info->next == NULL) return; screen_info = screen_info->next; } if (screen_info->global.num_attrs != 0) { XtFree((XtPointer)screen_info->global.attr_list); screen_info->global.num_attrs = 0; } if (screen_info->window.num_attrs != 0) { XtFree((XtPointer)screen_info->window.attr_list); screen_info->window.num_attrs = 0; } if (screen_info->icon.num_attrs != 0) { XtFree((XtPointer)screen_info->icon.attr_list); screen_info->icon.num_attrs = 0; } } }
/*ARGSUSED*/ static Boolean ConvertProc(Widget w, Atom *selection, Atom *target, XtPointer input, unsigned long input_len, int input_fmt, Atom *return_type, XtPointer *output, unsigned long *output_len, int *output_fmt) { WSMDispInfo *disp_info; /* set up some defaults. selection code doesn't like garbage! */ *output = NULL; *output_len = 0; *output_fmt = 8; disp_info = _WSMGetDispInfo(XtDisplay(w)); /* * Since this function is only registered for one selection, I am going * to assume that the intrinsics didn't give me the wrong thing. */ if (*target == disp_info->targets) { *return_type = XA_STRING; *output = (XtPointer) WSMGetTargetList(w, TRUE, output_len); *output_fmt = 32; return(True); } /* * Intrinsics will handle MULTIPLE and TIMESTAMP for me. */ if (WSMProcessProtoTarget(w, *target, input, input_len, input_fmt, return_type, output, output_len, output_fmt)) { return(TRUE); } return(False); /* unknown type, returning... */ }
WSMScreenInfo * _WSMGetScreenInfo(Display *dpy, int screen_number) { WSMDispInfo * disp_info = _WSMGetDispInfo(dpy); WSMScreenInfo *screen_info; char temp[BUFSIZ]; if (disp_info->screen_info == NULL) { /* * Didn't find any screen info on this display, allocate it * and then drop down to the code below that fills in the data. */ screen_info = (WSMScreenInfo *) XtMalloc(sizeof(WSMScreenInfo)); disp_info->screen_info = screen_info; } else { screen_info = disp_info->screen_info; /* * Hunt through the screen info structs on this display until we * find one that matches the screen num passed. If we don't find * one then allocate a new one, put it on the end of the list and * drop into the code below that fills in the data. */ while (True) { if (screen_info->screen_num == screen_number) return(screen_info); if (screen_info->next == NULL) break; screen_info = screen_info->next; } /* * This screen is not on the display's screen list, add it. */ screen_info->next = (WSMScreenInfo *) XtMalloc(sizeof(WSMScreenInfo)); screen_info = screen_info->next; } screen_info->screen_num = screen_number; sprintf(temp, WM_SELECTION_FORMAT, screen_number); screen_info->wm_selection = XInternAtom(dpy, temp, False); sprintf(temp, WSM_SELECTION_FORMAT, screen_number); screen_info->wsm_selection = XInternAtom(dpy, temp, False); screen_info->next = NULL; screen_info->global.num_attrs = 0; screen_info->window.num_attrs = 0; screen_info->icon.num_attrs = 0; screen_info->request_callback = NULL; screen_info->request_data = NULL; return(screen_info); }