Ejemplo n.º 1
0
gboolean GN_widget_get_attr(int ARI, ei_x_buff *XBUF, char *B, int *I) {
  gchar attr[MAXATOMLEN+1];
  GtkWidget* widget;

  if ( ! gn_check_arity(XBUF, 2, ARI) ) return FALSE;
  if ( ! gn_get_arg_object(XBUF, B, I, GTK_TYPE_WIDGET, (GObject**)&widget) )
    return FALSE;
  if ( ! gn_get_arg_gchar_fix(XBUF, B, I, attr) ) return FALSE;

  if ( strcmp("window",attr) == 0 ){
    gn_put_object(XBUF,(GObject*) widget->window);
  }else if ( strcmp("x",attr) == 0 ) {
    gn_put_longlong(XBUF,(long long)widget->allocation.x);
  }else if ( strcmp("y",attr) == 0 ) {
    gn_put_longlong(XBUF,(long long)widget->allocation.y);
  }else if ( strcmp("width",attr) == 0 ) {
    gn_put_longlong(XBUF,(long long)widget->allocation.width);
  }else if ( strcmp("height",attr) == 0 ) {
    gn_put_longlong(XBUF,(long long)widget->allocation.height);
  }else{
    gn_enc_2_error(XBUF, "no_such_attr");
    ei_x_encode_atom(XBUF, attr);
    return FALSE;
  }
  return TRUE;
}
Ejemplo n.º 2
0
static gboolean get_fpointer(char *cmd, ei_x_buff *xbuf, gpointer* poi) {
  extern GModule* gmod;
  
  if ( ! g_module_supported() ) g_critical("gtkNode requires working gmodule");
  
  if ( ! gmod ) gmod = g_module_open(NULL,0); /* "gtknode_gtk.so" */
  
  if ( g_module_symbol(gmod, cmd, poi) ) return TRUE;
  
  g_warning("could not find '%s'.", cmd);
  gn_enc_2_error(xbuf, "no_such_function");
  ei_x_encode_atom(xbuf, cmd);
  return FALSE;
}