st: Mass update to ClutterActorClass event vmethod changes

These are now forwarded as ClutterEvent in order to remain accessible
on the Javascript side. This also means all ClutterActor implementations
in ST need to update to this change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2872>
This commit is contained in:
Carlos Garnacho 2023-08-09 00:26:52 +02:00
parent d56b05b5c3
commit 111a0a7fa1
5 changed files with 84 additions and 84 deletions

View File

@ -181,14 +181,14 @@ st_button_release (StButton *button,
}
static gboolean
st_button_button_press (ClutterActor *actor,
ClutterButtonEvent *event)
st_button_button_press (ClutterActor *actor,
ClutterEvent *event)
{
StButton *button = ST_BUTTON (actor);
StButtonPrivate *priv = st_button_get_instance_private (button);
int button_nr = clutter_event_get_button ((ClutterEvent *) event);
int button_nr = clutter_event_get_button (event);
StButtonMask mask = ST_BUTTON_MASK_FROM_BUTTON (button_nr);
ClutterInputDevice *device = clutter_event_get_device ((ClutterEvent*) event);
ClutterInputDevice *device = clutter_event_get_device (event);
if (priv->press_sequence)
return CLUTTER_EVENT_PROPAGATE;
@ -212,14 +212,14 @@ st_button_button_press (ClutterActor *actor,
}
static gboolean
st_button_button_release (ClutterActor *actor,
ClutterButtonEvent *event)
st_button_button_release (ClutterActor *actor,
ClutterEvent *event)
{
StButton *button = ST_BUTTON (actor);
StButtonPrivate *priv = st_button_get_instance_private (button);
int button_nr = clutter_event_get_button ((ClutterEvent *) event);
int button_nr = clutter_event_get_button (event);
StButtonMask mask = ST_BUTTON_MASK_FROM_BUTTON (button_nr);
ClutterInputDevice *device = clutter_event_get_device ((ClutterEvent*) event);
ClutterInputDevice *device = clutter_event_get_device (event);
if (priv->button_mask & mask)
{
@ -228,7 +228,7 @@ st_button_button_release (ClutterActor *actor,
gboolean is_click;
stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
target = clutter_stage_get_event_actor (stage, (ClutterEvent *) event);
target = clutter_stage_get_event_actor (stage, event);
is_click = priv->grabbed && clutter_actor_contains (actor, target);
st_button_release (button, device, mask, is_click ? button_nr : 0, NULL);
@ -247,8 +247,8 @@ st_button_button_release (ClutterActor *actor,
}
static gboolean
st_button_touch_event (ClutterActor *actor,
ClutterTouchEvent *event)
st_button_touch_event (ClutterActor *actor,
ClutterEvent *event)
{
StButton *button = ST_BUTTON (actor);
StButtonPrivate *priv = st_button_get_instance_private (button);
@ -262,9 +262,9 @@ st_button_touch_event (ClutterActor *actor,
if ((priv->button_mask & mask) == 0)
return CLUTTER_EVENT_PROPAGATE;
device = clutter_event_get_device ((ClutterEvent*) event);
sequence = clutter_event_get_event_sequence ((ClutterEvent*) event);
event_type = clutter_event_type ((ClutterEvent *) event);
device = clutter_event_get_device (event);
sequence = clutter_event_get_event_sequence (event);
event_type = clutter_event_type (event);
if (event_type == CLUTTER_TOUCH_BEGIN && !priv->grab && !priv->press_sequence)
{
@ -287,8 +287,8 @@ st_button_touch_event (ClutterActor *actor,
}
static gboolean
st_button_key_press (ClutterActor *actor,
ClutterKeyEvent *event)
st_button_key_press (ClutterActor *actor,
ClutterEvent *event)
{
StButton *button = ST_BUTTON (actor);
StButtonPrivate *priv = st_button_get_instance_private (button);
@ -296,7 +296,7 @@ st_button_key_press (ClutterActor *actor,
if (priv->button_mask & ST_BUTTON_ONE)
{
keyval = clutter_event_get_key_symbol ((ClutterEvent *) event);
keyval = clutter_event_get_key_symbol (event);
if (keyval == CLUTTER_KEY_space ||
keyval == CLUTTER_KEY_Return ||
@ -312,8 +312,8 @@ st_button_key_press (ClutterActor *actor,
}
static gboolean
st_button_key_release (ClutterActor *actor,
ClutterKeyEvent *event)
st_button_key_release (ClutterActor *actor,
ClutterEvent *event)
{
StButton *button = ST_BUTTON (actor);
StButtonPrivate *priv = st_button_get_instance_private (button);
@ -321,7 +321,7 @@ st_button_key_release (ClutterActor *actor,
if (priv->button_mask & ST_BUTTON_ONE)
{
keyval = clutter_event_get_key_symbol ((ClutterEvent *) event);
keyval = clutter_event_get_key_symbol (event);
if (keyval == CLUTTER_KEY_space ||
keyval == CLUTTER_KEY_Return ||
@ -354,8 +354,8 @@ st_button_key_focus_out (ClutterActor *actor)
}
static gboolean
st_button_enter (ClutterActor *actor,
ClutterCrossingEvent *event)
st_button_enter (ClutterActor *actor,
ClutterEvent *event)
{
StButton *button = ST_BUTTON (actor);
StButtonPrivate *priv = st_button_get_instance_private (button);
@ -377,8 +377,8 @@ st_button_enter (ClutterActor *actor,
}
static gboolean
st_button_leave (ClutterActor *actor,
ClutterCrossingEvent *event)
st_button_leave (ClutterActor *actor,
ClutterEvent *event)
{
StButton *button = ST_BUTTON (actor);
StButtonPrivate *priv = st_button_get_instance_private (button);

View File

@ -605,13 +605,13 @@ st_entry_clipboard_callback (StClipboard *clipboard,
}
static gboolean
clutter_text_button_press_event (ClutterActor *actor,
ClutterButtonEvent *event,
gpointer user_data)
clutter_text_button_press_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
StEntryPrivate *priv = ST_ENTRY_PRIV (user_data);
if (clutter_event_get_button ((ClutterEvent *) event) == 2 &&
if (clutter_event_get_button (event) == 2 &&
clutter_text_get_editable (CLUTTER_TEXT (priv->entry)))
{
StSettings *settings;
@ -642,8 +642,8 @@ clutter_text_button_press_event (ClutterActor *actor,
}
static gboolean
st_entry_key_press_event (ClutterActor *actor,
ClutterKeyEvent *event)
st_entry_key_press_event (ClutterActor *actor,
ClutterEvent *event)
{
StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
ClutterModifierType state;
@ -654,8 +654,8 @@ st_entry_key_press_event (ClutterActor *actor,
didn't handle them */
/* paste */
state = clutter_event_get_state ((ClutterEvent *) event);
keyval = clutter_event_get_key_symbol ((ClutterEvent *) event);
state = clutter_event_get_state (event);
keyval = clutter_event_get_key_symbol (event);
if (((state & CLUTTER_CONTROL_MASK)
&& keyval == CLUTTER_KEY_v) ||
@ -790,26 +790,26 @@ st_entry_set_cursor (StEntry *entry,
}
static gboolean
st_entry_enter_event (ClutterActor *actor,
ClutterCrossingEvent *event)
st_entry_enter_event (ClutterActor *actor,
ClutterEvent *event)
{
StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
ClutterStage *stage;
ClutterActor *target;
stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
target = clutter_stage_get_event_actor (stage, (ClutterEvent *) event);
target = clutter_stage_get_event_actor (stage, event);
if (target == priv->entry &&
clutter_event_get_related ((ClutterEvent *) event) != NULL)
clutter_event_get_related (event) != NULL)
st_entry_set_cursor (ST_ENTRY (actor), TRUE);
return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->enter_event (actor, event);
}
static gboolean
st_entry_leave_event (ClutterActor *actor,
ClutterCrossingEvent *event)
st_entry_leave_event (ClutterActor *actor,
ClutterEvent *event)
{
st_entry_set_cursor (ST_ENTRY (actor), FALSE);

View File

@ -97,9 +97,9 @@ enum
static guint signals[LAST_SIGNAL] = { 0, };
static gboolean
handle_button_press_event_cb (ClutterActor *actor,
ClutterButtonEvent *event,
StScrollBar *bar);
handle_button_press_event_cb (ClutterActor *actor,
ClutterEvent *event,
StScrollBar *bar);
static void stop_scrolling (StScrollBar *bar);
@ -462,26 +462,26 @@ adjust_with_direction (StAdjustment *adj,
}
static gboolean
st_scroll_bar_scroll_event (ClutterActor *actor,
ClutterScrollEvent *event)
st_scroll_bar_scroll_event (ClutterActor *actor,
ClutterEvent *event)
{
StScrollBarPrivate *priv = ST_SCROLL_BAR_PRIVATE (actor);
ClutterTextDirection direction;
ClutterScrollDirection scroll_dir;
if (!!(clutter_event_get_flags ((ClutterEvent *) event) &
if (!!(clutter_event_get_flags (event) &
CLUTTER_EVENT_FLAG_POINTER_EMULATED))
return TRUE;
direction = clutter_actor_get_text_direction (actor);
scroll_dir = clutter_event_get_scroll_direction ((ClutterEvent *) event);
scroll_dir = clutter_event_get_scroll_direction (event);
switch (scroll_dir)
{
case CLUTTER_SCROLL_SMOOTH:
{
gdouble delta_x, delta_y;
clutter_event_get_scroll_delta ((ClutterEvent *)event, &delta_x, &delta_y);
clutter_event_get_scroll_delta (event, &delta_x, &delta_y);
if (direction == CLUTTER_TEXT_DIRECTION_RTL)
delta_x *= -1;
@ -652,9 +652,9 @@ stop_scrolling (StScrollBar *bar)
}
static gboolean
handle_motion_event_cb (ClutterActor *trough,
ClutterMotionEvent *event,
StScrollBar *bar)
handle_motion_event_cb (ClutterActor *trough,
ClutterEvent *event,
StScrollBar *bar)
{
StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (bar);
graphene_point_t coords;
@ -662,17 +662,17 @@ handle_motion_event_cb (ClutterActor *trough,
if (!priv->grab_device)
return FALSE;
clutter_event_get_position ((ClutterEvent *) event, &coords);
clutter_event_get_position (event, &coords);
move_slider (bar, coords.x, coords.y);
return TRUE;
}
static gboolean
handle_button_release_event_cb (ClutterActor *trough,
ClutterButtonEvent *event,
StScrollBar *bar)
handle_button_release_event_cb (ClutterActor *trough,
ClutterEvent *event,
StScrollBar *bar)
{
if (clutter_event_get_button ((ClutterEvent *) event) != 1)
if (clutter_event_get_button (event) != 1)
return FALSE;
stop_scrolling (bar);
@ -680,19 +680,19 @@ handle_button_release_event_cb (ClutterActor *trough,
}
static gboolean
handle_button_press_event_cb (ClutterActor *actor,
ClutterButtonEvent *event,
StScrollBar *bar)
handle_button_press_event_cb (ClutterActor *actor,
ClutterEvent *event,
StScrollBar *bar)
{
StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (bar);
ClutterInputDevice *device = clutter_event_get_device ((ClutterEvent*) event);
ClutterInputDevice *device = clutter_event_get_device (event);
graphene_point_t coords;
ClutterActor *stage;
if (clutter_event_get_button ((ClutterEvent *) event) != 1)
if (clutter_event_get_button (event) != 1)
return FALSE;
clutter_event_get_position ((ClutterEvent *) event, &coords);
clutter_event_get_position (event, &coords);
if (!clutter_actor_transform_stage_point (priv->handle,
coords.x,
@ -838,23 +838,23 @@ trough_paging_cb (StScrollBar *self)
}
static gboolean
trough_button_press_event_cb (ClutterActor *actor,
ClutterButtonEvent *event,
StScrollBar *self)
trough_button_press_event_cb (ClutterActor *actor,
ClutterEvent *event,
StScrollBar *self)
{
StScrollBarPrivate *priv;
graphene_point_t coords;
g_return_val_if_fail (self, FALSE);
if (clutter_event_get_button ((ClutterEvent *) event) != 1)
if (clutter_event_get_button (event) != 1)
return FALSE;
priv = st_scroll_bar_get_instance_private (self);
if (priv->adjustment == NULL)
return FALSE;
clutter_event_get_position ((ClutterEvent *) event, &coords);
clutter_event_get_position (event, &coords);
priv->move_x = coords.x;
priv->move_y = coords.y;
@ -866,13 +866,13 @@ trough_button_press_event_cb (ClutterActor *actor,
}
static gboolean
trough_button_release_event_cb (ClutterActor *actor,
ClutterButtonEvent *event,
StScrollBar *self)
trough_button_release_event_cb (ClutterActor *actor,
ClutterEvent *event,
StScrollBar *self)
{
StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (self);
if (clutter_event_get_button ((ClutterEvent *) event) != 1)
if (clutter_event_get_button (event) != 1)
return FALSE;
g_clear_handle_id (&priv->paging_source_id, g_source_remove);

View File

@ -759,8 +759,8 @@ st_scroll_view_style_changed (StWidget *widget)
}
static gboolean
st_scroll_view_scroll_event (ClutterActor *self,
ClutterScrollEvent *event)
st_scroll_view_scroll_event (ClutterActor *self,
ClutterEvent *event)
{
StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv;
ClutterTextDirection direction;
@ -770,19 +770,19 @@ st_scroll_view_scroll_event (ClutterActor *self,
if (!priv->mouse_scroll)
return FALSE;
if (!!(clutter_event_get_flags ((ClutterEvent *) event) &
if (!!(clutter_event_get_flags (event) &
CLUTTER_EVENT_FLAG_POINTER_EMULATED))
return TRUE;
direction = clutter_actor_get_text_direction (self);
scroll_direction = clutter_event_get_scroll_direction ((ClutterEvent *) event);
scroll_direction = clutter_event_get_scroll_direction (event);
switch (scroll_direction)
{
case CLUTTER_SCROLL_SMOOTH:
{
gdouble delta_x, delta_y;
clutter_event_get_scroll_delta ((ClutterEvent *)event, &delta_x, &delta_y);
clutter_event_get_scroll_delta (event, &delta_x, &delta_y);
if (direction == CLUTTER_TEXT_DIRECTION_RTL)
delta_x *= -1;

View File

@ -687,8 +687,8 @@ st_widget_peek_theme_node (StWidget *widget)
}
static gboolean
st_widget_enter (ClutterActor *actor,
ClutterCrossingEvent *event)
st_widget_enter (ClutterActor *actor,
ClutterEvent *event)
{
StWidgetPrivate *priv = st_widget_get_instance_private (ST_WIDGET (actor));
@ -698,7 +698,7 @@ st_widget_enter (ClutterActor *actor,
ClutterActor *target;
stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
target = clutter_stage_get_event_actor (stage, (ClutterEvent *) event);
target = clutter_stage_get_event_actor (stage, event);
if (clutter_actor_contains (actor, target))
st_widget_set_hover (ST_WIDGET (actor), TRUE);
@ -719,8 +719,8 @@ st_widget_enter (ClutterActor *actor,
}
static gboolean
st_widget_leave (ClutterActor *actor,
ClutterCrossingEvent *event)
st_widget_leave (ClutterActor *actor,
ClutterEvent *event)
{
StWidgetPrivate *priv = st_widget_get_instance_private (ST_WIDGET (actor));
@ -728,7 +728,7 @@ st_widget_leave (ClutterActor *actor,
{
ClutterActor *related;
related = clutter_event_get_related ((ClutterEvent *) event);
related = clutter_event_get_related (event);
if (!related || !clutter_actor_contains (actor, related))
st_widget_set_hover (ST_WIDGET (actor), FALSE);
@ -757,14 +757,14 @@ st_widget_key_focus_out (ClutterActor *actor)
}
static gboolean
st_widget_key_press_event (ClutterActor *actor,
ClutterKeyEvent *event)
st_widget_key_press_event (ClutterActor *actor,
ClutterEvent *event)
{
ClutterModifierType state;
uint32_t keyval;
state = clutter_event_get_state ((ClutterEvent *) event);
keyval = clutter_event_get_key_symbol ((ClutterEvent *) event);
state = clutter_event_get_state (event);
keyval = clutter_event_get_key_symbol (event);
if (keyval == CLUTTER_KEY_Menu ||
(keyval == CLUTTER_KEY_F10 &&