mirror of
https://github.com/brl/mutter.git
synced 2025-02-20 06:54:10 +00:00
launcher: Remove now unused file management API
The open/close helpers for (maybe) restricted files has been replaced with MetaDevicePool, so lets remove that functionality from here. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
This commit is contained in:
parent
7ce266628e
commit
3c9ab768ec
@ -51,9 +51,6 @@ struct _MetaLauncher
|
|||||||
MetaDbusLogin1Seat *seat_proxy;
|
MetaDbusLogin1Seat *seat_proxy;
|
||||||
char *seat_id;
|
char *seat_id;
|
||||||
|
|
||||||
struct {
|
|
||||||
GHashTable *sysfs_fds;
|
|
||||||
} impl;
|
|
||||||
gboolean session_active;
|
gboolean session_active;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -393,58 +390,6 @@ out:
|
|||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
on_evdev_device_open_in_input_impl (const char *path,
|
|
||||||
int flags,
|
|
||||||
gpointer user_data,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
MetaLauncher *self = user_data;
|
|
||||||
|
|
||||||
/* Allow readonly access to sysfs */
|
|
||||||
if (g_str_has_prefix (path, "/sys/"))
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
fd = open (path, flags);
|
|
||||||
}
|
|
||||||
while (fd < 0 && errno == EINTR);
|
|
||||||
|
|
||||||
if (fd < 0)
|
|
||||||
{
|
|
||||||
g_set_error (error,
|
|
||||||
G_FILE_ERROR,
|
|
||||||
g_file_error_from_errno (errno),
|
|
||||||
"Could not open /sys file: %s: %m", path);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hash_table_add (self->impl.sysfs_fds, GINT_TO_POINTER (fd));
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
return meta_launcher_open_restricted (self, path, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
on_evdev_device_close_in_input_impl (int fd,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
MetaLauncher *self = user_data;
|
|
||||||
|
|
||||||
if (g_hash_table_lookup (self->impl.sysfs_fds, GINT_TO_POINTER (fd)))
|
|
||||||
{
|
|
||||||
/* /sys/ paths just need close() here */
|
|
||||||
g_hash_table_remove (self->impl.sysfs_fds, GINT_TO_POINTER (fd));
|
|
||||||
close (fd);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_launcher_close_restricted (self, fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sync_active (MetaLauncher *self)
|
sync_active (MetaLauncher *self)
|
||||||
{
|
{
|
||||||
@ -545,13 +490,8 @@ meta_launcher_new (GError **error)
|
|||||||
self->session_proxy = g_object_ref (session_proxy);
|
self->session_proxy = g_object_ref (session_proxy);
|
||||||
self->seat_proxy = g_object_ref (seat_proxy);
|
self->seat_proxy = g_object_ref (seat_proxy);
|
||||||
self->seat_id = g_steal_pointer (&seat_id);
|
self->seat_id = g_steal_pointer (&seat_id);
|
||||||
self->impl.sysfs_fds = g_hash_table_new (NULL, NULL);
|
|
||||||
self->session_active = TRUE;
|
self->session_active = TRUE;
|
||||||
|
|
||||||
meta_seat_impl_set_device_callbacks (on_evdev_device_open_in_input_impl,
|
|
||||||
on_evdev_device_close_in_input_impl,
|
|
||||||
self);
|
|
||||||
|
|
||||||
g_signal_connect (self->session_proxy, "notify::active", G_CALLBACK (on_active_changed), self);
|
g_signal_connect (self->session_proxy, "notify::active", G_CALLBACK (on_active_changed), self);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@ -568,11 +508,9 @@ meta_launcher_new (GError **error)
|
|||||||
void
|
void
|
||||||
meta_launcher_free (MetaLauncher *self)
|
meta_launcher_free (MetaLauncher *self)
|
||||||
{
|
{
|
||||||
meta_seat_impl_set_device_callbacks (NULL, NULL, NULL);
|
|
||||||
g_free (self->seat_id);
|
g_free (self->seat_id);
|
||||||
g_object_unref (self->seat_proxy);
|
g_object_unref (self->seat_proxy);
|
||||||
g_object_unref (self->session_proxy);
|
g_object_unref (self->session_proxy);
|
||||||
g_hash_table_destroy (self->impl.sysfs_fds);
|
|
||||||
g_free (self);
|
g_free (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,10 +75,6 @@ struct _MetaEventSource
|
|||||||
GPollFD event_poll_fd;
|
GPollFD event_poll_fd;
|
||||||
};
|
};
|
||||||
|
|
||||||
static MetaOpenDeviceCallback device_open_callback;
|
|
||||||
static MetaCloseDeviceCallback device_close_callback;
|
|
||||||
static gpointer device_callback_data;
|
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
#ifdef CLUTTER_ENABLE_DEBUG
|
||||||
static const char *device_type_str[] = {
|
static const char *device_type_str[] = {
|
||||||
"pointer", /* CLUTTER_POINTER_DEVICE */
|
"pointer", /* CLUTTER_POINTER_DEVICE */
|
||||||
@ -3166,31 +3162,6 @@ meta_seat_impl_init (MetaSeatImpl *seat_impl)
|
|||||||
seat_impl->barrier_manager = meta_barrier_manager_native_new ();
|
seat_impl->barrier_manager = meta_barrier_manager_native_new ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* meta_seat_impl_set_device_callbacks: (skip)
|
|
||||||
* @open_callback: the user replacement for open()
|
|
||||||
* @close_callback: the user replacement for close()
|
|
||||||
* @user_data: user data for @callback
|
|
||||||
*
|
|
||||||
* Through this function, the application can set a custom callback
|
|
||||||
* to be invoked when Clutter is about to open an evdev device. It can do
|
|
||||||
* so if special handling is needed, for example to circumvent permission
|
|
||||||
* problems.
|
|
||||||
*
|
|
||||||
* Setting @callback to %NULL will reset the default behavior.
|
|
||||||
*
|
|
||||||
* For reliable effects, this function must be called before clutter_init().
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
meta_seat_impl_set_device_callbacks (MetaOpenDeviceCallback open_callback,
|
|
||||||
MetaCloseDeviceCallback close_callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
device_open_callback = open_callback;
|
|
||||||
device_close_callback = close_callback;
|
|
||||||
device_callback_data = user_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_seat_impl_update_xkb_state_in_impl (MetaSeatImpl *seat_impl)
|
meta_seat_impl_update_xkb_state_in_impl (MetaSeatImpl *seat_impl)
|
||||||
{
|
{
|
||||||
|
@ -199,26 +199,6 @@ void meta_seat_impl_release_touch_state_in_impl (MetaSeatImpl *seat_impl,
|
|||||||
|
|
||||||
void meta_seat_impl_update_xkb_state_in_impl (MetaSeatImpl *seat_impl);
|
void meta_seat_impl_update_xkb_state_in_impl (MetaSeatImpl *seat_impl);
|
||||||
|
|
||||||
/**
|
|
||||||
* MetaOpenDeviceCallback:
|
|
||||||
* @path: the device path
|
|
||||||
* @flags: flags to be passed to open
|
|
||||||
*
|
|
||||||
* This callback will be called when Clutter needs to access an input
|
|
||||||
* device. It should return an open file descriptor for the file at @path,
|
|
||||||
* or -1 if opening failed.
|
|
||||||
*/
|
|
||||||
typedef int (* MetaOpenDeviceCallback) (const char *path,
|
|
||||||
int flags,
|
|
||||||
gpointer user_data,
|
|
||||||
GError **error);
|
|
||||||
typedef void (* MetaCloseDeviceCallback) (int fd,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void meta_seat_impl_set_device_callbacks (MetaOpenDeviceCallback open_callback,
|
|
||||||
MetaCloseDeviceCallback close_callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void meta_seat_impl_release_devices (MetaSeatImpl *seat_impl);
|
void meta_seat_impl_release_devices (MetaSeatImpl *seat_impl);
|
||||||
void meta_seat_impl_reclaim_devices (MetaSeatImpl *seat_impl);
|
void meta_seat_impl_reclaim_devices (MetaSeatImpl *seat_impl);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user