clutter: Remove DELETE event, signal and vfunc

The delete event was used for signalling the close button was clicked on
clutter windows. Being a compositor we should never see these, unless
we're running nested. Remove the plumbing of the DELETE event and just
directly call meta_quit() when we see it, if we're running nested.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
This commit is contained in:
Jonas Ådahl 2020-07-09 18:34:43 +02:00
parent c7429e8aad
commit 28cb025190
10 changed files with 8 additions and 106 deletions

View File

@ -1093,7 +1093,6 @@ static GQuark quark_scroll = 0;
static GQuark quark_stage = 0;
static GQuark quark_destroy = 0;
static GQuark quark_client = 0;
static GQuark quark_delete = 0;
static GQuark quark_touch = 0;
static GQuark quark_touchpad = 0;
static GQuark quark_proximity = 0;
@ -6003,7 +6002,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
quark_stage = g_quark_from_static_string ("stage");
quark_destroy = g_quark_from_static_string ("destroy");
quark_client = g_quark_from_static_string ("client");
quark_delete = g_quark_from_static_string ("delete");
quark_touch = g_quark_from_static_string ("touch");
quark_touchpad = g_quark_from_static_string ("touchpad");
quark_proximity = g_quark_from_static_string ("proximity");
@ -12705,10 +12703,6 @@ clutter_actor_event (ClutterActor *actor,
signal_num = -1;
detail = quark_pad;
break;
case CLUTTER_DELETE:
signal_num = -1;
detail = quark_delete;
break;
case CLUTTER_DESTROY_NOTIFY:
signal_num = -1;
detail = quark_destroy;

View File

@ -857,7 +857,6 @@ typedef enum /*< flags prefix=CLUTTER_EVENT >*/
* @CLUTTER_STAGE_STATE: Stage state change event
* @CLUTTER_DESTROY_NOTIFY: Destroy notification event
* @CLUTTER_CLIENT_MESSAGE: Client message event
* @CLUTTER_DELETE: Stage delete event
* @CLUTTER_TOUCH_BEGIN: A new touch event sequence has started;
* event added in 1.10
* @CLUTTER_TOUCH_UPDATE: A touch event sequence has been updated;
@ -895,7 +894,6 @@ typedef enum /*< prefix=CLUTTER >*/
CLUTTER_STAGE_STATE,
CLUTTER_DESTROY_NOTIFY,
CLUTTER_CLIENT_MESSAGE,
CLUTTER_DELETE,
CLUTTER_TOUCH_BEGIN,
CLUTTER_TOUCH_UPDATE,
CLUTTER_TOUCH_END,

View File

@ -407,7 +407,6 @@ clutter_event_get_position (const ClutterEvent *event,
case CLUTTER_STAGE_STATE:
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_CLIENT_MESSAGE:
case CLUTTER_DELETE:
case CLUTTER_EVENT_LAST:
case CLUTTER_PROXIMITY_IN:
case CLUTTER_PROXIMITY_OUT:
@ -481,7 +480,6 @@ clutter_event_set_coords (ClutterEvent *event,
case CLUTTER_STAGE_STATE:
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_CLIENT_MESSAGE:
case CLUTTER_DELETE:
case CLUTTER_EVENT_LAST:
case CLUTTER_PROXIMITY_IN:
case CLUTTER_PROXIMITY_OUT:
@ -1105,7 +1103,6 @@ clutter_event_set_device (ClutterEvent *event,
case CLUTTER_STAGE_STATE:
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_CLIENT_MESSAGE:
case CLUTTER_DELETE:
case CLUTTER_EVENT_LAST:
break;
@ -1202,7 +1199,6 @@ clutter_event_get_device (const ClutterEvent *event)
case CLUTTER_STAGE_STATE:
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_CLIENT_MESSAGE:
case CLUTTER_DELETE:
case CLUTTER_EVENT_LAST:
break;
@ -1725,7 +1721,6 @@ clutter_event_get_axes (const ClutterEvent *event,
case CLUTTER_STAGE_STATE:
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_CLIENT_MESSAGE:
case CLUTTER_DELETE:
case CLUTTER_ENTER:
case CLUTTER_LEAVE:
case CLUTTER_KEY_PRESS:

View File

@ -1760,7 +1760,6 @@ _clutter_process_event_details (ClutterActor *stage,
break;
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_DELETE:
event->any.source = stage;
if (_clutter_event_process_filters (event))

View File

@ -545,23 +545,6 @@ queue_full_redraw (ClutterStage *stage)
clutter_stage_add_redraw_clip (stage, NULL);
}
static gboolean
stage_is_default (ClutterStage *stage)
{
ClutterStageManager *stage_manager;
ClutterStageWindow *impl;
stage_manager = clutter_stage_manager_get_default ();
if (stage != clutter_stage_manager_get_default_stage (stage_manager))
return FALSE;
impl = _clutter_stage_get_window (stage);
if (impl != _clutter_stage_get_default_window ())
return FALSE;
return TRUE;
}
static void
clutter_stage_allocate (ClutterActor *self,
const ClutterActorBox *box)
@ -1591,18 +1574,6 @@ _clutter_stage_do_pick (ClutterStage *stage,
return actor;
}
static gboolean
clutter_stage_real_delete_event (ClutterStage *stage,
ClutterEvent *event)
{
if (stage_is_default (stage))
clutter_main_quit ();
else
clutter_actor_destroy (CLUTTER_ACTOR (stage));
return CLUTTER_EVENT_STOP;
}
static void
clutter_stage_real_apply_transform (ClutterActor *stage,
CoglMatrix *matrix)
@ -1878,37 +1849,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 0);
/**
* ClutterStage::delete-event:
* @stage: the stage that received the event
* @event: a #ClutterEvent of type %CLUTTER_DELETE
*
* The ::delete-event signal is emitted when the user closes a
* #ClutterStage window using the window controls.
*
* Clutter by default will call clutter_main_quit() if @stage is
* the default stage, and clutter_actor_destroy() for any other
* stage.
*
* It is possible to override the default behaviour by connecting
* a new handler and returning %TRUE there.
*
* This signal is emitted only on Clutter backends that
* embed #ClutterStage in native windows. It is not emitted for
* backends that use a static frame buffer.
*
* Since: 1.2
*/
stage_signals[DELETE_EVENT] =
g_signal_new (I_("delete-event"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterStageClass, delete_event),
_clutter_boolean_handled_accumulator, NULL,
_clutter_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* ClutterStage::before-update:
* @stage: the #ClutterStage
@ -2030,7 +1970,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
klass->activate = clutter_stage_real_activate;
klass->deactivate = clutter_stage_real_deactivate;
klass->delete_event = clutter_stage_real_delete_event;
}
static void
@ -2477,18 +2416,6 @@ clutter_stage_event (ClutterStage *stage,
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (event->type == CLUTTER_DELETE)
{
gboolean retval = FALSE;
g_signal_emit_by_name (stage, "event", event, &retval);
if (!retval)
g_signal_emit_by_name (stage, "delete-event", event, &retval);
return retval;
}
if (event->type != CLUTTER_STAGE_STATE)
return FALSE;

View File

@ -64,7 +64,6 @@ struct _ClutterStage
* ClutterStageClass:
* @activate: handler for the #ClutterStage::activate signal
* @deactivate: handler for the #ClutterStage::deactivate signal
* @delete_event: handler for the #ClutterStage::delete-event signal
*
* The #ClutterStageClass structure contains only private data
*
@ -81,16 +80,13 @@ struct _ClutterStageClass
void (* activate) (ClutterStage *stage);
void (* deactivate) (ClutterStage *stage);
gboolean (* delete_event) (ClutterStage *stage,
ClutterEvent *event);
void (* paint_view) (ClutterStage *stage,
ClutterStageView *view,
const cairo_region_t *redraw_clip);
/*< private >*/
/* padding for future expansion */
gpointer _padding_dummy[30];
gpointer _padding_dummy[31];
};
/**

View File

@ -31,11 +31,13 @@
#include "backends/x11/meta-backend-x11.h"
#include "backends/x11/meta-seat-x11.h"
#include "backends/x11/meta-stage-x11.h"
#include "backends/x11/nested/meta-stage-x11-nested.h"
#include "clutter/clutter-mutter.h"
#include "clutter/x11/clutter-x11.h"
#include "clutter/x11/clutter-backend-x11.h"
#include "cogl/cogl.h"
#include "core/display-private.h"
#include "meta/main.h"
#include "meta/meta-x11-errors.h"
#define STAGE_X11_IS_MAPPED(s) ((((MetaStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)
@ -745,9 +747,10 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
{
if (handle_wm_protocols_event (backend_x11, stage_x11, xevent))
{
event->any.type = CLUTTER_DELETE;
event->any.stage = stage;
res = TRUE;
g_return_val_if_fail (META_IS_STAGE_X11_NESTED (stage_x11),
FALSE);
meta_quit (META_EXIT_SUCCESS);
res = FALSE;
}
}

View File

@ -111,8 +111,7 @@ handle_idletime_for_event (const ClutterEvent *event)
event->type == CLUTTER_LEAVE ||
event->type == CLUTTER_STAGE_STATE ||
event->type == CLUTTER_DESTROY_NOTIFY ||
event->type == CLUTTER_CLIENT_MESSAGE ||
event->type == CLUTTER_DELETE)
event->type == CLUTTER_CLIENT_MESSAGE)
return;
core_monitor = meta_idle_monitor_get_core ();

View File

@ -36,9 +36,6 @@ get_event_type_name (const ClutterEvent *event)
case CLUTTER_MOTION:
return "MOTION";
case CLUTTER_DELETE:
return "DELETE";
case CLUTTER_TOUCH_BEGIN:
return "TOUCH BEGIN";
@ -352,9 +349,6 @@ input_cb (ClutterActor *actor,
case CLUTTER_CLIENT_MESSAGE:
g_print ("[%s] CLIENT MESSAGE", clutter_actor_get_name (source_actor));
break;
case CLUTTER_DELETE:
g_print ("[%s] DELETE", clutter_actor_get_name (source_actor));
break;
case CLUTTER_TOUCHPAD_PINCH:
g_print ("[%s] TOUCHPAD PINCH", clutter_actor_get_name (source_actor));
break;

View File

@ -66,9 +66,6 @@ debug_event_cb (ClutterActor *actor,
case CLUTTER_CLIENT_MESSAGE:
printf("[%s] CLIENT MESSAGE\n", source);
break;
case CLUTTER_DELETE:
printf("[%s] DELETE", source);
break;
case CLUTTER_TOUCH_BEGIN:
g_print ("[%s] TOUCH BEGIN", source);
break;