Add bindings for ACPI.
authorChristopher Michael <cpmichael1@comcast.net>
Sat, 29 May 2010 19:57:13 +0000 (19:57 +0000)
committerChristopher Michael <cpmichael1@comcast.net>
Sat, 29 May 2010 19:57:13 +0000 (19:57 +0000)
Add acpi bindings to config.
Add handlers in e_acpi for common/default acpi events.
Add actions for some missing ACPI events.
 - NB: Dim/Undim screen do nothing currently except a printf.

SVN revision: 49309

src/bin/e_acpi.c
src/bin/e_actions.c
src/bin/e_actions.h
src/bin/e_bindings.c
src/bin/e_bindings.h
src/bin/e_config.c
src/bin/e_config.h

index d027b62..2946a8e 100644 (file)
@@ -24,6 +24,7 @@ static int _e_acpi_cb_server_del(void *data __UNUSED__, int type __UNUSED__, voi
 static int _e_acpi_cb_server_data(void *data __UNUSED__, int type __UNUSED__, void *event);
 static void _e_acpi_cb_event_free(void *data __UNUSED__, void *event);
 static int _e_acpi_lid_status_get(const char *device, const char *bus);
+static int _e_acpi_cb_event(void *data __UNUSED__, int type __UNUSED__, void *event);
 
 /* local variables */
 static Ecore_Con_Server *_e_acpid = NULL;
@@ -98,6 +99,24 @@ e_acpi_init(void)
      eina_list_append(_e_acpid_hdls, 
                      ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, 
                                              _e_acpi_cb_server_data, NULL));
+
+   /* Add handlers for standard acpi events */
+   _e_acpid_hdls = 
+     eina_list_append(_e_acpid_hdls, 
+                     ecore_event_handler_add(E_EVENT_ACPI_AC_ADAPTER, 
+                                             _e_acpi_cb_event, NULL));
+   _e_acpid_hdls = 
+     eina_list_append(_e_acpid_hdls, 
+                     ecore_event_handler_add(E_EVENT_ACPI_LID, 
+                                             _e_acpi_cb_event, NULL));
+   _e_acpid_hdls = 
+     eina_list_append(_e_acpid_hdls, 
+                     ecore_event_handler_add(E_EVENT_ACPI_POWER, 
+                                             _e_acpi_cb_event, NULL));
+   _e_acpid_hdls = 
+     eina_list_append(_e_acpid_hdls, 
+                     ecore_event_handler_add(E_EVENT_ACPI_SLEEP, 
+                                             _e_acpi_cb_event, NULL));
    return 1;
 }
 
@@ -274,3 +293,13 @@ _e_acpi_lid_status_get(const char *device, const char *bus)
    else
      return E_ACPI_LID_UNKNOWN;
 }
+
+static int 
+_e_acpi_cb_event(void *data __UNUSED__, int type __UNUSED__, void *event) 
+{
+   E_Event_Acpi *ev;
+
+   ev = event;
+   e_bindings_acpi_event_handle(E_BINDING_CONTEXT_NONE, NULL, ev);
+   return 1;
+}
index 36eb494..1e913ad 100644 (file)
    }
 #define ACT_FN_END_KEY(act) \
    static void _e_actions_act_##act##_end_key(E_Object *obj, const char *params, Ecore_Event_Key *ev)
+#define ACT_GO_ACPI(name) \
+   { \
+      act = e_action_add(#name); \
+      if (act) act->func.go_acpi = _e_actions_act_##name##_go_acpi; \
+   }
+#define ACT_FN_GO_ACPI(act) \
+   static void _e_actions_act_##act##_go_acpi(E_Object *obj, const char *params, E_Event_Acpi *ev)
 
 /* local subsystem functions */
 static void _e_action_free(E_Action *act);
@@ -2497,6 +2504,16 @@ ACT_FN_END_MOUSE(delayed_action)
    _delayed_action_mouse_del(obj, params, ev);
 }
 
+ACT_FN_GO_ACPI(dim_screen) 
+{
+   printf("Dim Screen\n");
+}
+
+ACT_FN_GO_ACPI(undim_screen) 
+{
+   printf("Undim Screen\n");
+}
+
 /* local subsystem globals */
 static Eina_Hash *actions = NULL;
 static Eina_List *action_list = NULL;
@@ -2915,6 +2932,14 @@ e_actions_init(void)
    ACT_END_KEY(delayed_action);
    ACT_END_MOUSE(delayed_action);
 
+   ACT_GO_ACPI(dim_screen);
+   e_action_predef_name_set(_("Acpi"), _("Dim Screen"), "dim_screen", 
+                           NULL, NULL, 0);
+
+   ACT_GO_ACPI(undim_screen);
+   e_action_predef_name_set(_("Acpi"), _("Undim Screen"), "undim_screen", 
+                           NULL, NULL, 0);
+
    return 1;
 }
 
index 1f381d2..29aa013 100644 (file)
@@ -15,20 +15,22 @@ typedef struct _E_Action_Group E_Action_Group;
 
 struct _E_Action
 {
-   E_Object             e_obj_inherit;
-   
+   E_Object e_obj_inherit;
+
    const char *name;
-   struct {
-      void (*go)        (E_Object *obj, const char *params);
-      void (*go_mouse)  (E_Object *obj, const char *params, Ecore_Event_Mouse_Button *ev);
-      void (*go_wheel)  (E_Object *obj, const char *params, Ecore_Event_Mouse_Wheel *ev);
-      void (*go_edge)   (E_Object *obj, const char *params, E_Event_Zone_Edge *ev);
-      void (*go_key)    (E_Object *obj, const char *params, Ecore_Event_Key *ev);
-      void (*go_signal) (E_Object *obj, const char *params, const char *sig, const char *src);
-      void (*end)       (E_Object *obj, const char *params);
-      void (*end_mouse) (E_Object *obj, const char *params, Ecore_Event_Mouse_Button *ev);
-      void (*end_key)   (E_Object *obj, const char *params, Ecore_Event_Key *ev);
-   } func;
+   struct 
+     {
+       void (*go)        (E_Object *obj, const char *params);
+       void (*go_mouse)  (E_Object *obj, const char *params, Ecore_Event_Mouse_Button *ev);
+       void (*go_wheel)  (E_Object *obj, const char *params, Ecore_Event_Mouse_Wheel *ev);
+       void (*go_edge)   (E_Object *obj, const char *params, E_Event_Zone_Edge *ev);
+       void (*go_key)    (E_Object *obj, const char *params, Ecore_Event_Key *ev);
+       void (*go_signal) (E_Object *obj, const char *params, const char *sig, const char *src);
+       void (*go_acpi)   (E_Object *obj, const char *params, E_Event_Acpi *ev);
+       void (*end)       (E_Object *obj, const char *params);
+       void (*end_mouse) (E_Object *obj, const char *params, Ecore_Event_Mouse_Button *ev);
+       void (*end_key)   (E_Object *obj, const char *params, Ecore_Event_Key *ev);
+     } func;
 };
 
 struct _E_Action_Description
index 6f2e58a..cf4ef1c 100644 (file)
@@ -10,18 +10,20 @@ static void _e_bindings_key_free(E_Binding_Key *bind);
 static void _e_bindings_edge_free(E_Binding_Edge *bind);
 static void _e_bindings_signal_free(E_Binding_Signal *bind);
 static void _e_bindings_wheel_free(E_Binding_Wheel *bind);
+static void _e_bindings_acpi_free(E_Binding_Acpi *bind);
 static int _e_bindings_context_match(E_Binding_Context bctxt, E_Binding_Context ctxt);
 static E_Binding_Modifier _e_bindings_modifiers(unsigned int modifiers);
 static int _e_ecore_modifiers(E_Binding_Modifier modifiers);
-static int  _e_bindings_edge_cb_timer(void *data);
+static int _e_bindings_edge_cb_timer(void *data);
 
 /* local subsystem globals */
 
-static Eina_List *mouse_bindings  = NULL;
-static Eina_List *key_bindings    = NULL;
-static Eina_List *edge_bindings   = NULL;
+static Eina_List *mouse_bindings = NULL;
+static Eina_List *key_bindings = NULL;
+static Eina_List *edge_bindings = NULL;
 static Eina_List *signal_bindings = NULL;
-static Eina_List *wheel_bindings  = NULL;
+static Eina_List *wheel_bindings = NULL;
+static Eina_List *acpi_bindings = NULL;
 
 typedef struct _E_Binding_Edge_Data E_Binding_Edge_Data;
 
@@ -43,6 +45,7 @@ e_bindings_init(void)
    E_Config_Binding_Wheel *ebw;
    E_Config_Binding_Edge *ebe;
    E_Config_Binding_Key *ebk;
+   E_Config_Binding_Acpi *eba;
    Eina_List *l;
 
    EINA_LIST_FOREACH(e_config->mouse_bindings, l, ebm)
@@ -69,6 +72,7 @@ e_bindings_init(void)
            (!strncmp(ebs->source, "e.event.resize.", 15)))
          {
             char params[32];
+
             snprintf(params, sizeof(params), "resize_%s", ebs->params);
             e_bindings_signal_add(ebs->context, "mouse,in", ebs->source, ebs->modifiers,
                                   ebs->any_mod, "pointer_resize_push", params);
@@ -81,6 +85,10 @@ e_bindings_init(void)
      e_bindings_wheel_add(ebw->context, ebw->direction, ebw->z, ebw->modifiers,
                          ebw->any_mod, ebw->action, ebw->params);
 
+   EINA_LIST_FOREACH(e_config->acpi_bindings, l, eba)
+     e_bindings_acpi_add(eba->context, eba->type, eba->status, 
+                        eba->action, eba->params);
+
    return 1;
 }
 
@@ -92,6 +100,7 @@ e_bindings_shutdown(void)
    E_FREE_LIST(edge_bindings, _e_bindings_edge_free);
    E_FREE_LIST(signal_bindings, _e_bindings_signal_free);
    E_FREE_LIST(wheel_bindings, _e_bindings_wheel_free);
+   E_FREE_LIST(acpi_bindings, _e_bindings_acpi_free);
 
    return 1;
 }
@@ -730,7 +739,7 @@ EAPI void
 e_bindings_wheel_add(E_Binding_Context ctxt, int direction, int z, E_Binding_Modifier mod, int any_mod, const char *action, const char *params)
 {
    E_Binding_Wheel *bind;
-   
+
    bind = calloc(1, sizeof(E_Binding_Wheel));
    bind->ctxt = ctxt;
    bind->direction = direction;
@@ -871,6 +880,83 @@ e_bindings_wheel_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_Event
    return act;
 }
 
+EAPI void 
+e_bindings_acpi_add(E_Binding_Context ctxt, int type, int status, const char *action, const char *params) 
+{
+   E_Binding_Acpi *bind;
+
+   bind = E_NEW(E_Binding_Acpi, 1);
+   bind->ctxt = ctxt;
+   bind->type = type;
+   bind->status = status;
+   if (action) bind->action = eina_stringshare_add(action);
+   if (params) bind->params = eina_stringshare_add(params);
+   acpi_bindings = eina_list_append(acpi_bindings, bind);
+}
+
+EAPI void 
+e_bindings_acpi_del(E_Binding_Context ctxt, int type, int status, const char *action, const char *params) 
+{
+   E_Binding_Acpi *bind;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(acpi_bindings, l, bind)
+     {
+       if ((bind->ctxt == ctxt) &&
+           (bind->type == type) && (bind->status == status) && 
+           (((bind->action) && (action) && (!strcmp(bind->action, action))) ||
+               ((!bind->action) && (!action))) &&
+           (((bind->params) && (params) && (!strcmp(bind->params, params))) ||
+               ((!bind->params) && (!params))))
+         {
+            _e_bindings_acpi_free(bind);
+            acpi_bindings = eina_list_remove_list(acpi_bindings, l);
+            break;
+         }
+     }
+}
+
+EAPI E_Action *
+e_bindings_acpi_find(E_Binding_Context ctxt, E_Object *obj, E_Event_Acpi *ev, E_Binding_Acpi **bind_ret) 
+{
+   E_Binding_Acpi *bind;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(acpi_bindings, l, bind)
+     {
+       if ((bind->type == ev->type) && (bind->status == ev->status))
+         {
+            if (_e_bindings_context_match(bind->ctxt, ctxt))
+              {
+                 E_Action *act;
+
+                 act = e_action_find(bind->action);
+                 if (bind_ret) *bind_ret = bind;
+                 return act;
+              }
+         }
+     }
+   return NULL;
+}
+
+EAPI E_Action *
+e_bindings_acpi_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Acpi *ev) 
+{
+   E_Action *act;
+   E_Binding_Acpi *bind;
+
+   act = e_bindings_acpi_find(ctxt, obj, ev, &bind);
+   if (act)
+     {
+       if (act->func.go_acpi)
+         act->func.go_acpi(obj, bind->params, ev);
+       else if (act->func.go)
+         act->func.go(obj, bind->params);
+       return act;
+     }
+   return act;
+}
+
 /* local subsystem functions */
 
 static void
@@ -923,6 +1009,14 @@ _e_bindings_wheel_free(E_Binding_Wheel *bind)
    free(bind);
 }
 
+static void 
+_e_bindings_acpi_free(E_Binding_Acpi *bind) 
+{
+   if (bind->action) eina_stringshare_del(bind->action);
+   if (bind->params) eina_stringshare_del(bind->params);
+   E_FREE(bind);
+}
+
 static int
 _e_bindings_context_match(E_Binding_Context bctxt, E_Binding_Context ctxt)
 {
index 3ea24d2..1a0cd64 100644 (file)
@@ -35,6 +35,7 @@ typedef struct _E_Binding_Key    E_Binding_Key;
 typedef struct _E_Binding_Edge   E_Binding_Edge;
 typedef struct _E_Binding_Signal E_Binding_Signal;
 typedef struct _E_Binding_Wheel  E_Binding_Wheel;
+typedef struct _E_Binding_Acpi   E_Binding_Acpi;
 
 #else
 #ifndef E_BINDINGS_H
@@ -95,6 +96,13 @@ struct _E_Binding_Wheel
    const char *params;
 };
 
+struct _E_Binding_Acpi 
+{
+   E_Binding_Context ctxt;
+   int type, status;
+   const char *action, *params;
+};
+
 EAPI int         e_bindings_init(void);
 EAPI int         e_bindings_shutdown(void);
 
@@ -135,5 +143,10 @@ EAPI void        e_bindings_wheel_ungrab(E_Binding_Context ctxt, Ecore_X_Window
 EAPI E_Action   *e_bindings_wheel_find(E_Binding_Context ctxt, E_Object *obj, Ecore_Event_Mouse_Wheel *ev, E_Binding_Wheel **bind_ret);
 EAPI E_Action   *e_bindings_wheel_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_Event_Mouse_Wheel *ev);
 
+EAPI void e_bindings_acpi_add(E_Binding_Context ctxt, int type, int status, const char *action, const char *params);
+EAPI void e_bindings_acpi_del(E_Binding_Context ctxt, int type, int status, const char *action, const char *params);
+EAPI E_Action *e_bindings_acpi_find(E_Binding_Context ctxt, E_Object *obj, E_Event_Acpi *ev, E_Binding_Acpi **bind_ret);
+EAPI E_Action *e_bindings_acpi_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Acpi *ev);
+
 #endif
 #endif
index d82c574..93bb842 100644 (file)
@@ -16,8 +16,9 @@ static int _e_config_revisions = 0;
 /* local subsystem functions */
 static void _e_config_save_cb(void *data);
 static void _e_config_free(E_Config *cfg);
-static int  _e_config_cb_timer(void *data);
-static int  _e_config_eet_close_handle(Eet_File *ef, char *file);
+static int _e_config_cb_timer(void *data);
+static int _e_config_eet_close_handle(Eet_File *ef, char *file);
+static void _e_config_acpi_bindings_add(void);
 
 /* local subsystem globals */
 static int _e_config_save_block = 0;
@@ -34,6 +35,7 @@ static E_Config_DD *_e_config_bindings_key_edd = NULL;
 static E_Config_DD *_e_config_bindings_edge_edd = NULL;
 static E_Config_DD *_e_config_bindings_signal_edd = NULL;
 static E_Config_DD *_e_config_bindings_wheel_edd = NULL;
+static E_Config_DD *_e_config_bindings_acpi_edd = NULL;
 static E_Config_DD *_e_config_path_append_edd = NULL;
 static E_Config_DD *_e_config_desktop_bg_edd = NULL;
 static E_Config_DD *_e_config_desktop_name_edd = NULL;
@@ -358,6 +360,18 @@ e_config_init(void)
    E_CONFIG_VAL(D, T, action, STR);
    E_CONFIG_VAL(D, T, params, STR);
 
+   _e_config_bindings_acpi_edd = E_CONFIG_DD_NEW("E_Config_Binding_Acpi", 
+                                                E_Config_Binding_Acpi);
+#undef T
+#undef D
+#define T E_Config_Binding_Acpi
+#define D _e_config_bindings_acpi_edd
+   E_CONFIG_VAL(D, T, context, INT);
+   E_CONFIG_VAL(D, T, type, INT);
+   E_CONFIG_VAL(D, T, status, INT);
+   E_CONFIG_VAL(D, T, action, STR);
+   E_CONFIG_VAL(D, T, params, STR);
+
    _e_config_remember_edd = E_CONFIG_DD_NEW("E_Remember", E_Remember);
 #undef T
 #undef D
@@ -512,6 +526,7 @@ e_config_init(void)
    E_CONFIG_LIST(D, T, edge_bindings, _e_config_bindings_edge_edd); /**/
    E_CONFIG_LIST(D, T, signal_bindings, _e_config_bindings_signal_edd); /**/
    E_CONFIG_LIST(D, T, wheel_bindings, _e_config_bindings_wheel_edd); /**/
+   E_CONFIG_LIST(D, T, acpi_bindings, _e_config_bindings_acpi_edd); /**/
    E_CONFIG_LIST(D, T, path_append_data, _e_config_path_append_edd); /**/
    E_CONFIG_LIST(D, T, path_append_images, _e_config_path_append_edd); /**/
    E_CONFIG_LIST(D, T, path_append_fonts, _e_config_path_append_edd); /**/
@@ -754,6 +769,7 @@ e_config_shutdown(void)
    E_CONFIG_DD_FREE(_e_config_bindings_edge_edd);
    E_CONFIG_DD_FREE(_e_config_bindings_signal_edd);
    E_CONFIG_DD_FREE(_e_config_bindings_wheel_edd);
+   E_CONFIG_DD_FREE(_e_config_bindings_acpi_edd);
    E_CONFIG_DD_FREE(_e_config_path_append_edd);
    E_CONFIG_DD_FREE(_e_config_desktop_bg_edd);
    E_CONFIG_DD_FREE(_e_config_desktop_name_edd);
@@ -979,6 +995,10 @@ e_config_load(void)
         COPYVAL(exec.show_exit_dialog);
         IFCFGEND;
 
+       IFCFG(0x0136);
+       _e_config_acpi_bindings_add();
+       IFCFGEND;
+
         e_config->config_version = E_CONFIG_FILE_VERSION;   
         _e_config_free(tcfg);
      }
@@ -1582,7 +1602,7 @@ e_config_binding_wheel_match(E_Config_Binding_Wheel *eb_in)
 {
    Eina_List *l;
    E_Config_Binding_Wheel *eb;
-  
+
    EINA_LIST_FOREACH(e_config->wheel_bindings, l, eb)
      {
        if ((eb->context == eb_in->context) &&
@@ -1591,9 +1611,31 @@ e_config_binding_wheel_match(E_Config_Binding_Wheel *eb_in)
            (eb->modifiers == eb_in->modifiers) &&
            (eb->any_mod == eb_in->any_mod) &&
            (((eb->action) && (eb_in->action) && (!strcmp(eb->action, eb_in->action))) ||
-            ((!eb->action) && (!eb_in->action))) &&
+               ((!eb->action) && (!eb_in->action))) &&
            (((eb->params) && (eb_in->params) && (!strcmp(eb->params, eb_in->params))) ||
-            ((!eb->params) && (!eb_in->params))))
+               ((!eb->params) && (!eb_in->params))))
+         return eb;
+     }
+   return NULL;
+}
+
+EAPI E_Config_Binding_Acpi *
+e_config_binding_acpi_match(E_Config_Binding_Acpi *eb_in) 
+{
+   Eina_List *l;
+   E_Config_Binding_Acpi *eb;
+
+   EINA_LIST_FOREACH(e_config->acpi_bindings, l, eb)
+     {
+       if ((eb->context == eb_in->context) &&
+           (eb->type == eb_in->type) && 
+           (eb->status == eb_in->status) && 
+           (((eb->action) && (eb_in->action) && 
+             (!strcmp(eb->action, eb_in->action))) ||
+               ((!eb->action) && (!eb_in->action))) &&
+           (((eb->params) && (eb_in->params) && 
+             (!strcmp(eb->params, eb_in->params))) ||
+               ((!eb->params) && (!eb_in->params))))
          return eb;
      }
    return NULL;
@@ -1624,6 +1666,7 @@ _e_config_free(E_Config *ecf)
    E_Config_Syscon_Action *sca;
    E_Config_Binding_Key *ebk;
    E_Config_Binding_Edge *ebe;
+   E_Config_Binding_Acpi *eba;
    E_Font_Fallback *eff;
    E_Config_Module *em;
    E_Font_Default *efd;
@@ -1689,6 +1732,12 @@ _e_config_free(E_Config *ecf)
         if (ebw->params) eina_stringshare_del(ebw->params);
         E_FREE(ebw);
      }
+   EINA_LIST_FREE(ecf->acpi_bindings, eba)
+     {
+        if (eba->action) eina_stringshare_del(eba->action);
+        if (eba->params) eina_stringshare_del(eba->params);
+        E_FREE(eba);
+     }
    EINA_LIST_FREE(ecf->path_append_data, epd)
      {
         if (epd->dir) eina_stringshare_del(epd->dir);
@@ -1890,3 +1939,49 @@ _e_config_eet_close_handle(Eet_File *ef, char *file)
      }
    return 1;
 }
+
+static void 
+_e_config_acpi_bindings_add(void) 
+{
+   E_Config_Binding_Acpi *bind;
+
+   bind = E_NEW(E_Config_Binding_Acpi, 1);
+   bind->context = E_BINDING_CONTEXT_NONE;
+   bind->type = E_ACPI_TYPE_AC_ADAPTER;
+   bind->status = 0;
+   bind->action = eina_stringshare_add("dim_screen");
+   bind->params = NULL;
+   e_config->acpi_bindings = eina_list_append(e_config->acpi_bindings, bind);
+
+   bind = E_NEW(E_Config_Binding_Acpi, 1);
+   bind->context = E_BINDING_CONTEXT_NONE;
+   bind->type = E_ACPI_TYPE_AC_ADAPTER;
+   bind->status = 1;
+   bind->action = eina_stringshare_add("undim_screen");
+   bind->params = NULL;
+   e_config->acpi_bindings = eina_list_append(e_config->acpi_bindings, bind);
+
+   bind = E_NEW(E_Config_Binding_Acpi, 1);
+   bind->context = E_BINDING_CONTEXT_NONE;
+   bind->type = E_ACPI_TYPE_LID;
+   bind->status = 0;
+   bind->action = eina_stringshare_add("suspend");
+   bind->params = eina_stringshare_add("now");
+   e_config->acpi_bindings = eina_list_append(e_config->acpi_bindings, bind);
+
+   bind = E_NEW(E_Config_Binding_Acpi, 1);
+   bind->context = E_BINDING_CONTEXT_NONE;
+   bind->type = E_ACPI_TYPE_POWER;
+   bind->status = 0;
+   bind->action = eina_stringshare_add("halt_now");
+   bind->params = eina_stringshare_add("now");
+   e_config->acpi_bindings = eina_list_append(e_config->acpi_bindings, bind);
+
+   bind = E_NEW(E_Config_Binding_Acpi, 1);
+   bind->context = E_BINDING_CONTEXT_NONE;
+   bind->type = E_ACPI_TYPE_SLEEP;
+   bind->status = 0;
+   bind->action = eina_stringshare_add("suspend");
+   bind->params = eina_stringshare_add("now");
+   e_config->acpi_bindings = eina_list_append(e_config->acpi_bindings, bind);
+}
index cf2696d..4cd1ed8 100644 (file)
@@ -13,6 +13,7 @@ typedef struct _E_Config_Binding_Key        E_Config_Binding_Key;
 typedef struct _E_Config_Binding_Edge       E_Config_Binding_Edge;
 typedef struct _E_Config_Binding_Signal     E_Config_Binding_Signal;
 typedef struct _E_Config_Binding_Wheel      E_Config_Binding_Wheel;
+typedef struct _E_Config_Binding_Acpi       E_Config_Binding_Acpi;
 typedef struct _E_Config_Desktop_Background E_Config_Desktop_Background;
 typedef struct _E_Config_Desktop_Name       E_Config_Desktop_Name;
 typedef struct _E_Config_Gadcon             E_Config_Gadcon;
@@ -21,7 +22,6 @@ typedef struct _E_Config_Shelf              E_Config_Shelf;
 typedef struct _E_Config_Shelf_Desk         E_Config_Shelf_Desk;
 typedef struct _E_Config_Mime_Icon          E_Config_Mime_Icon;
 typedef struct _E_Config_Syscon_Action      E_Config_Syscon_Action;
-
 typedef struct _E_Event_Config_Icon_Theme   E_Event_Config_Icon_Theme;
 
 #else
@@ -35,7 +35,7 @@ typedef struct _E_Event_Config_Icon_Theme   E_Event_Config_Icon_Theme;
 /* increment this whenever a new set of config values are added but the users
  * config doesn't need to be wiped - simply new values need to be put in
  */
-#define E_CONFIG_FILE_GENERATION 0x0135
+#define E_CONFIG_FILE_GENERATION 0x0136
 #define E_CONFIG_FILE_VERSION    ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
 
 #define E_EVAS_ENGINE_DEFAULT         0
@@ -104,6 +104,7 @@ struct _E_Config
    Eina_List  *edge_bindings; // GUI
    Eina_List  *signal_bindings;
    Eina_List  *wheel_bindings; // GUI
+   Eina_List  *acpi_bindings; // GUI
    Eina_List  *path_append_data; // GUI
    Eina_List  *path_append_images; // GUI
    Eina_List  *path_append_fonts; // GUI
@@ -417,6 +418,12 @@ struct _E_Config_Binding_Wheel
    const char    *params;
 };
 
+struct _E_Config_Binding_Acpi 
+{
+   int context, type, status;
+   const char *action, *params;
+};
+
 struct _E_Config_Desktop_Background
 {
    int            container;
@@ -528,6 +535,7 @@ EAPI E_Config_Binding_Key    *e_config_binding_key_match(E_Config_Binding_Key *e
 EAPI E_Config_Binding_Edge   *e_config_binding_edge_match(E_Config_Binding_Edge *eb_in);
 EAPI E_Config_Binding_Signal *e_config_binding_signal_match(E_Config_Binding_Signal *eb_in);
 EAPI E_Config_Binding_Wheel  *e_config_binding_wheel_match(E_Config_Binding_Wheel *eb_in);
+EAPI E_Config_Binding_Acpi   *e_config_binding_acpi_match(E_Config_Binding_Acpi *eb_in);
 EAPI void                     e_config_mode_changed(void);
 
 extern EAPI E_Config *e_config;