stage/x11: Terminate using MetaContext instead of meta_quit()

Done for the nested backend when clicking the close button.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
This commit is contained in:
Jonas Ådahl 2021-03-03 15:59:03 +01:00
parent 7d116bee0f
commit 4be9bc9db4

View File

@ -39,7 +39,7 @@
#include "cogl/cogl-mutter.h" #include "cogl/cogl-mutter.h"
#include "cogl/cogl.h" #include "cogl/cogl.h"
#include "core/display-private.h" #include "core/display-private.h"
#include "meta/main.h" #include "meta/meta-context.h"
#include "meta/meta-x11-errors.h" #include "meta/meta-x11-errors.h"
#define STAGE_X11_IS_MAPPED(s) ((((MetaStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0) #define STAGE_X11_IS_MAPPED(s) ((((MetaStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)
@ -618,12 +618,14 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
gboolean res = FALSE; gboolean res = FALSE;
ClutterBackendX11 *clutter_backend_x11; ClutterBackendX11 *clutter_backend_x11;
ClutterStage *stage; ClutterStage *stage;
MetaBackend *backend;
stage_cogl = meta_x11_get_stage_window_from_window (xevent->xany.window); stage_cogl = meta_x11_get_stage_window_from_window (xevent->xany.window);
if (stage_cogl == NULL) if (stage_cogl == NULL)
return FALSE; return FALSE;
stage = stage_cogl->wrapper; stage = stage_cogl->wrapper;
backend = stage_x11->backend;
clutter_backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend); clutter_backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
switch (xevent->type) switch (xevent->type)
@ -723,7 +725,6 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
*/ */
if (META_IS_BACKEND_X11_CM (stage_x11->backend)) if (META_IS_BACKEND_X11_CM (stage_x11->backend))
{ {
MetaBackend *backend = stage_x11->backend;
MetaRenderer *renderer = meta_backend_get_renderer (backend); MetaRenderer *renderer = meta_backend_get_renderer (backend);
MetaRendererX11Cm *renderer_x11_cm = MetaRendererX11Cm *renderer_x11_cm =
META_RENDERER_X11_CM (renderer); META_RENDERER_X11_CM (renderer);
@ -771,7 +772,7 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
g_return_val_if_fail (META_IS_STAGE_X11_NESTED (stage_x11), g_return_val_if_fail (META_IS_STAGE_X11_NESTED (stage_x11),
FALSE); FALSE);
meta_quit (META_EXIT_SUCCESS); meta_context_terminate (meta_backend_get_context (backend));
res = FALSE; res = FALSE;
break; break;
@ -787,7 +788,7 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
{ {
g_return_val_if_fail (META_IS_STAGE_X11_NESTED (stage_x11), g_return_val_if_fail (META_IS_STAGE_X11_NESTED (stage_x11),
FALSE); FALSE);
meta_quit (META_EXIT_SUCCESS); meta_context_terminate (meta_backend_get_context (backend));
res = FALSE; res = FALSE;
} }
} }