Exemple #1
0
tdb_t TDBcreate(int id, file_t file, channel_t channel) {
      tdb_t tdb = (tdb_t) calloc(1, sizeof(tdb_r));
      if (tdb==NULL) { 
           mkerror(ERR_NULL,"failed calloc(size = %d)",sizeof(tdb_r));
           return NULL;
           }
      timer = createTimer();
      // printmsg("TDBcreate: %d %lx %s", id, file, dir);
      tdb->type = TDB; tdb->role = SERVER;
      tdb->db = ATindexedSetCreate(tdb_size, 75);
      if (tdb->db==NULL) { 
          mkerror(ERR_NULL,
          "failed indexedSetCreate(size = %d)", tdb_size); 
          return NULL;
          } 
      tdb->file = file;
      tdb->count = tdb->last = 0; 
      tdb->minMsgTime = 1000.0;
      tdb->id = id;
#ifdef LINUX
      if (channel) {
          if (!tdb->file) tdb->role = CLIENT;
          tdb->channel.r = channel->r;
          tdb->channel.w = channel->w;
          }
#endif
      if (tdb->file) TDBread(tdb);
      return tdb;              
      }
Exemple #2
0
g_error panel_set(struct widget *self,int property, glob data) {
  struct widget *w;
  g_error e;
  struct app_info **app;

  switch (property) {

  case PG_WP_SIZE:
    /* Alias 0 to our minimum rolled-up size */
    e = rdhandle((void **) &w, PG_TYPE_WIDGET, self->owner, DATA->hbar);
    errorcheck;
    if (data==0)
      data = w->in->split;
    widget_base_set(self,property,data);
    break;

  case PG_WP_SIDE:
    e = rdhandle((void **) &w, PG_TYPE_WIDGET, self->owner, DATA->hbar);
    errorcheck;
    switch (data) {    /* Invert the side for the panelbar */
    case PG_S_TOP:    widget_set(w,PG_WP_SIDE,PG_S_BOTTOM); break;
    case PG_S_BOTTOM: widget_set(w,PG_WP_SIDE,PG_S_TOP);    break;
    case PG_S_LEFT:   widget_set(w,PG_WP_SIDE,PG_S_RIGHT);  break;
    case PG_S_RIGHT:  widget_set(w,PG_WP_SIDE,PG_S_LEFT);   break;
    }
    return mkerror(ERRT_PASS,0);

  case PG_WP_THOBJ:
    DATA->bg->state = data;
    resizewidget(self);
    self->in->flags |= DIVNODE_NEED_RECALC;
    self->dt->flags |= DIVTREE_NEED_RECALC;
    break;
    
  case PG_WP_TEXT:
    e = rdhandle((void **) &w, PG_TYPE_WIDGET, self->owner, DATA->hlabel);
    errorcheck;
    app = appmgr_findapp(self);
    if (app && *app)
      (*app)->name = data;
    return widget_set(w,property,data);

  case PG_WP_IMAGE:
    e = rdhandle((void **) &w, PG_TYPE_WIDGET, self->owner, DATA->hlabel);
    errorcheck;
    return widget_set(w,property,data);

  case PG_WP_MARGIN:
    DATA->margin = data;
    DATA->margin_override = data >= 0;
    resizewidget(self);
    break;

  default:
    return mkerror(ERRT_PASS,0);

  }
  return success;
}
Exemple #3
0
/* Gets a pointer to the handle's payload, stores it in the variable
 * pointed to by pppayload
 */
g_error handle_payload(u32 **pppayload,int owner,handle h) {
  struct handlenode *n = htree_find(h);
  if (!n) return mkerror(PG_ERRT_HANDLE,26);
  if (owner>=0 && n->owner != owner) 
    return mkerror(PG_ERRT_HANDLE,27);
  *pppayload = &n->payload;
  return success;
}
Exemple #4
0
/*
 * Change the context of an existing handle by 'delta'.
 * Can be positive or negative
 */
g_error handle_chcontext(handle h, int owner, s16 delta) {
  struct handlenode *n = htree_find(h);
  if (!n) return mkerror(PG_ERRT_HANDLE,26);
  if (owner>=0 && n->owner != owner) 
    return mkerror(PG_ERRT_HANDLE,27);
  n->context += delta;
  return success;
}
Exemple #5
0
/* Group a handle with the theme containing it. Puts the 'to' handle in the
 * group of the theme 'from'.
 * 
 * Also sets the owner of 'to' to new_owner. The theme code uses this
 * to set the handle's owner to -1 so it can be read by anyone.
 * FIXME: We need real handle permissions
 */
g_error handle_group(int owner,handle from, handle to, int new_owner) {
  /* First, validate both handles */
  struct handlenode *f = htree_find(from);
  struct handlenode *t = htree_find(to);
  if (!(f && t && from && to)) return mkerror(PG_ERRT_HANDLE,92);
  if (owner>=0 && ((t->owner != owner) || (f->owner !=owner))) 
    return mkerror(PG_ERRT_HANDLE,27);
  t->group = f->id;
  t->owner = new_owner;
  return success;
}
Exemple #6
0
g_error bmp_load(hwrbitmap *hbmp, const u8 *data, u32 datalen) {
  struct bmp_fileheader *fhdr;
  struct bmp_infoheader *ihdr;
  int w,h,bpp;
  const u8 *rasterdata, *linebegin;
  g_error e;
  u32 offset, compression, numcolors, *u32p;
  int x,y,shift,mask,index;
  u8 byte;
  pgcolor c, c2, colortable[MAXPALETTE];
#ifdef CONFIG_DITHER
  hwrdither dither;
#endif

  /* Load the headers. Fileheader is after "BM", infoheader is after that */
  if (datalen < FILEHEADER_LEN + INFOHEADER_LEN)
    return mkerror(PG_ERRT_BADPARAM,41);      /* Corrupt BMP header */
  fhdr = (struct bmp_fileheader *) (data + 2);
  ihdr = (struct bmp_infoheader *) (data + FILEHEADER_LEN);

  /* Important header values */
  w = LITTLE_LONG(ihdr->width);
  h = LITTLE_LONG(ihdr->height);
  bpp = LITTLE_SHORT(ihdr->bpp);
  compression = LITTLE_LONG(ihdr->compression);
  numcolors = LITTLE_LONG(ihdr->colors_used);
  offset = LITTLE_LONG(fhdr->data_offset);
  if(!numcolors)
   {
    numcolors=(offset-FILEHEADER_LEN-INFOHEADER_LEN)>>2;
    if(numcolors>1<<bpp)
      numcolors=1<<bpp;
   }
Exemple #7
0
/* Deletes the handle, and if HFLAG_NFREE is not set it frees the object */
g_error handle_free(int owner,handle h) {
  struct handlenode *n = htree_find(h);
  struct handlenode ncopy;

#ifdef DEBUG_MEMORY
  printf("handle_free(%d,0x%08X): node=%p\n",owner,h,n);
#endif

  /* Already gone - don't complain */
  if (!h) return success;
  if (!n) return success;

  if (owner>=0 && n->owner != owner) 
    return mkerror(PG_ERRT_HANDLE,27);

  /* Remove from the handle tree BEFORE deleting the object itself */
  ncopy = *n;
  htree_delete(n);
  object_free(&ncopy);

  /* See if this node had any group members that need to be expunged */
  while (r_handle_cleanup(htree,-1,-1,ncopy.id));

  return success;
}
Exemple #8
0
g_error commandline_help(void) {
#ifdef CONFIG_TEXT
  puts("\n"
       "PicoGUI Server (http://picogui.org)\n"
       "Version " PGSERVER_VERSION_STRING
#ifdef DEBUG_ANY
       " debug"
#endif
       "\n\n"
       "usage: pgserver [-hln] [-c configfile] [-v driver] [-m WxHxD]\n"
       "                [--section.key=value] [--key=value] [--key]\n"
       "                [-i driver] [-t theme] [-s \"session manager\"]\n"
       "\n"
       "  h : This help message\n"
       "  l : List installed drivers and fonts\n"
       "  n : Ignore existing configuration data\n"
       "\n"
       "  c conf    : Load a configuration file\n"
       "  v driver  : Set the video driver (see -l)\n"
       "  m WxHxD   : Set the video mode resolution and color depth\n"
       "  i driver  : Load an input driver, can use more than one (see -l)\n"
       "  t theme   : Load a compiled theme file, can use more than one\n"
       "\n"
       "  Configuration options may be specified with section, key, and value.\n"
       "  If the section is omitted, 'pgserver' is assumed. If the value is\n"
       "  missing, '1' is used.\n"
       "\n"
       "  If specified, a session manager process will be run after server\n"
       "  initialization is done, and the server will quit after the last\n"
       "  client disconencts.\n");
#endif /* CONFIG_TEXT */
  
  return mkerror(PG_ERRT_BADPARAM, 144);   /* Badly formed command line */
}
Exemple #9
0
g_error widget_create(struct widget **w, handle *h, int type, 
		      struct divtree *dt, handle container, int owner) {

   g_error e;

   DBG("type %d, container %d, owner %d\n",type,container,owner);

   type = appmgr_widget_map(type);

   if (!dt)
     dt = DT_NIL;

   /* Check the type.
    */
   if ( type > PG_WIDGETMAX )
      return mkerror(PG_ERRT_BADPARAM, 20);

   /* Check if it's supported
    */
   if (!widgettab[type].install)
     return (g_error) (long) widgettab[type].remove;

#ifdef DEBUG_KEYS
  num_widgets++;
#endif

  /* Allocate new widget memory and zero it out.
   */
  e = g_malloc((void **)w, sizeof(struct widget));
  errorcheck;
  memset(*w, 0, sizeof(struct widget));

  /* Initialize the elements we can.  Since this widget is unattached.
   */
  (*w)->owner = owner;
  (*w)->type = type;
  (*w)->def = widgettab + type;
  (*w)->dt = dt;
  (*w)->container = container;

  /* Allocate data pointers for this widget and everythign it's subclassed from */
  e = g_malloc((void**)&(*w)->subclasses, sizeof(struct widget_subclass) * 
	       ((*w)->def->subclass_num + 1));
  errorcheck;

  /* Allocate a handle for this widget before calling install, so that it may
   * use the handle when setting up subwidgets.
   */
  e = mkhandle(h,PG_TYPE_WIDGET,owner,*w);
  errorcheck;
  (*w)->h = *h;

  /* Initialize this instance of the widget. This install function should initialize
   * the widget it's subclassed from first, if any
   */
  (*(*w)->def->install)(*w);

  return success;
}
Exemple #10
0
g_error widget_derive(struct widget **w, handle *h,
		      int type,struct widget *parent,
		      handle hparent,int rship,int owner) {

  g_error e;

  DBG("type %d, rship %d, parent %p, owner %d\n",type,rship,parent,owner);

  /* Allow using this to detach widgets too. Makes sense, since this is called
   * by the attachwidget request handler.
   */
  if (!parent)
    return widget_attach(*w, NULL, NULL, 0);
  
  switch (rship) {

  case PG_DERIVE_INSIDE:
     if (*w == NULL ) {
        e = widget_create(w,h, type, parent->dt, hparent, owner);
        errorcheck;
     }
     e = widget_attach(*w, parent->dt,parent->sub,hparent);
     break;

  case PG_DERIVE_AFTER:
     if ( *w == NULL ) {
        e = widget_create(w,h, type, parent->dt, parent->container, owner);
        errorcheck;
     }
     e = widget_attach(*w,parent->dt,parent->out,parent->container);
     break;

  case PG_DERIVE_BEFORE:
  case PG_DERIVE_BEFORE_OLD:
     if ( *w == NULL ) {
        e = widget_create(w,h, type, parent->dt, parent->container, owner);
        errorcheck;
     }
     e = widget_attach(*w,parent->dt,parent->where,parent->container);
     break;
     
  default:
    return mkerror(PG_ERRT_BADPARAM,22);

  }
  
  /* Error checking code common to all cases */
  if (iserror(e)) {
    widget_remove(*w);
    errorcheck;
  }

  if ((*w)->def->post_attach) {
    e = (*w)->def->post_attach(*w,parent,rship);
    errorcheck;
  }

  return success;
}
Exemple #11
0
/* Changes the object pointer of a handle */
g_error rehandle(handle h, void *obj, u8 type) {
  struct handlenode *hn = htree_find(h);
  if (!hn) return mkerror(PG_ERRT_HANDLE,26);
  hn->obj = obj;
  hn->type &= ~PG_TYPEMASK;
  hn->type |= type;
  return success;
}
Exemple #12
0
/*
 * Duplicate a handle and it's associated object.
 * (if it can be duplicated. Widgets, drivers,
 * and themes currently can't be duplicated)
 */
g_error handle_dup(handle *dest, int owner, handle src) {
  struct handlenode *n;
  void *newobj;
  g_error e;
  u32 sz;

  /* Find the handle */
  n = htree_find(src);
  /* make sure it exists */
  if (!n) return mkerror(PG_ERRT_HANDLE,26);
  /* Same permissions as rdhandle() */
  if (owner>=0 && n->owner>=0 && n->owner != owner) 
    return mkerror(PG_ERRT_HANDLE,27);
  
  /* Check the type */
  switch (n->type & PG_TYPEMASK) {

  case PG_TYPE_PGSTRING:
    e = pgstring_dup((struct pgstring **)&newobj, (struct pgstring *) n->obj);
    errorcheck;
    e = mkhandle(dest,n->type & PG_TYPEMASK,owner,newobj);
    errorcheck;
    break;

  case PG_TYPE_WT:
    e = wt_instantiate(dest, (struct pgmemwt *) n->obj, src, owner);
    errorcheck;
    break;

  case PG_TYPE_ARRAY:
  case PG_TYPE_PALETTE:
    e = g_malloc(&newobj, (((u32*)n->obj)[0] + 1) * sizeof(u32));
    errorcheck;
    e = mkhandle(dest,n->type & PG_TYPEMASK,owner,newobj);
    errorcheck;
    memcpy(newobj, n->obj, (((u32*)n->obj)[0] + 1) * sizeof(u32));
    break;

  default:
    return mkerror(PG_ERRT_BADPARAM,45);   /* Can't duplicate object */
  }
 
  return success;
}
Exemple #13
0
/**************************************************** Implementation */
static g_error sed133x_init(void) {
    g_error e;

#ifdef SED133X_MMAP_IO
    int fd;
    fd = open("/dev/mem", O_RDWR | O_SYNC);
    if (fd < 0) {
	return mkerror(PG_ERRT_IO,95);
    }
    sed133x_data_port = mmap(0, 2, (PROT_READ | PROT_WRITE), MAP_SHARED,
		    		fd, 0x30000000UL);
    if (sed133x_data_port == MAP_FAILED) {
	return mkerror(PG_ERRT_IO,96);
    }

    close(fd);    
#else
    if (iopl(3) == -1) {
	return mkerror(PG_ERRT_IO,96);
    }
#endif
    

    vid->xres = sed133x_xres;
    vid->yres = sed133x_yres;
    vid->bpp = 1;
    FB_BPL = vid->xres >> 3;
/* all the important setup should now be done be
   the kernel console driver, so we don't need to
   do it here. If you are not using the kernel
   driver, enable this. */
#ifdef SED133X_MUST_INITIALIZE    
    /* general setup, hardware dependant */
    {
	struct sed133x_system_set sset = {
	    m0:0, m1:0, m2:0,
	    ws:0, on:1, iv:1, tl:0, 
	    dr:sset.ws, fx:7, wf:1, fy:7,
	    cr:FB_BPL-1, tcr:75, 
	    lf:vid->yres-1,
	    ap:FB_BPL
	};
	sed_command(SYSTEM_SET, sset);
    }
Exemple #14
0
g_error document_save(struct textbox_document *doc, const struct pgstring *format,
		      struct pgstring **str) {
  struct txtformat *f = text_formats;
  
  while (f->name && pgstring_cmp(pgstring_tmpwrap(f->name),format))
    f++;

  if (!f->save)
    return mkerror(PG_ERRT_BADPARAM,51);  /* Unsupported text format */

  return (*f->save)(doc,str);
}
Exemple #15
0
g_error h3600ts_init(void) {

  btnstate=0;

  h3600ts_fd = open(get_param_str("input-h3600ts","device","/dev/h3600_ts"),
	    O_RDONLY | O_NOCTTY | O_NDELAY);

  if(h3600ts_fd < 0)
    return mkerror(PG_ERRT_IO,43);   /* Error opening touchscreen device */

  return success;
}
Exemple #16
0
/* A fairly interesting function.  Destroys any data referenced by
   the destination handle, and transfers the data from the source
   handle to the destination handle.  The destination's ownership is
   retained, and the source becomes invalid */
g_error handle_bequeath(handle dest, handle src, int srcowner) {
  /* First, validate both handles */
  struct handlenode *s = htree_find(src);
  struct handlenode *d = htree_find(dest);

#ifdef DEBUG_MEMORY
  printf("handle_bequeath(0x%08X,0x%08X,%d)\n",dest,src,srcowner);
#endif   

  if (!(src && s && dest && d)) return mkerror(PG_ERRT_HANDLE,26);
  if (srcowner>=0 && s->owner != srcowner) 
    return mkerror(PG_ERRT_HANDLE,27);
  if ((s->type & PG_TYPEMASK) !=
      (d->type & PG_TYPEMASK))
    return mkerror(PG_ERRT_HANDLE,28);

  object_free(d);
  d->obj = s->obj;
  htree_delete(s);
  return success;
}
Exemple #17
0
g_error widget_set(struct widget *w, int property, glob data) {
   g_error e;
   
   if (!(w && w->def->set))
     return mkerror(PG_ERRT_BADPARAM,23);   /* Bad widget in widget_set */
   
   /* If the widget has a handler, go with that */
   e = (*w->def->set)(w,property,data);
   if (errtype(e)!=ERRT_PASS)
     return e;
   
   return widget_base_set(w,property,data);
}
Exemple #18
0
/* Reads the handle, returns NULL if handle is invalid or if it
   doesn't match the required type */
g_error rdhandlep(void ***p,unsigned char reqtype,int owner,handle h) {
  struct handlenode *n;
  if (!h) {
    *p = NULL;
    return success;
  }
  n = htree_find(h);
  if (!n) return mkerror(PG_ERRT_HANDLE,26);
  if ((n->type & PG_TYPEMASK) != reqtype) 
    return mkerror(PG_ERRT_HANDLE,28);

  /*
   * Allow the system to read any handle. Any application can read a
   * system handle. Applications can read their own handles, but not
   * other apps' handles.
   *
   */
  if (owner>=0 && n->owner>=0 && n->owner != owner) 
    return mkerror(PG_ERRT_HANDLE,27);

  *p = (void**)&n->obj;
  return success;
}
Exemple #19
0
g_error memoryleak_trace(void) {
    int i;

    if (memref==0)
        return success;

#ifdef DEBUG_MEMORY
    for(i=0; i<memref; i++)
        fprintf(stderr, "!%d #%d %p %s\n", memtrack[i].size, i,
                memtrack[i].mem, memtrack[i].where);
#endif

    return mkerror(PG_ERRT_MEMORY,56);  /* Memory leak */
}
Exemple #20
0
/* Loads an input driver, and puts a pointer 
   to it in 'inl' */
g_error load_inlib(g_error (*regfunc)(struct inlib *i),
		   struct inlib **inl) {
  struct inlib *newnode,*p;
  g_error e;

  if (!regfunc)
    return mkerror(PG_ERRT_BADPARAM,75);

  /* Avoid duplicates */
  p = inlib_list;
  while (p) {
    if (p->regfunc == regfunc) {
      if (inl) * inl = p;
      return success;
    }

    p = p->next;
  }

  /* Allocate... */
  e = g_malloc((void**)&newnode,sizeof(struct inlib));
  errorcheck;
  memset(newnode,0,sizeof(struct inlib));

  /* Register it */
  e = (*regfunc)(newnode);
  if (iserror(e)) {
    g_free(newnode);
    return e;
  }
  newnode->regfunc = regfunc;

  /* Insert */
  newnode->next = inlib_list;
  inlib_list = newnode;

  /* Init */
  if (newnode->init)
    e = (*newnode->init)();
  if (iserror(e)) {
    g_free(newnode);
    return e;
  }

  /* Return stuff */
  if (inl)
    *inl = newnode;
  return success;
}
Exemple #21
0
/* immediatly send back an OK response to request req
   can be used for short transactions which require no
   further processing of the app
 */
int httpd_send_immediate_response(struct REQUEST *req)
{
    time_t now;

    if (req->body != NULL) {
        now = time(NULL);
        req->lbody = strlen(req->body);
        /* 200 OK */
        mkheader(req,200,now);
    } else {
        mkerror(req,500,1);
    }

    return 0;
}    
Exemple #22
0
g_error ftgl_engine_init(void) {
  g_error e;

  ftgl_default_size = get_param_int(CFGSECTION,"default_size",14);

  e = ftgl_fontload_init(&ftgl_load);
  errorcheck;

  os_dir_scan(get_param_str(CFGSECTION,"path","/usr/share/fonts"), &ftgl_load_callback);

  if (!ftgl_font_list)
    return mkerror(PG_ERRT_IO, 66);  /* Can't find fonts */

  ftgl_fontload_finish(ftgl_load);
  return success;
}
Exemple #23
0
g_error zaurus_init(void) {
  g_error e;
  
  zaurus_ts_fd = open("/dev/sharp_ts",O_NONBLOCK);
  if (zaurus_ts_fd <= 0)
    return mkerror(PG_ERRT_IO, 74);
  
  /* Open some auxiliary devices... not really important if they fail */
  zaurus_buz_fd = open("/dev/sharp_buz",O_WRONLY);
  zaurus_led_fd = open("/dev/sharp_led",O_WRONLY);

  /* Insert our own input filter to handle oddities of the Zaurus keyboard */
  e = infilter_insert(&infilter_list, &zaurus_if, -1, &infilter_zaurus);
  errorcheck;
  
  return success;
}
Exemple #24
0
g_error sdlgl_init(void) {
  g_error e;

  /* Default mode: 640x480 */
  if (!vid->xres) vid->xres = 640;
  if (!vid->yres) vid->yres = 480;

  /* Start up the SDL video subsystem thingy */
  if (SDL_Init(SDL_INIT_VIDEO))
    return mkerror(PG_ERRT_IO,46);

  /* VBL init */
  e = gl_init();
  errorcheck;

  /* Load a main input driver */
  return load_inlib(&sdlinput_regfunc,&inlib_main);
}
Exemple #25
0
g_error textedit_set ( struct widget *self,
                       int property, 
                       glob data ) {
    struct pgstring *text;

    switch (property) {
    case PG_WP_TEXT: 
        if (iserror(rdhandle((void **) &text, PG_TYPE_PGSTRING, -1, 
                             (handle) data)))
            text = NULL;
        
        if (text) {
            text_backend_set_text(DATA, text);
        }
        break;
    case PG_WP_FONT:
        if (iserror(rdhandle((void **)&DATA->fd,
                             PG_TYPE_FONTDESC,-1,data)) || !DATA->fd) 
            return mkerror(PG_ERRT_HANDLE,44); 
        text_backend_build(DATA, DATA->width, DATA->height);
        break;
    case PG_WP_SELECTION:
        if (iserror(rdhandle((void **) &text, PG_TYPE_PGSTRING, -1, 
                             (handle) data)))
            text = NULL;
        if (text) 
            text_backend_set_selection(DATA, text);
        break;
    case PG_WP_READONLY:
        if (data) { 
            SET_FLAG(DATA->flags, TEXT_WIDGET_READONLY);
            UNSET_FLAG(DATA->flags, TEXT_WIDGET_FLASH_ON);
        } else {
            UNSET_FLAG(DATA->flags, TEXT_WIDGET_READONLY);
            SET_FLAG(DATA->flags, TEXT_WIDGET_FLASH_ON);
            DATA->cursor_state = 1;
            install_timer(self, FLASHTIME_ON);
        }
        break;
    }
    return success;
}
Exemple #26
0
g_error yuv16_422_planar_init(void) {
  g_error e;

  /* Call parent function */
  /* NOTE : The fbdev_init() function includes some specific settings
   * for yuv16_422_planar mode. See CONFIG_FB_YUV16_422_PLANAR in this.
   */
  e = fbdev_init();
  errorcheck;
   
  /* Init our own stuff */
  /* Create an RGB shadow buffer */
  yuv16_rgb_shadow_buffer = malloc(vid->xres * vid->yres * sizeof(hwrcolor));
  if (yuv16_rgb_shadow_buffer == 0) {
    yuv16_422_planar_close();
    return mkerror(PG_ERRT_MEMORY, 25); /* No mem for RGB shadow buffer */
  }
  
  return success;
}
Exemple #27
0
g_error x11_bitmap_getshm(hwrbitmap bmp, u32 uid, struct pgshmbitmap *shm) {
  if (!XB(bmp)->sb.shm_id)
    return mkerror(PG_ERRT_IO,145);   /* SHM bitmaps not supported */

  shm->shm_key     = htonl(XB(bmp)->shm_key);
  shm->shm_length  = htonl(XB(bmp)->sb.pitch * XB(bmp)->sb.h);
  shm->width       = htons(XB(bmp)->sb.w);
  shm->height      = htons(XB(bmp)->sb.h);
  shm->bpp         = htons(XB(bmp)->sb.bpp);
  shm->pitch       = htons(XB(bmp)->sb.pitch);

  /* Default color space information. Detect an alpha channel
   * if this bitmap has one.
   */
  def_shm_colorspace(XB(bmp)->sb.bpp,
		     XB(bmp)->sb.w && XB(bmp)->sb.h && 
		     (*(u32*)XB(bmp)->sb.bits & PGCF_ALPHA),
		     shm);
  return success;
}
Exemple #28
0
g_error panelbar_set(struct widget *self,int property, glob data) {
  g_error e;
  struct widget *w;

  switch (property) {
    
  case PG_WP_BIND:
    e = rdhandle((void **)&w,PG_TYPE_WIDGET,self->owner,data);
    errorcheck;
    DATA->bindto = data;
    break;

  case PG_WP_MINIMUM:
    DATA->minimum = data;
    break;

  default:
    return mkerror(ERRT_PASS,0);
  }
  return success;
}
Exemple #29
0
/* queue a OK response for request req
   
*/
int httpd_send_response(struct REQUEST *req, fd_sets_t *fds)
{
    time_t now;

    if (req->body != NULL) {
        now = time(NULL);
        req->lbody = strlen(req->body);
        /* 200 OK */
        mkheader(req,200,now);
    } else {
        mkerror(req,500,1);
    }

    if (req->state == STATE_WRITE_HEADER) {
        // switch to writing
        FD_CLR(req->fd, &fds->rset);
        FD_SET(req->fd, &fds->wset);
    }

    return 0;
}  
Exemple #30
0
g_error sdlgl_setmode(s16 xres,s16 yres,s16 bpp,u32 flags) {
  u32 sdlflags = SDL_RESIZABLE | SDL_OPENGL;
  char str[80];
  g_error e;
  static SDL_Surface *surface = NULL;

  /* Interpret flags */
  if (get_param_int("video-sdlgl","fullscreen",0))
    sdlflags |= SDL_FULLSCREEN;
   
  /* Set the video mode */
  if ((!surface) || xres != vid->xres || 
      yres !=vid->yres || bpp != vid->bpp) {
    surface = SDL_SetVideoMode(xres,yres,bpp,sdlflags);
    if (!surface)
      return mkerror(PG_ERRT_IO,47);
  }

  vid->bpp  = surface->format->BitsPerPixel;
  vid->xres = xres;
  vid->yres = yres;

#ifdef CONFIG_SDLSKIN
  /* If we've got SDL skinning support, set the relevant vars to good values 
   * so the input driver won't get wacky on us.
   */
  sdlfb_display_x = 0;
  sdlfb_display_y = 0;
  sdlfb_scale     = 1;
#endif
   
  e = gl_setmode(xres,yres,bpp,flags);
  errorcheck;

  snprintf(str,sizeof(str),get_param_str("video-sdlgl","caption","PicoGUI (sdlgl@%dx%dx%d)"),
	   vid->xres,vid->yres,bpp);
  SDL_WM_SetCaption(str,NULL);
  
  return success; 
}