Exemple #1
0
static void
_ecore_imf_context_xim_del(Ecore_IMF_Context *ctx)
{
   Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
   DBG("ctx=%p, imf_context_data=%p", ctx, imf_context_data);
   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,
                                              _ecore_imf_xim_instantiate_cb,
                                              (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);
          }
     }

   _ecore_imf_xim_ic_client_window_set(ctx, 0);

   _ecore_imf_xim_context_data_destroy(imf_context_data);
}
Exemple #2
0
Fichier : x.c Projet : Limsik/e17
int
EDisplayOpen(const char *dstr, int scr)
{
   char                dbuf[256], *s;
   unsigned int        ddpy, dscr;

   if (!dstr)
      goto do_open;

   Esnprintf(dbuf, sizeof(dbuf), "%s", dstr);
   s = strchr(dbuf, ':');
   if (!s)
      return -1;
   s++;

   ddpy = dscr = 0;
   sscanf(s, "%u.%u", &ddpy, &dscr);
   if (scr >= 0)		/* Override screen */
      dscr = scr;
   Esnprintf(s, sizeof(dbuf) - (s - dbuf), "%u.%u", ddpy, dscr);
   dstr = dbuf;

 do_open:
#ifdef USE_ECORE_X
   ecore_x_init(dstr);
   disp = ecore_x_display_get();
#else
   disp = XOpenDisplay(dstr);
#endif

   return (disp) ? 0 : -1;
}
Exemple #3
0
std::unique_ptr<PlatformDisplay> PlatformDisplay::createPlatformDisplay()
{
#if PLATFORM(GTK)
#if defined(GTK_API_VERSION_2)
    return std::make_unique<PlatformDisplayX11>(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()));
#else
    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
#if PLATFORM(X11)
    if (GDK_IS_X11_DISPLAY(display))
        return std::make_unique<PlatformDisplayX11>(GDK_DISPLAY_XDISPLAY(display));
#endif
#if PLATFORM(WAYLAND)
    if (GDK_IS_WAYLAND_DISPLAY(display))
        return std::make_unique<PlatformDisplayWayland>(gdk_wayland_display_get_wl_display(display));
#endif
#endif
#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
    return std::make_unique<PlatformDisplayX11>(static_cast<Display*>(ecore_x_display_get()));
#elif PLATFORM(WIN)
    return std::make_unique<PlatformDisplayWin>();
#endif

#if PLATFORM(X11)
    return std::make_unique<PlatformDisplayX11>();
#endif

    ASSERT_NOT_REACHED();
    return nullptr;
}
Exemple #4
0
void
od_dock_icons_update_begin()
{
    od_sync_clients(NULL);
    ecore_x_event_mask_set(DefaultRootWindow(ecore_x_display_get()),
                           ECORE_X_EVENT_MASK_WINDOW_PROPERTY |
                           ECORE_X_EVENT_MASK_WINDOW_MANAGE);
    ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, window_prop_change_cb,
                            NULL);
}
Exemple #5
0
Display* NetscapePlugin::x11HostDisplay()
{
#if PLATFORM(GTK)
    return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
    return static_cast<Display*>(ecore_x_display_get());
#else
    return 0;
#endif
}
static Display* getPluginDisplay()
{
#if PLATFORM(GTK)
    // Since we're a gdk/gtk app, we'll (probably?) have the same X connection as any gdk-based
    // plugins, so we can return that. We might want to add other implementations here later.
    return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
    return static_cast<Display*>(ecore_x_display_get());
#else
    return nullptr;
#endif
}
bool
mp_app_grab_mm_keys(struct appdata *ad)
{
	utilx_grab_key(ecore_x_display_get(), ad->xwin, KEY_MEDIA, OR_EXCLUSIVE_GRAB);
	int err = media_key_reserve(_mp_app_media_key_event_cb, ad);
	if (err != MEDIA_KEY_ERROR_NONE) {
		mp_error("media_key_reserve().. [0x%x]", err);
		return false;
	}

	return true;
}
static void button_ug_destroy_cb(ui_gadget_h ug, void *priv)
{
	_D("%s\n", __func__);
	struct appdata *ad = (struct appdata *)priv;

	retm_if(ug == NULL, "Invalid argument: ug is NULL\n");

	ug_destroy(ug);
	ad->ug = NULL;

	ecore_x_netwm_window_type_set(elm_win_xwindow_get(ad->win), ECORE_X_WINDOW_TYPE_NOTIFICATION);
	utilx_set_window_opaque_state(ecore_x_display_get(), elm_win_xwindow_get(ad->win), UTILX_OPAQUE_STATE_OFF);
	_close_volume(ad);
}
FloatRect screenRect(Widget* widget)
{
    int x = 0, y = 0, w = 0, h = 0;

#ifdef HAVE_ECORE_X
    Ecore_X_Display* display = ecore_x_display_get();
    int def = DefaultScreen(display);
    Screen* screen = ScreenOfDisplay(display, def);
    x = 0;
    y = 0;
    w = screen->width;
    h = screen->height;
#endif

    return FloatRect(x, y, w, h);
}
Exemple #10
0
void
ecore_imf_xim_shutdown(void)
{
#ifdef ENABLE_XIM
   while (open_ims)
     {
        XIM_Im_Info *info = open_ims->data;
        Ecore_X_Display *display = ecore_x_display_get();

        xim_info_display_closed(display, EINA_FALSE, info);
     }
#endif

   ecore_x_shutdown();
   eina_shutdown();
}
ui_gadget_h create_button_ug(void *data)
{
	ui_gadget_h ug = NULL;
	struct ug_cbs cbs = {0};
	struct appdata *ad = (struct appdata *)data;
	retvm_if(ad == NULL, 0, "Invalid argument:appdata is NULL\n");

	cbs.layout_cb = button_ug_layout_cb;
	cbs.destroy_cb = button_ug_destroy_cb;
	cbs.priv = (void *)data;

	ecore_x_netwm_window_type_set(elm_win_xwindow_get(ad->win), ECORE_X_WINDOW_TYPE_NORMAL);
	utilx_set_window_opaque_state(ecore_x_display_get(), elm_win_xwindow_get(ad->win), UTILX_OPAQUE_STATE_ON);
	ug = ug_create(NULL, "setting-profile-efl", UG_MODE_FULLVIEW, NULL, &cbs);

	return ug;
}
Exemple #12
0
Display* NetscapePlugin::x11HostDisplay()
{
#if PLATFORM(QT)
    static Display* dedicatedDisplay = 0;
    if (!dedicatedDisplay)
        dedicatedDisplay = XOpenDisplay(0);

    ASSERT(dedicatedDisplay);
    return dedicatedDisplay;
#elif PLATFORM(GTK)
    return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
    return static_cast<Display*>(ecore_x_display_get());
#else
    return 0;
#endif
}
/* for HDMI rotation */
void e_illume_util_hdmi_rotation (Ecore_X_Window root, int angle)
{
   Ecore_X_Display *dpy;
   RROutput output;
   char hdmi_commands[HDMI_BUF_SIZE];
   char buf[5];
   int buf_len;
   int i;
   char* x_control[] = {"illume2", "rotation", buf, NULL };

   if (access(HDMI_DEV_NODE, F_OK) == 0)
     {
        if (!_atom_hdmi)
           _atom_hdmi = ecore_x_atom_get ("X_RR_PROPERTY_REMOTE_CONTROLLER");

        if(!_atom_hdmi)
          {
             fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create X_RR_PROPERTY_REMOTE_CONTROLLER Atom...\n");
             return;
          }

        dpy = ecore_x_display_get();

        memset (hdmi_commands, 0, sizeof(hdmi_commands));
        memset (buf, 0, sizeof(buf));

        output = 0;
        XRRScreenResources* res = XRRGetScreenResources (dpy, root);
        if (res && (res->noutput != 0))
          {
             for (i=0; i<res->noutput; i++)
               {
                  output = res->outputs[i];
               }

             snprintf (buf, sizeof(buf)-1, "%d", angle);
             buf_len = _e_illume_util_marshalize_string (hdmi_commands, 3, x_control);

             XRRChangeOutputProperty(dpy, output, _atom_hdmi, XA_CARDINAL, 8, PropModeReplace, (unsigned char *)hdmi_commands, buf_len);
          }
        else
          {
             printf("[ILLUME2]Error.. Cannot get screen resource.\n");
          }
     }
}
Exemple #14
0
std::unique_ptr<PlatformDisplay> PlatformDisplay::createPlatformDisplay()
{
#if PLATFORM(GTK)
#if defined(GTK_API_VERSION_2)
    return std::make_unique<PlatformDisplayX11>(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()));
#else
    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
#if PLATFORM(X11)
    if (GDK_IS_X11_DISPLAY(display))
        return std::make_unique<PlatformDisplayX11>(GDK_DISPLAY_XDISPLAY(display));
#endif
#if PLATFORM(WAYLAND)
    if (GDK_IS_WAYLAND_DISPLAY(display))
        return std::make_unique<PlatformDisplayWayland>(gdk_wayland_display_get_wl_display(display));
#endif
#endif
#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
    return std::make_unique<PlatformDisplayX11>(static_cast<Display*>(ecore_x_display_get()));
#elif PLATFORM(WIN)
    return std::make_unique<PlatformDisplayWin>();
#endif

#if PLATFORM(WAYLAND)
    if (auto platformDisplay = PlatformDisplayWayland::create())
        return platformDisplay;
#endif

#if PLATFORM(X11)
    if (auto platformDisplay = PlatformDisplayX11::create())
        return platformDisplay;
#endif

    // If at this point we still don't have a display, just create a fake display with no native.
#if PLATFORM(WAYLAND)
    return std::make_unique<PlatformDisplayWayland>(nullptr);
#endif
#if PLATFORM(X11)
    return std::make_unique<PlatformDisplayX11>(nullptr);
#endif

    ASSERT_NOT_REACHED();
    return nullptr;
}
Exemple #15
0
static void
_ecore_imf_xim_shutdown(void)
{
   while (open_ims)
     {
        XIM_Im_Info *info = open_ims->data;
        Ecore_X_Display *display = ecore_x_display_get();

        _ecore_imf_xim_info_im_shutdown(display, EINA_FALSE, info);
     }

   ecore_x_shutdown();

   if (_ecore_imf_xim_log_dom > 0)
     {
        eina_log_domain_unregister(_ecore_imf_xim_log_dom);
        _ecore_imf_xim_log_dom = -1;
     }

   eina_shutdown();
}
Exemple #16
0
void
elicit_magnify(Elicit *el)
{
  int x, y;
  int px, py;
  int dw, dh;
  int w, h;

  if (el->conf.show_band)
  {
    if (!el->band)
      el->band = elicit_band_new(el->path.theme);

    elicit_band_show(el->band);
  }

  ecore_x_pointer_last_xy_get(&px, &py);
  elicit_shot_size_get(el->obj.shot, &w, &h);

  x = px - .5 * w;
  y = py - .5 * h;

  /* keep shot within desktop bounds */
  ecore_x_window_size_get(RootWindow(ecore_x_display_get(),0), &dw, &dh);
  if (x < 0) x = 0;
  if (y < 0) y = 0;
  if (x + w > dw) x = dw - w;
  if (y + h > dh) y = dh - h;

  if (el->conf.show_band)
    elicit_band_move_resize(el->band, x-1, y-1, w+2, h+2);

  el->magnify.x = x;
  el->magnify.y = y;
  el->magnify.w = w;
  el->magnify.h = h;

  if (!el->magnify.timer)
    el->magnify.timer = ecore_timer_add(1.0/el->conf.grab_rate, elicit_magnify_timer, el);
}
Exemple #17
0
static Display* getPluginDisplay()
{
#if PLATFORM(QT)
    // At the moment, we only support gdk based plugins (like Flash) that use a different X connection.
    // The code below has the same effect as this one:
    // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());

    QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
    if (!library.load())
        return 0;

    typedef void *(*gdk_init_check_ptr)(void*, void*);
    gdk_init_check_ptr gdk_init_check = (gdk_init_check_ptr)library.resolve("gdk_init_check");
    if (!gdk_init_check)
        return 0;

    typedef void *(*gdk_display_get_default_ptr)();
    gdk_display_get_default_ptr gdk_display_get_default = (gdk_display_get_default_ptr)library.resolve("gdk_display_get_default");
    if (!gdk_display_get_default)
        return 0;

    typedef void *(*gdk_x11_display_get_xdisplay_ptr)(void *);
    gdk_x11_display_get_xdisplay_ptr gdk_x11_display_get_xdisplay = (gdk_x11_display_get_xdisplay_ptr)library.resolve("gdk_x11_display_get_xdisplay");
    if (!gdk_x11_display_get_xdisplay)
        return 0;

    gdk_init_check(0, 0);
    return (Display*)gdk_x11_display_get_xdisplay(gdk_display_get_default());
#elif PLATFORM(GTK)
    // Since we're a gdk/gtk app, we'll (probably?) have the same X connection as any gdk-based
    // plugins, so we can return that. We might want to add other implementations here later.
    return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
    return static_cast<Display*>(ecore_x_display_get());
#else
    return 0;
#endif
}
int create_and_show_basic_popup_min(struct appdata *ad)
{
	Evas_Object *btn1;
	Evas_Object *btn2;

	ad->popup_poweroff = elm_popup_add(ad->win_main);
	if (ad->popup_poweroff == NULL) {
		system_print("\n System-popup : Add popup failed \n");
		return -1;
	}

	evas_object_size_hint_weight_set(ad->popup_poweroff, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_object_text_set(ad->popup_poweroff, _("IDS_ST_BODY_POWER_OFF"));
	elm_object_part_text_set(ad->popup_poweroff, "title,text", _("IDS_COM_BODY_SYSTEM_INFO_ABB"));

	btn1 = elm_button_add(ad->popup_poweroff);
	elm_object_text_set(btn1, _("IDS_COM_SK_OK"));
	elm_object_part_content_set(ad->popup_poweroff, "button1", btn1);
	elm_object_style_set (btn1,"popup_button/default");
	evas_object_smart_callback_add(btn1, "clicked", poweroff_response_yes_cb_min, ad);
	btn2 = elm_button_add(ad->popup_poweroff);
	elm_object_text_set(btn2, _("IDS_COM_SK_CANCEL"));
	elm_object_part_content_set(ad->popup_poweroff, "button2", btn2);
	elm_object_style_set (btn2,"popup_button/default");
	evas_object_smart_callback_add(btn2, "clicked", poweroff_response_no_cb_min, ad);

	Ecore_X_Window xwin;
	xwin = elm_win_xwindow_get(ad->popup_poweroff);
	ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
	utilx_grab_key(ecore_x_display_get(), xwin, KEY_SELECT, SHARED_GRAB);
	ecore_event_handler_add(ECORE_EVENT_KEY_UP, poweroff_response_no_cb_min, NULL);
	evas_object_show(ad->popup_poweroff);
	
	return 0;
	
}
Exemple #19
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
}
void
mp_app_ungrab_mm_keys(struct appdata *ad)
{
	media_key_release();
	utilx_ungrab_key(ecore_x_display_get(), ad->xwin, KEY_MEDIA);
}