Пример #1
0
static void
osk_open(glw_root_t *gr, const char *title, const char *input, glw_t *w,
	 int password)
{
  oskParam param = {0};
  oskInputFieldInfo ifi = {0};
  glw_ps3_t *gp = (glw_ps3_t *)gr;
  
  if(gp->osk_widget)
    return;

  if(title == NULL)
    title = "";

  if(input == NULL)
    input = "";

  void *title16;
  void *input16;

  size_t s;
  s = utf8_to_ucs2(NULL, title, 0);
  title16 = malloc(s);
  utf8_to_ucs2(title16, title, 0);

  s = utf8_to_ucs2(NULL, input, 0);
  input16 = malloc(s);
  utf8_to_ucs2(input16, input, 0);

  param.firstViewPanel = password ? OSK_PANEL_TYPE_PASSWORD :
    OSK_PANEL_TYPE_DEFAULT;
  param.allowedPanels = param.firstViewPanel;
  param.prohibitFlags = OSK_PROHIBIT_RETURN;

  ifi.message_addr = (intptr_t)title16;
  ifi.startText_addr = (intptr_t)input16;
  ifi.maxLength = 256;

  if(lv2MemContinerCreate(&gp->osk_container, 2 * 1024 * 1024))
    gp->osk_container = 0xFFFFFFFFU;

  oskSetKeyLayoutOption(3);

  int ret = oskLoadAsync(gp->osk_container, &param, &ifi);

  if(!ret) {
    gp->osk_widget = w;
    glw_ref(w);
  }

  free(title16);
  free(input16);
}
Пример #2
0
static int
start_browser(const char *url)
{
  // only one guy at the time
  while(browser_open)
    hts_cond_wait(&web_cond, &web_mutex);

  webBrowserConfig(&webcfg, 0x20000); // V2
  webBrowserConfigSetFunction(&webcfg, 0x20 | 0x40);
  webBrowserConfigSetHeapSize(&webcfg, 48*1024*1024);
  webBrowserConfigSetTabCount(&webcfg, 1);

  webcfg.x = 200;
  webcfg.y = 200;
  webcfg.width = 800;
  webcfg.height = 600;
  webcfg.resolution_factor = 1;

  int mc_size;
  webBrowserEstimate(&webcfg, &mc_size);
  TRACE(TRACE_DEBUG, "WEB", "Required memory for browser: %d", mc_size);

  int r = lv2MemContinerCreate(&memcontainer, mc_size);
  if(r) {
    TRACE(TRACE_ERROR, "WEB", "Unable to alloc mem for browser -- 0x%x", r);
    return r;
  }

  webBrowserSetRequestHook(&webcfg, OPD32(nav_callback), NULL);

  r = webBrowserInitialize(OPD32(web_sys_callback), memcontainer);
  if(r) {
    TRACE(TRACE_ERROR, "WEB", "Unable to alloc mem for browser -- 0x%x", r);
    return r;
  }

  TRACE(TRACE_DEBUG, "WEB", "Browser opening %s", url);
  webcfg.request_cb = (intptr_t)OPD32(nav_callback);
  webBrowserCreate(&webcfg, url);

  browser_open = 1;
  return 0;
}