keybindings: Make event handlers take a const ClutterEvent

This avoids discarding the const qualifier.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
This commit is contained in:
Jonas Ådahl 2022-04-13 11:38:08 +02:00 committed by Carlos Garnacho
parent a2bdce2c8e
commit f9b18d90c6
4 changed files with 227 additions and 227 deletions

View File

@ -265,7 +265,7 @@ void meta_display_remove_autoraise_callback (MetaDisplay *display);
void meta_display_overlay_key_activate (MetaDisplay *display);
void meta_display_accelerator_activate (MetaDisplay *display,
guint action,
ClutterKeyEvent *event);
const ClutterKeyEvent *event);
gboolean meta_display_modifiers_accelerator_activate (MetaDisplay *display);
void meta_display_sync_wayland_input_focus (MetaDisplay *display);

View File

@ -2411,11 +2411,11 @@ meta_display_overlay_key_activate (MetaDisplay *display)
void
meta_display_accelerator_activate (MetaDisplay *display,
guint action,
ClutterKeyEvent *event)
const ClutterKeyEvent *event)
{
g_signal_emit (display, display_signals[ACCELERATOR_ACTIVATED], 0,
action,
clutter_event_get_source_device ((ClutterEvent *) event),
clutter_event_get_source_device ((const ClutterEvent *) event),
event->time);
}

View File

@ -1650,7 +1650,7 @@ meta_window_ungrab_keys (MetaWindow *window)
static void
handle_external_grab (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer user_data)
{
@ -1871,7 +1871,7 @@ static void
invoke_handler (MetaDisplay *display,
MetaKeyHandler *handler,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding)
{
if (handler->func)
@ -2246,9 +2246,9 @@ meta_keybindings_process_event (MetaDisplay *display,
static void
handle_switch_to_last_workspace (MetaDisplay *display,
MetaWindow *event_window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
gint target = meta_workspace_manager_get_n_workspaces (workspace_manager) - 1;
@ -2259,9 +2259,9 @@ handle_switch_to_last_workspace (MetaDisplay *display,
static void
handle_switch_to_workspace (MetaDisplay *display,
MetaWindow *event_window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
gint which = binding->handler->data;
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
@ -2295,9 +2295,9 @@ handle_switch_to_workspace (MetaDisplay *display,
static void
handle_maximize_vertically (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->has_resize_func)
{
@ -2311,9 +2311,9 @@ handle_maximize_vertically (MetaDisplay *display,
static void
handle_maximize_horizontally (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->has_resize_func)
{
@ -2327,9 +2327,9 @@ handle_maximize_horizontally (MetaDisplay *display,
static void
handle_always_on_top (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->wm_state_above == FALSE)
meta_window_make_above (window);
@ -2401,9 +2401,9 @@ handle_move_to_corner_backend (MetaDisplay *display,
static void
handle_move_to_corner_nw (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH_WEST);
}
@ -2411,9 +2411,9 @@ handle_move_to_corner_nw (MetaDisplay *display,
static void
handle_move_to_corner_ne (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH_EAST);
}
@ -2421,9 +2421,9 @@ handle_move_to_corner_ne (MetaDisplay *display,
static void
handle_move_to_corner_sw (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH_WEST);
}
@ -2431,9 +2431,9 @@ handle_move_to_corner_sw (MetaDisplay *display,
static void
handle_move_to_corner_se (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH_EAST);
}
@ -2441,9 +2441,9 @@ handle_move_to_corner_se (MetaDisplay *display,
static void
handle_move_to_side_n (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH);
}
@ -2451,9 +2451,9 @@ handle_move_to_side_n (MetaDisplay *display,
static void
handle_move_to_side_s (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH);
}
@ -2461,9 +2461,9 @@ handle_move_to_side_s (MetaDisplay *display,
static void
handle_move_to_side_e (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
handle_move_to_corner_backend (display, window, META_GRAVITY_EAST);
}
@ -2471,9 +2471,9 @@ handle_move_to_side_e (MetaDisplay *display,
static void
handle_move_to_side_w (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
handle_move_to_corner_backend (display, window, META_GRAVITY_WEST);
}
@ -2481,9 +2481,9 @@ handle_move_to_side_w (MetaDisplay *display,
static void
handle_move_to_center (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
MetaRectangle work_area;
MetaRectangle frame_rect;
@ -2500,9 +2500,9 @@ handle_move_to_center (MetaDisplay *display,
static void
handle_show_desktop (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
@ -2520,9 +2520,9 @@ handle_show_desktop (MetaDisplay *display,
static void
handle_activate_window_menu (MetaDisplay *display,
MetaWindow *event_window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (display->focus_window)
{
@ -2545,7 +2545,7 @@ handle_activate_window_menu (MetaDisplay *display,
static void
do_choose_window (MetaDisplay *display,
MetaWindow *event_window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gboolean backward)
{
@ -2569,9 +2569,9 @@ do_choose_window (MetaDisplay *display,
static void
handle_switch (MetaDisplay *display,
MetaWindow *event_window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
gboolean backwards = meta_key_binding_is_reversed (binding);
do_choose_window (display, event_window, event, binding, backwards);
@ -2580,9 +2580,9 @@ handle_switch (MetaDisplay *display,
static void
handle_cycle (MetaDisplay *display,
MetaWindow *event_window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
gboolean backwards = meta_key_binding_is_reversed (binding);
do_choose_window (display, event_window, event, binding, backwards);
@ -2591,9 +2591,9 @@ handle_cycle (MetaDisplay *display,
static void
handle_toggle_fullscreen (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->fullscreen)
meta_window_unmake_fullscreen (window);
@ -2604,9 +2604,9 @@ handle_toggle_fullscreen (MetaDisplay *display,
static void
handle_toggle_above (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->wm_state_above)
meta_window_unmake_above (window);
@ -2617,9 +2617,9 @@ handle_toggle_above (MetaDisplay *display,
static void
handle_toggle_tiled (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
MetaTileMode mode = binding->handler->data;
@ -2645,9 +2645,9 @@ handle_toggle_tiled (MetaDisplay *display,
static void
handle_toggle_maximized (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (META_WINDOW_MAXIMIZED (window))
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
@ -2658,9 +2658,9 @@ handle_toggle_maximized (MetaDisplay *display,
static void
handle_maximize (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->has_maximize_func)
meta_window_maximize (window, META_MAXIMIZE_BOTH);
@ -2669,9 +2669,9 @@ handle_maximize (MetaDisplay *display,
static void
handle_unmaximize (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->maximized_vertically || window->maximized_horizontally)
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
@ -2680,9 +2680,9 @@ handle_unmaximize (MetaDisplay *display,
static void
handle_close (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->has_close_func)
meta_window_delete (window, event->time);
@ -2691,9 +2691,9 @@ handle_close (MetaDisplay *display,
static void
handle_minimize (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->has_minimize_func)
meta_window_minimize (window);
@ -2702,9 +2702,9 @@ handle_minimize (MetaDisplay *display,
static void
handle_begin_move (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->has_move_func)
{
@ -2726,9 +2726,9 @@ handle_begin_move (MetaDisplay *display,
static void
handle_begin_resize (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->has_resize_func)
{
@ -2750,9 +2750,9 @@ handle_begin_resize (MetaDisplay *display,
static void
handle_toggle_on_all_workspaces (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
if (window->on_all_workspaces_requested)
meta_window_unstick (window);
@ -2763,9 +2763,9 @@ handle_toggle_on_all_workspaces (MetaDisplay *display,
static void
handle_move_to_workspace_last (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
gint which;
@ -2783,9 +2783,9 @@ handle_move_to_workspace_last (MetaDisplay *display,
static void
handle_move_to_workspace (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
gint which = binding->handler->data;
@ -2838,9 +2838,9 @@ handle_move_to_workspace (MetaDisplay *display,
static void
handle_move_to_monitor (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
MetaContext *context = meta_display_get_context (display);
MetaBackend *backend = meta_context_get_backend (context);
@ -2862,9 +2862,9 @@ handle_move_to_monitor (MetaDisplay *display,
static void
handle_raise_or_lower (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
/* Get window at pointer */
@ -2908,9 +2908,9 @@ handle_raise_or_lower (MetaDisplay *display,
static void
handle_raise (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
meta_window_raise (window);
}
@ -2918,9 +2918,9 @@ handle_raise (MetaDisplay *display,
static void
handle_lower (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
meta_window_lower (window);
}
@ -2928,9 +2928,9 @@ handle_lower (MetaDisplay *display,
static void
handle_set_spew_mark (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
meta_verbose ("-- MARK MARK MARK MARK --");
}
@ -2939,9 +2939,9 @@ handle_set_spew_mark (MetaDisplay *display,
static void
handle_switch_vt (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
MetaContext *context = meta_display_get_context (display);
MetaBackend *backend = meta_context_get_backend (context);
@ -2960,9 +2960,9 @@ handle_switch_vt (MetaDisplay *display,
static void
handle_switch_monitor (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
MetaContext *context = meta_display_get_context (display);
MetaBackend *backend = meta_context_get_backend (context);
@ -2981,9 +2981,9 @@ handle_switch_monitor (MetaDisplay *display,
static void
handle_rotate_monitor (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
MetaContext *context = meta_display_get_context (display);
MetaBackend *backend = meta_context_get_backend (context);
@ -2996,9 +2996,9 @@ handle_rotate_monitor (MetaDisplay *display,
static void
handle_restore_shortcuts (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
gpointer user_data)
{
ClutterInputDevice *source;

View File

@ -453,7 +453,7 @@ typedef enum
*/
typedef void (* MetaKeyHandlerFunc) (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
const ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer user_data);