[gnome-shell/wip/carlosg/grabs-pt2: 5/11] main: Use Clutter.grab() underneath Main.push/popModal
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/grabs-pt2: 5/11] main: Use Clutter.grab() underneath Main.push/popModal
- Date: Fri, 19 Nov 2021 13:23:30 +0000 (UTC)
commit 39d045e453ec59555f443306a6d96438d9c85673
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Nov 18 00:36:44 2021 +0100
main: Use Clutter.grab() underneath Main.push/popModal
js/ui/main.js | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index c7bac11f25..c0428e03f4 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -523,13 +523,8 @@ function pushModal(actor, params) {
options: 0,
actionMode: Shell.ActionMode.NONE });
- if (modalCount == 0) {
- if (!global.begin_modal(params.timestamp, params.options)) {
- log('pushModal: invocation of begin_modal failed');
- return false;
- }
+ if (modalCount === 0)
Meta.disable_unredirect_for_display(global.display);
- }
modalCount += 1;
let actorDestroyId = actor.connect('destroy', () => {
@@ -549,11 +544,13 @@ function pushModal(actor, params) {
modalActorFocusStack[index].prevFocus = null;
});
}
+ let grab = Clutter.grab(global.stage, actor);
modalActorFocusStack.push({ actor,
- destroyId: actorDestroyId,
- prevFocus,
- prevFocusDestroyId,
- actionMode });
+ grab,
+ destroyId: actorDestroyId,
+ prevFocus,
+ prevFocusDestroyId,
+ actionMode });
actionMode = params.actionMode;
global.stage.set_key_focus(actor);
@@ -581,7 +578,6 @@ function popModal(actor, timestamp) {
let focusIndex = _findModal(actor);
if (focusIndex < 0) {
global.stage.set_key_focus(null);
- global.end_modal(timestamp);
actionMode = Shell.ActionMode.NORMAL;
throw new Error('incorrect pop');
@@ -592,6 +588,9 @@ function popModal(actor, timestamp) {
let record = modalActorFocusStack[focusIndex];
record.actor.disconnect(record.destroyId);
+ let grab = record.grab;
+ Clutter.ungrab(grab);
+
if (focusIndex == modalActorFocusStack.length - 1) {
if (record.prevFocus)
record.prevFocus.disconnect(record.prevFocusDestroyId);
@@ -629,7 +628,6 @@ function popModal(actor, timestamp) {
return;
layoutManager.modalEnded();
- global.end_modal(timestamp);
Meta.enable_unredirect_for_display(global.display);
actionMode = Shell.ActionMode.NORMAL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]