Example #1
0
static XEN g_window_property(XEN winat, XEN name)
{
  #define H_window_property "(" S_window_property " win-name name): get or set the window property."
  Window window;
  Display *dpy;
  Atom type = None;
  int format;
  unsigned long len, bytesafter;
  unsigned char *data[1];
  XEN result = XEN_FALSE;
  XEN_ASSERT_TYPE(XEN_STRING_P(winat), winat, XEN_ARG_1, S_window_property, "a string");
  XEN_ASSERT_TYPE(XEN_STRING_P(name), name, XEN_ARG_2, S_window_property, "a string");
  dpy = MAIN_DISPLAY(ss);
  if (((window = find_window(dpy, DefaultRootWindow(dpy), XEN_TO_C_STRING(winat), compare_window))) &&
      ((XGetWindowProperty(dpy, window, 
			   XInternAtom(dpy, XEN_TO_C_STRING(name), 0), 
			   0L, (long)BUFSIZ, False, 
			   XA_STRING, &type, &format, &len, &bytesafter,
			   (unsigned char **)data)) == Success) &&
      (type != None) &&
      (len > 0))
    {
      if (type == XA_STRING)
	result = C_TO_XEN_STRING((char *)data[0]);
      else result = C_TO_XEN_STRINGN((char *)data[0], len * format / 8); 
      if (data[0]) 
	XFree((char *)(data[0]));
    }
  return(result);
}
Example #2
0
XEN rb_set_documentation(XEN name, XEN help)
{
  XEN_ASSERT_TYPE((XEN_STRING_P(name) || XEN_SYMBOL_P(name)), name, XEN_ARG_1, S_add_help, "a char* or symbol");
  XEN_ASSERT_TYPE(XEN_STRING_P(help), help, XEN_ARG_2, S_add_help, "a char*");
  if (XEN_SYMBOL_P(name))
    rb_set_property(XEN_SYMBOL_TO_STRING(name), XEN_DOCUMENTATION_SYMBOL, help);
  else
    rb_set_property(name, XEN_DOCUMENTATION_SYMBOL, help);
  return(name);
}
Example #3
0
static XEN g_set_window_property(XEN winat, XEN name, XEN command)
{
  char *c = NULL;
  /* winat arg needed as well as command arg because we need an atom that is guaranteed to have a value */
  /*   Supposedly WM_STATE is just such an atom */
  XEN_ASSERT_TYPE(XEN_STRING_P(winat), name, XEN_ARG_1, S_setB S_window_property, "a string");
  XEN_ASSERT_TYPE(XEN_STRING_P(name), name, XEN_ARG_2, S_setB S_window_property, "a string");
  if (XEN_STRING_P(command))
    c = copy_string(XEN_TO_C_STRING(command));
  else c = g_print_1(command);
  change_window_property(XEN_TO_C_STRING(winat), XEN_TO_C_STRING(name), c);
  if (c) FREE(c);
  return(XEN_FALSE);
}
Example #4
0
static XEN g_send_mozilla(XEN cmd)
{
  #define H_send_mozilla "(" S_send_mozilla " cmd): find an html-reader (or start it if necessary), and send it the \
string 'cmd'.  cmd should be a URL."
  XEN_ASSERT_TYPE(XEN_STRING_P(cmd), cmd, XEN_ONLY_ARG, S_send_mozilla, "a string");
  return(C_TO_XEN_BOOLEAN(send_mozilla(html_program(ss), XEN_TO_C_STRING(cmd))));
}
Example #5
0
XEN rb_documentation(XEN name)
{
  XEN_ASSERT_TYPE((XEN_STRING_P(name) || XEN_SYMBOL_P(name)), name, XEN_ONLY_ARG, S_get_help, "a char* or symbol");
  if (XEN_SYMBOL_P(name))
    return(rb_property(XEN_SYMBOL_TO_STRING(name), XEN_DOCUMENTATION_SYMBOL));
  else
    return(rb_property(name, XEN_DOCUMENTATION_SYMBOL));
}
Example #6
0
static XEN g_find_dialog(XEN managed, XEN text)
{
  #define H_find_dialog "(" S_find_dialog " :optional managed text): create and activate the Edit:Find dialog, return the dialog widget. \
If 'text' is included, it is preloaded into the find dialog text widget."
  XEN_ASSERT_TYPE(XEN_BOOLEAN_IF_BOUND_P(managed), managed, XEN_ARG_1, S_find_dialog, "a boolean");
  XEN_ASSERT_TYPE(XEN_STRING_IF_BOUND_P(text), text, XEN_ARG_2, S_find_dialog, "a string");
  make_edit_find_dialog(XEN_TO_C_BOOLEAN(managed));
  if ((edit_find_text) && (XEN_STRING_P(text)))
    XmTextSetString(edit_find_text, (char *)XEN_TO_C_STRING(text));
  return(XEN_WRAP_WIDGET(edit_find_dialog));
}
Example #7
0
File: midi.c Project: huangjs/cl
static XEN g_mus_midi_open_write(XEN name)
{
  #define H_mus_midi_open_write "(" S_mus_midi_open_write " name): opens midi output port, returns int id"
  XEN_ASSERT_TYPE(XEN_STRING_P(name), name, XEN_ONLY_ARG, S_mus_midi_open_write, "a string");
  return(C_TO_XEN_INT(mus_midi_open_write(XEN_TO_C_STRING(name))));
}