Exemple #1
0
/**
 * @return EINA_TRUE if info could be refreshed, else EINA_FALSE
 */
static Eina_Bool
_screen_info_refresh(void)
{
   Ecore_X_Window *roots;
   Ecore_X_Window root;
   int n;

   EINA_SAFETY_ON_FALSE_RETURN_VAL(ecore_x_randr_query(), EINA_FALSE);

   if (!(roots = ecore_x_window_root_list(&n))) return EINA_FALSE;
   /* first (and only) root window */
   root = roots[0];
   free(roots);

   e_randr_screen_info.randr_version = ecore_x_randr_version_get();
   e_randr_screen_info.root = root;
   e_randr_screen_info.rrvd_info.randr_info_11 = NULL;

   // Value set/retrieval helper functions
   if (e_randr_screen_info.randr_version == ECORE_X_RANDR_1_1)
     {
        return _11_screen_info_refresh();
     }
   else if (e_randr_screen_info.randr_version >= ECORE_X_RANDR_1_2)
     {
        return _12_screen_info_refresh();
     }

   return EINA_FALSE;
}
Exemple #2
0
Eina_Bool
e_mod_comp_wl_output_init(void)
{
   Ecore_X_Window *roots;
   int num = 0, rw, rh;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);

   roots = ecore_x_window_root_list(&num);
   if ((!roots) || (num <= 0))
     {
        EINA_LOG_ERR("Could not get root window list\n");
        return EINA_FALSE;
     }
   ecore_x_window_size_get(roots[0], &rw, &rh);
   free(roots);

   if (!(_wl_output = malloc(sizeof(Wayland_Output))))
     {
        EINA_LOG_ERR("Could not allocate space for output\n");
        return EINA_FALSE;
     }

   memset(_wl_output, 0, sizeof(*_wl_output));

   _wl_output->mode.flags =
     (WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED);
   _wl_output->mode.w = rw;
   _wl_output->mode.h = rh;
   _wl_output->mode.refresh = 60;

   _wl_output->x = 0;
   _wl_output->y = 0;
   _wl_output->w = rw;
   _wl_output->h = rh;
   _wl_output->flags = WL_OUTPUT_FLIPPED;

   wl_list_init(&_wl_output->link);
   wl_list_init(&_wl_output->frame_callbacks);

   if (!wl_display_add_global(_wl_disp, &wl_output_interface, _wl_output,
                              _e_mod_comp_wl_output_bind))
     {
        EINA_LOG_ERR("Failed to add output to wayland\n");
        free(_wl_output);
        return EINA_FALSE;
     }

   return EINA_TRUE;
}
static void
_ecore_x_window_tree_shadow_populate(void)
{
   Ecore_X_Window *roots = NULL;
   int i = 0, num = 0;

   if ((roots = ecore_x_window_root_list(&num)))
     {
        shadow_base = calloc(1, sizeof(Shadow *) * num);
        if (shadow_base)
          {
             shadow_num = num;
             for (i = 0; i < num; i++)
               shadow_base[i] = _ecore_x_window_tree_walk(roots[i]);
          }

        free(roots);
     }
}
Exemple #4
0
EAPI int 
elm_main(int argc, char **argv) 
{
   Ecore_X_Window *roots = NULL;
   int num = 0, i = 0;

   roots = ecore_x_window_root_list(&num);
   if ((!roots) || (num <= 0)) return EXIT_FAILURE;

   for (i = 0; i < num; i++) 
     {
        Ecore_X_Window *zones;
        int x = 0, count = 0;

        count = 
          ecore_x_window_prop_window_list_get(roots[i], 
                                         ECORE_X_ATOM_E_ILLUME_ZONE_LIST, 
                                         &zones);
        if (!zones) continue;
        for (x = 0; x < count; x++) 
          {
             Evas_Object *win;
             Evas_Object *bg, *box, *btn, *icon;
             Ecore_X_Window xwin;
             Ecore_X_Window_State states[2];
             char buff[PATH_MAX];
             int zx, zy, zw, zh;

             /* create new window */
             win = elm_win_add(NULL, "Illume-Softkey", ELM_WIN_DOCK);
             elm_win_title_set(win, "Illume Softkey");
             evas_object_smart_callback_add(win, "delete-request", 
                                            _cb_win_del, NULL);
             evas_object_data_set(win, "zone", (const void *)zones[x]);

             xwin = elm_win_xwindow_get(win);
             ecore_x_icccm_hints_set(xwin, 0, 0, 0, 0, 0, 0, 0);
             states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
             states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
             ecore_x_netwm_window_state_set(xwin, states, 2);

             bg = elm_bg_add(win);
             evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, 
                                              EVAS_HINT_EXPAND);
             elm_win_resize_object_add(win, bg);
             evas_object_show(bg);

             box = elm_box_add(win);
             elm_box_horizontal_set(box, EINA_TRUE);
             evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 
                                              EVAS_HINT_EXPAND);
             elm_win_resize_object_add(win, box);
             evas_object_show(box);

             icon = elm_icon_add(win);
             snprintf(buff, sizeof(buff), "%s/images/back.png", 
                      PACKAGE_DATA_DIR);
             elm_icon_file_set(icon, buff, NULL);
             evas_object_size_hint_aspect_set(icon, 
                                              EVAS_ASPECT_CONTROL_VERTICAL, 
                                              1, 1);

             btn = elm_button_add(win);
             elm_button_icon_set(btn, icon);
             evas_object_smart_callback_add(btn, "clicked", 
                                            _cb_btn_back_clicked, win);
             evas_object_size_hint_align_set(btn, 1.0, 0.5);
             elm_box_pack_end(box, btn);
             evas_object_show(btn);
             evas_object_show(icon);

             icon = elm_icon_add(win);
             snprintf(buff, sizeof(buff), "%s/images/close.png", 
                      PACKAGE_DATA_DIR);
             elm_icon_file_set(icon, buff, NULL);
             evas_object_size_hint_aspect_set(icon, 
                                              EVAS_ASPECT_CONTROL_VERTICAL, 
                                              1, 1);

             btn = elm_button_add(win);
             elm_button_icon_set(btn, icon);
             evas_object_smart_callback_add(btn, "clicked", 
                                            _cb_btn_close_clicked, win);
             evas_object_size_hint_align_set(btn, 1.0, 0.5);
             elm_box_pack_end(box, btn);
             evas_object_show(btn);
             evas_object_show(icon);

             ecore_x_window_geometry_get(zones[x], &zx, &zy, &zw, &zh);
             ecore_x_e_illume_softkey_geometry_set(zones[x], zx, 
                                                   (zy + zh - 40), zw, 40);

             evas_object_move(win, zx, (zy + zh - 40));
             evas_object_resize(win, zw, 40);
             evas_object_show(win);
          }
        free(zones);
     }
   free(roots);

   elm_run();

   elm_shutdown();
   return EXIT_SUCCESS;
}