2012-12-17 01:19:05 -08:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
2015-01-25 05:43:33 -08:00
|
|
|
#include "e_int_config_randr2.h"
|
2012-12-17 01:19:05 -08:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Module_Api e_modapi =
|
2012-12-17 01:19:05 -08:00
|
|
|
{
|
|
|
|
E_MODULE_API_VERSION, "Settings - Screen Setup"
|
|
|
|
};
|
|
|
|
|
2015-05-16 07:18:32 -07:00
|
|
|
static Ecore_Event_Handler *randr_event_hand = NULL;
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_cb_randr(void *data EINA_UNUSED, int type EINA_UNUSED, void *info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
E_Randr2_Screen *s;
|
|
|
|
|
2017-06-30 07:25:24 -07:00
|
|
|
if (!e_randr2) return ECORE_CALLBACK_RENEW;
|
2015-05-16 07:18:32 -07:00
|
|
|
EINA_LIST_FOREACH(e_randr2->screens, l, s)
|
|
|
|
{
|
|
|
|
if (!s->config.configured)
|
|
|
|
{
|
|
|
|
// XXX: we should put up a dialog asking to configure screen s
|
|
|
|
printf("RRR: New unconfigured screen on %s\n", s->info.name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void *
|
2012-12-17 01:19:05 -08:00
|
|
|
e_modapi_init(E_Module *m)
|
|
|
|
{
|
2012-12-17 01:20:07 -08:00
|
|
|
/* create Screen configuration category
|
|
|
|
*
|
|
|
|
* NB: If the category already exists, this function just returns */
|
2015-01-25 05:43:33 -08:00
|
|
|
e_configure_registry_category_add("screen", 30, _("Screen"),
|
2012-12-17 01:19:05 -08:00
|
|
|
NULL, "preferences-desktop-display");
|
2012-12-17 01:20:07 -08:00
|
|
|
|
|
|
|
/* add the randr dialog to the screen category and provide
|
|
|
|
* the configure category with the function to call */
|
2015-01-25 05:43:33 -08:00
|
|
|
e_configure_registry_item_add("screen/screen_setup", 20, _("Screen Setup"),
|
|
|
|
NULL, "preferences-system-screen-resolution",
|
|
|
|
e_int_config_randr2);
|
2015-05-16 07:18:32 -07:00
|
|
|
randr_event_hand = ecore_event_handler_add(E_EVENT_RANDR_CHANGE,
|
|
|
|
_cb_randr, NULL);
|
2012-12-17 01:19:05 -08:00
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
2012-12-17 01:19:05 -08:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
|
2015-05-16 07:18:32 -07:00
|
|
|
if (randr_event_hand)
|
|
|
|
{
|
|
|
|
ecore_event_handler_del(randr_event_hand);
|
|
|
|
randr_event_hand = NULL;
|
|
|
|
}
|
|
|
|
|
2012-12-17 01:19:10 -08:00
|
|
|
while ((cfd = e_config_dialog_get("E", "screen/screen_setup")))
|
2012-12-17 01:19:05 -08:00
|
|
|
e_object_del(E_OBJECT(cfd));
|
|
|
|
|
2012-12-17 01:19:10 -08:00
|
|
|
e_configure_registry_item_del("screen/screen_setup");
|
2012-12-17 01:19:05 -08:00
|
|
|
e_configure_registry_category_del("screen");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
e_modapi_save(E_Module *m EINA_UNUSED)
|
2012-12-17 01:19:05 -08:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|