Add a way to freeze incoming acpi events.
NB: To be used in the acpi bindings config dialog. This allows us to freeze all existing events so that if the user presses the power button (or something else) when adding a new binding, their machine does not power off. SVN revision: 49416
This commit is contained in:
parent
674405cd55
commit
97d4239b35
|
@ -27,6 +27,7 @@ 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 int _e_acpi_events_frozen = 0;
|
||||
static Ecore_Con_Server *_e_acpid = NULL;
|
||||
static Eina_List *_e_acpid_hdls = NULL;
|
||||
static Eina_Hash *_e_acpid_devices = NULL;
|
||||
|
@ -139,6 +140,18 @@ e_acpi_shutdown(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_acpi_events_freeze(void)
|
||||
{
|
||||
_e_acpi_events_frozen++;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_acpi_events_thaw(void)
|
||||
{
|
||||
_e_acpi_events_frozen--;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static int
|
||||
_e_acpi_cb_server_del(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
|
@ -178,14 +191,6 @@ _e_acpi_cb_server_data(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
if (sscanf(ev->data, "%s %s %d %d", device, bus, &sig, &status) != 4)
|
||||
return 1;
|
||||
|
||||
/*
|
||||
printf("Device: %s\n", device);
|
||||
printf("Bus: %s\n", bus);
|
||||
printf("Signal: %d\n", sig);
|
||||
printf("Status: %d\n", status);
|
||||
printf("\n");
|
||||
*/
|
||||
|
||||
/* create new event structure to raise */
|
||||
acpi_event = E_NEW(E_Event_Acpi, 1);
|
||||
acpi_event->bus_id = eina_stringshare_add(bus);
|
||||
|
@ -300,6 +305,7 @@ _e_acpi_cb_event(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
E_Event_Acpi *ev;
|
||||
|
||||
ev = event;
|
||||
if (_e_acpi_events_frozen > 0) return 1;
|
||||
e_bindings_acpi_event_handle(E_BINDING_CONTEXT_NONE, NULL, ev);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,8 @@ struct _E_Event_Acpi
|
|||
|
||||
EAPI int e_acpi_init(void);
|
||||
EAPI int e_acpi_shutdown(void);
|
||||
EAPI void e_acpi_events_freeze(void);
|
||||
EAPI void e_acpi_events_thaw(void);
|
||||
|
||||
extern EAPI int E_EVENT_ACPI_UNKNOWN;
|
||||
extern EAPI int E_EVENT_ACPI_AC_ADAPTER;
|
||||
|
|
Loading…
Reference in New Issue