Exemplo n.º 1
0
EAPI int elm_main (int argc, char** argv) {
	rockon_data *rdata;

	if (log_init() == EINA_FALSE) {
		EINA_LOG_ERR("Log domains init failed");
	}

	rdata = rockon_data_new();

	gui_window_set(rdata);

	xmms2_connect(rdata);
	if (rdata->connection == NULL) {
		cmd_server_launch(rdata);
	}

	EINA_LOG_DBG("MainLoop Start");
	elm_run();
	EINA_LOG_DBG("MainLoop End");

	rockon_data_del(rdata);
	log_shutdown();
	elm_shutdown();

	return 0;
}
Exemplo n.º 2
0
static void
_libxml2_document_end(void *user_data)
{
    EINA_LOG_DBG("libxml2 doc end callback hit");
    Eo *filter = (Eo*)user_data;
    xml_sax_base_document_end(filter, user_data);
}
Exemplo n.º 3
0
static void
preedit_done_callback(XIC xic EINA_UNUSED,
                      XPointer client_data,
                      XPointer call_data EINA_UNUSED)
{
   EINA_LOG_DBG("in");
   Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
   Ecore_IMF_Context_Data *imf_context_data;
   imf_context_data = ecore_imf_context_data_get(ctx);
   EINA_SAFETY_ON_NULL_RETURN(imf_context_data);

   if (imf_context_data->preedit_length)
     {
        imf_context_data->preedit_length = 0;
        free(imf_context_data->preedit_chars);
        imf_context_data->preedit_chars = NULL;
        ecore_imf_context_preedit_changed_event_add(ctx);
        ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
     }

   if (imf_context_data->finalizing == EINA_FALSE)
     {
        ecore_imf_context_preedit_end_event_add(ctx);
        ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
     }
}
Exemplo n.º 4
0
static void
_ecore_imf_context_xim_focus_in(Ecore_IMF_Context *ctx)
{
   EINA_LOG_DBG("in");
#ifdef ENABLE_XIM
   XIC ic;
   Ecore_IMF_Context_Data *imf_context_data;
   imf_context_data = ecore_imf_context_data_get(ctx);
   EINA_SAFETY_ON_NULL_RETURN(imf_context_data);

   ic = imf_context_data->ic;
   imf_context_data->has_focus = EINA_TRUE;

   if (ecore_imf_context_input_panel_enabled_get(ctx))
     ecore_imf_context_input_panel_show(ctx);

   if (ic)
     {
        char *str;

#ifdef X_HAVE_UTF8_STRING
        if ((str = Xutf8ResetIC(ic)))
#else
        if ((str = XmbResetIC(ic)))
#endif
          XFree(str);

        XSetICFocus(ic);
     }
#else
   (void)ctx;
#endif
}
Exemplo n.º 5
0
bool PluginPackage::load()
{
    char* errmsg;

    if (m_isLoaded) {
        m_loadCount++;
        return true;
    }

    m_module = dlopen(m_path.utf8().data(), RTLD_LAZY | RTLD_LOCAL);
    if ((errmsg = dlerror())) {
        EINA_LOG_WARN("%s not loaded: %s", m_path.utf8().data(), errmsg);
        return false;
    }

    m_isLoaded = true;

    NP_InitializeFuncPtr initialize;
    NPError err;

    initialize = reinterpret_cast<NP_InitializeFuncPtr>(dlsym(m_module, "NP_Initialize"));
    if ((errmsg = dlerror())) {
        EINA_LOG_ERR("Could not get symbol NP_Initialize: %s", errmsg);
        goto abort;
    }

    m_NPP_Shutdown = reinterpret_cast<NPP_ShutdownProcPtr>(dlsym(m_module, "NP_Shutdown"));
    if ((errmsg = dlerror())) {
        EINA_LOG_ERR("Could not get symbol NP_Shutdown: %s", errmsg);
        goto abort;
    }

    memset(&m_pluginFuncs, 0, sizeof(m_pluginFuncs));
    m_pluginFuncs.size = sizeof(m_pluginFuncs);

    initializeBrowserFuncs();

#if defined(XP_UNIX)
    err = initialize(&m_browserFuncs, &m_pluginFuncs);
#else
    err = initialize(&m_browserFuncs);
#endif
    if (err != NPERR_NO_ERROR)
        goto abort;

    m_loadCount++;
    return true;

abort:
    EINA_LOG_DBG("failed to load plugin, unload it without shutting it down.");
    unloadWithoutShutdown();
    return false;
}
Exemplo n.º 6
0
Eina_Bool
ecore_imf_xim_init(void)
{
   EINA_LOG_DBG("%s in", __FUNCTION__);
   eina_init();
   ecore_x_init(NULL);
   ecore_imf_module_register(&xim_info,
                             xim_imf_module_create,
                             xim_imf_module_exit);

   return EINA_TRUE;
}
Exemplo n.º 7
0
static void
_ecore_imf_context_xim_client_window_set(Ecore_IMF_Context *ctx,
                                         void *window)
{
   EINA_LOG_DBG("in");
#ifdef ENABLE_XIM
   set_ic_client_window(ctx, (Ecore_X_Window)((Ecore_Window)window));
#else
   (void)ctx;
   (void)window;
#endif
}
Exemplo n.º 8
0
EOLIAN static Efl_Object *
_xml_sax_base_parse_string(Eo *obj, Xml_Base_Data *pd, const char* document)
{
    EINA_LOG_DBG("Parsing document: %s", document);
    const Efl_Class *current_class = efl_class_get(obj);
    EINA_LOG_DBG("obj-type referenced:'%s'\n", efl_class_name_get(current_class));
    // Create a parser instance for this request.
    // TODO this currently is here as having one setup in the constructor
    // results in function references being lost in transit...
    xmlSAXHandler parser;
    memset(&parser, 0, sizeof(xmlSAXHandler));
    parser.initialized = XML_SAX2_MAGIC;

    // Setup parser callbacks and start parsing
    parser.startDocument = _libxml2_document_start;
    parser.endDocument = _libxml2_document_end;
    parser.startElementNs = _libxml2_start;
    parser.endElementNs = _libxml2_end;
    parser.characters = _libxml2_char;
    // TODO fix get location issues in XInclude filter.

    // TODO Work out why this goes to town and kills the parser....
    // parser.setDocumentLocator = _libxml2_set_document_locator;

    // Just in for debugging at the moment.
    parser.error = _error;
    parser.warning = _warning;
    parser.fatalError = _fatalError;

    if (xmlSAXUserParseMemory(&parser, obj, document, (int) strlen(document)) < 0 )
    {
        EINA_LOG_ERR("Issue parsing XML document");
    };

    // Make sure we cleanup the current parser.
    xmlCleanupParser();

    return NULL; //pd->result;
}
Exemplo n.º 9
0
static Ecore_IMF_Context *
xim_imf_module_create(void)
{
   EINA_LOG_DBG("%s in", __FUNCTION__);
   Ecore_IMF_Context *ctx = NULL;

   ctx = ecore_imf_context_new(&xim_class);
   if (!ctx)
     goto error;

   return ctx;

error:
   free(ctx);
   return NULL;
}
Exemplo n.º 10
0
static void
_ecore_imf_context_xim_input_panel_hide(Ecore_IMF_Context *ctx)
{
   EINA_LOG_DBG("%s in", __FUNCTION__);

#ifdef ENABLE_XIM
   Ecore_IMF_Context_Data *imf_context_data;
   imf_context_data = ecore_imf_context_data_get(ctx);
   EINA_SAFETY_ON_NULL_RETURN(imf_context_data);

   ecore_x_e_virtual_keyboard_state_set
        (imf_context_data->win, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
#else
   (void)ctx;
#endif
}
Exemplo n.º 11
0
static void
_ecore_imf_context_xim_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx,
                                                          char **str,
                                                          Eina_List **attrs,
                                                          int *cursor_pos)
{
   EINA_LOG_DBG("in");

#ifdef ENABLE_XIM
   Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);

   _ecore_imf_context_xim_preedit_string_get(ctx, str, cursor_pos);

   if (!attrs) return;
   if (!imf_context_data || !imf_context_data->feedbacks) return;

   int i = 0;
   XIMFeedback last_feedback = 0;
   int start = -1;

   for (i = 0; i < imf_context_data->preedit_length; i++)
     {
        XIMFeedback new_feedback = imf_context_data->feedbacks[i] & FEEDBACK_MASK;

        if (new_feedback != last_feedback)
          {
             if (start >= 0)
               add_feedback_attr(attrs, *str, last_feedback, start, i);

             last_feedback = new_feedback;
             start = i;
          }
     }

   if (start >= 0)
     add_feedback_attr(attrs, *str, last_feedback, start, i);
#else
   (void)ctx;
   if (str)
     *str = NULL;
   if (attrs)
     *attrs = NULL;
   if (cursor_pos)
     *cursor_pos = 0;
#endif
}
Exemplo n.º 12
0
static int
preedit_start_callback(XIC xic EINA_UNUSED,
                       XPointer client_data,
                       XPointer call_data EINA_UNUSED)
{
   EINA_LOG_DBG("in");
   Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
   Ecore_IMF_Context_Data *imf_context_data;
   imf_context_data = ecore_imf_context_data_get(ctx);
   if (!imf_context_data) return -1;

   if (imf_context_data->finalizing == EINA_FALSE)
     {
        ecore_imf_context_preedit_start_event_add(ctx);
        ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
     }
   return -1;
}
Exemplo n.º 13
0
static void
_ecore_imf_context_xim_add(Ecore_IMF_Context *ctx)
{
   EINA_LOG_DBG("in");
#ifdef ENABLE_XIM
   Ecore_IMF_Context_Data *imf_context_data = NULL;

   imf_context_data = imf_context_data_new();
   EINA_SAFETY_ON_NULL_RETURN(imf_context_data);

   imf_context_data->use_preedit = EINA_TRUE;
   imf_context_data->finalizing = EINA_FALSE;
   imf_context_data->has_focus = EINA_FALSE;
   imf_context_data->in_toplevel = EINA_FALSE;

   ecore_imf_context_data_set(ctx, imf_context_data);
#else
   (void)ctx;
#endif
}
Exemplo n.º 14
0
static void
_ecore_imf_context_xim_preedit_string_get(Ecore_IMF_Context *ctx,
                                          char **str,
                                          int *cursor_pos)
{
   EINA_LOG_DBG("in");
#ifdef ENABLE_XIM
   Ecore_IMF_Context_Data *imf_context_data;
   char *utf8;
   int len;
   imf_context_data = ecore_imf_context_data_get(ctx);
   EINA_SAFETY_ON_NULL_RETURN(imf_context_data);

   if (imf_context_data->preedit_chars)
     {
        utf8 = eina_unicode_unicode_to_utf8(imf_context_data->preedit_chars,
                                            &len);
        if (str)
          *str = utf8;
        else
          free(utf8);
     }
   else
     {
        if (str)
          *str = NULL;
        if (cursor_pos)
          *cursor_pos = 0;
     }

   if (cursor_pos)
     *cursor_pos = imf_context_data->preedit_cursor;
#else
   (void)ctx;
   if (str)
     *str = NULL;
   if (cursor_pos)
     *cursor_pos = 0;
#endif
}
Exemplo n.º 15
0
static void
_ecore_imf_context_xim_use_preedit_set(Ecore_IMF_Context *ctx,
                                       Eina_Bool use_preedit)
{
   EINA_LOG_DBG("in");
#ifdef ENABLE_XIM
   Ecore_IMF_Context_Data *imf_context_data;
   imf_context_data = ecore_imf_context_data_get(ctx);
   EINA_SAFETY_ON_NULL_RETURN(imf_context_data);

   use_preedit = use_preedit != EINA_FALSE;

   if (imf_context_data->use_preedit != use_preedit)
     {
        imf_context_data->use_preedit = use_preedit;
        reinitialize_ic(ctx);
     }
#else
   (void)ctx;
   (void)use_preedit;
#endif
}
Exemplo n.º 16
0
static void
_ecore_imf_context_xim_del(Ecore_IMF_Context *ctx)
{
   EINA_LOG_DBG("in");
#ifdef ENABLE_XIM
   Ecore_IMF_Context_Data *imf_context_data;
   imf_context_data = ecore_imf_context_data_get(ctx);
   EINA_SAFETY_ON_NULL_RETURN(imf_context_data);

   imf_context_data->finalizing = EINA_TRUE;
   if (imf_context_data->im_info && !imf_context_data->im_info->ics->next)
     {
        if (imf_context_data->im_info->reconnecting == EINA_TRUE)
          {
             Ecore_X_Display *dsp;
             dsp = ecore_x_display_get();
             XUnregisterIMInstantiateCallback(dsp,
                                              NULL, NULL, NULL,
                                              xim_instantiate_callback,
                                              (XPointer)imf_context_data->im_info);
          }
        else if (imf_context_data->im_info->im)
          {
             XIMCallback im_destroy_callback;
             im_destroy_callback.client_data = NULL;
             im_destroy_callback.callback = NULL;
             XSetIMValues(imf_context_data->im_info->im,
                          XNDestroyCallback, &im_destroy_callback,
                          NULL);
          }
     }

   set_ic_client_window(ctx, 0);

   imf_context_data_destroy(imf_context_data);
#else
   (void)ctx;
#endif
}
Exemplo n.º 17
0
static void
_ecore_imf_context_xim_cursor_location_set(Ecore_IMF_Context *ctx,
                                           int x, int y, int w, int h)
{
   EINA_LOG_DBG("%s in", __FUNCTION__);

#ifdef ENABLE_XIM
   Ecore_IMF_Context_Data *imf_context_data;
   XIC ic;
   XVaNestedList preedit_attr;
   XPoint spot;

   imf_context_data = ecore_imf_context_data_get(ctx);
   EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
   ic = imf_context_data->ic;
   if (!ic)
     return;

   spot.x = x;
   spot.y = y + h;

   preedit_attr = XVaCreateNestedList(0,
                                      XNSpotLocation, &spot,
                                      NULL);
   XSetICValues(ic,
                XNPreeditAttributes, preedit_attr,
                NULL);

   XFree(preedit_attr);
#else
   (void)ctx;
   (void)x;
   (void)y;
   (void)h;
#endif
   (void)(w); // yes w is unused, but only a bi-product of the algorithm
}
Exemplo n.º 18
0
static void
_ecore_imf_context_xim_focus_out(Ecore_IMF_Context *ctx)
{
   EINA_LOG_DBG("%s in", __FUNCTION__);
#ifdef ENABLE_XIM
   XIC ic;
   Ecore_IMF_Context_Data *imf_context_data;
   imf_context_data = ecore_imf_context_data_get(ctx);
   EINA_SAFETY_ON_NULL_RETURN(imf_context_data);

   if (imf_context_data->has_focus == EINA_TRUE)
     {
        imf_context_data->has_focus = EINA_FALSE;
        ic = imf_context_data->ic;
        if (ic)
          XUnsetICFocus(ic);

        if (ecore_imf_context_input_panel_enabled_get(ctx))
          ecore_imf_context_input_panel_hide(ctx);
     }
#else
   (void)ctx;
#endif
}
Exemplo n.º 19
0
static void
_ecore_imf_context_xim_reset(Ecore_IMF_Context *ctx)
{
   EINA_LOG_DBG("%s in", __FUNCTION__);
#ifdef ENABLE_XIM
   XIC ic;
   Ecore_IMF_Context_Data *imf_context_data;
   char *result;

   /* restore conversion state after resetting ic later */
   XIMPreeditState preedit_state = XIMPreeditUnKnown;
   XVaNestedList preedit_attr;
   Eina_Bool have_preedit_state = EINA_FALSE;

   imf_context_data = ecore_imf_context_data_get(ctx);
   EINA_SAFETY_ON_NULL_RETURN(imf_context_data);

   ic = imf_context_data->ic;
   if (!ic)
     return;

   if (imf_context_data->preedit_length == 0)
     return;

   preedit_attr = XVaCreateNestedList(0,
                                      XNPreeditState, &preedit_state,
                                      NULL);
   if (!XGetICValues(ic,
                     XNPreeditAttributes, preedit_attr,
                     NULL))
     have_preedit_state = EINA_TRUE;

   XFree(preedit_attr);

   result = XmbResetIC(ic);

   preedit_attr = XVaCreateNestedList(0,
                                      XNPreeditState, preedit_state,
                                      NULL);
   if (have_preedit_state)
     XSetICValues(ic,
                  XNPreeditAttributes, preedit_attr,
                  NULL);

   XFree(preedit_attr);

   if (imf_context_data->feedbacks)
     {
        free(imf_context_data->feedbacks);
        imf_context_data->feedbacks = NULL;
     }

   if (imf_context_data->preedit_length)
     {
        imf_context_data->preedit_length = 0;
        free(imf_context_data->preedit_chars);
        imf_context_data->preedit_chars = NULL;

        ecore_imf_context_preedit_changed_event_add(ctx);
        ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
     }

   if (result)
     {
        char *result_utf8 = strdup(result);
        if (result_utf8)
          {
             ecore_imf_context_commit_event_add(ctx, result_utf8);
             ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_COMMIT, result_utf8);
             free(result_utf8);
          }
     }

   XFree(result);
#else
   (void)ctx;
#endif
}
Exemplo n.º 20
0
static Eina_Bool
_ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
                                    Ecore_IMF_Event_Type type,
                                    Ecore_IMF_Event *event)
{
   EINA_LOG_DBG("%s in", __FUNCTION__);
#ifdef ENABLE_XIM
   Ecore_IMF_Context_Data *imf_context_data;
   XIC ic;

   Ecore_X_Display *dsp;
   Ecore_X_Window win;

   int val;
   char compose_buffer[256];
   KeySym sym;
   char *compose = NULL;
   char *tmp = NULL;
   Eina_Bool result = EINA_FALSE;

   imf_context_data = ecore_imf_context_data_get(ctx);
   if (!imf_context_data) return EINA_FALSE;
   ic = imf_context_data->ic;
   if (!ic)
     ic = get_ic(ctx);

   if (type == ECORE_IMF_EVENT_KEY_DOWN)
     {
        XKeyPressedEvent xev;
        Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event;
        EINA_LOG_DBG("ECORE_IMF_EVENT_KEY_DOWN");

        dsp = ecore_x_display_get();
        win = imf_context_data->win;

        xev.type = KeyPress;
        xev.serial = 0; /* hope it doesn't matter */
        xev.send_event = 0;
        xev.display = dsp;
        xev.window = win;
        xev.root = ecore_x_window_root_get(win);
        xev.subwindow = win;
        xev.time = ev->timestamp;
        xev.x = xev.x_root = 0;
        xev.y = xev.y_root = 0;
        xev.state = 0;
        xev.state |= _ecore_x_event_reverse_modifiers(ev->modifiers);
        xev.state |= _ecore_x_event_reverse_locks(ev->locks);
        xev.keycode = _keycode_get(dsp, ev->keyname);
        xev.same_screen = True;

        if (ic)
          {
             Status mbstatus;
#ifdef X_HAVE_UTF8_STRING
             val = Xutf8LookupString(ic,
                                     &xev,
                                     compose_buffer,
                                     sizeof(compose_buffer) - 1,
                                     &sym,
                                     &mbstatus);
#else /* ifdef X_HAVE_UTF8_STRING */
             val = XmbLookupString(ic,
                                   &xev,
                                   compose_buffer,
                                   sizeof(compose_buffer) - 1,
                                   &sym,
                                   &mbstatus);
#endif /* ifdef X_HAVE_UTF8_STRING */
             if (mbstatus == XBufferOverflow)
               {
                  tmp = malloc(sizeof (char) * (val + 1));
                  if (!tmp)
                    return EINA_FALSE;

                  compose = tmp;

#ifdef X_HAVE_UTF8_STRING
                  val = Xutf8LookupString(ic,
                                          &xev,
                                          tmp,
                                          val,
                                          &sym,
                                          &mbstatus);
#else /* ifdef X_HAVE_UTF8_STRING */
                  val = XmbLookupString(ic,
                                        &xev,
                                        tmp,
                                        val,
                                        &sym,
                                        &mbstatus);
#endif /* ifdef X_HAVE_UTF8_STRING */
                  if (val > 0)
                    {
                       tmp[val] = '\0';
#ifndef X_HAVE_UTF8_STRING
                       compose = eina_str_convert(nl_langinfo(CODESET),
                                                  "UTF-8", tmp);
                       free(tmp);
                       tmp = compose;
#endif /* ifndef X_HAVE_UTF8_STRING */
                    }
                  else
                    compose = NULL;
               }
             else if (val > 0)
               {
                  compose_buffer[val] = '\0';
#ifdef X_HAVE_UTF8_STRING
                  compose = strdup(compose_buffer);
#else /* ifdef X_HAVE_UTF8_STRING */
                  compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8",
                                             compose_buffer);
#endif /* ifdef X_HAVE_UTF8_STRING */
               }
          }
        else
          {
             compose = strdup(ev->compose);
          }

        if (compose)
          {
             Eina_Unicode *unicode;
             int len;
             unicode = eina_unicode_utf8_to_unicode(compose, &len);
             if (!unicode) abort();
             if (unicode[0] >= 0x20 && unicode[0] != 0x7f)
               {
                  ecore_imf_context_commit_event_add(ctx, compose);
                  ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_COMMIT, compose);
                  result = EINA_TRUE;
               }
             free(compose);
             free(unicode);
          }
     }

   return result;
#else
   (void)ctx;
   (void)type;
   (void)event;
   return EINA_FALSE;
#endif
}
Exemplo n.º 21
0
static Eina_Bool sigint_handler(void *data, int ev_type, void *ev)
{
    EINA_LOG_DBG("Ctrl-C hit");
    elm_exit();
    return EINA_TRUE;
}