Skip to content

Commit c27a6a6

Browse files
committed
cinnamon-global.c: Don't let a normal popModal cancel an ongoing
screensaver modal retry. If the screensaver was activated while a modal was already active (like a popup menu was open), the popModal from closing that menu was cancelling the grab-retry cycle of the screensaver.
1 parent 2e65052 commit c27a6a6

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

src/cinnamon-global.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,10 +1117,9 @@ modal_retry_timeout (gpointer user_data)
11171117
data->attempt, MODAL_MAX_RETRIES,
11181118
data->tried_xdo ? "true" : "false");
11191119

1120-
global->has_modal = modal_try_grab (global, data->options, data->timestamp);
1121-
1122-
if (global->has_modal)
1120+
if (modal_try_grab (global, data->options, data->timestamp))
11231121
{
1122+
global->has_modal = TRUE;
11241123
debug_grab ("grab succeeded on attempt %d", data->attempt);
11251124
sync_input_region (global);
11261125
modal_retry_complete (data, TRUE);
@@ -1197,10 +1196,9 @@ cinnamon_global_begin_modal_with_retry (CinnamonGlobal *global,
11971196
}
11981197

11991198
debug_grab ("trying initial grab");
1200-
global->has_modal = modal_try_grab (global, options, timestamp);
1201-
1202-
if (global->has_modal)
1199+
if (modal_try_grab (global, options, timestamp))
12031200
{
1201+
global->has_modal = TRUE;
12041202
debug_grab ("initial grab succeeded");
12051203
sync_input_region (global);
12061204
callback (global, TRUE, user_data);
@@ -1244,18 +1242,18 @@ cinnamon_global_end_modal (CinnamonGlobal *global,
12441242
if (!meta_display_get_compositor (global->meta_display))
12451243
return;
12461244

1247-
if (global->modal_retry_data != NULL)
1245+
if (!global->has_modal)
12481246
{
1249-
ModalRetryData *data = global->modal_retry_data;
1250-
debug_grab ("end_modal: cancelling in-progress retry");
1251-
g_source_remove (global->modal_retry_source_id);
1252-
modal_retry_complete (data, FALSE);
1247+
if (global->modal_retry_data != NULL)
1248+
{
1249+
ModalRetryData *data = global->modal_retry_data;
1250+
debug_grab ("end_modal: cancelling in-progress retry");
1251+
g_source_remove (global->modal_retry_source_id);
1252+
modal_retry_complete (data, FALSE);
1253+
}
12531254
return;
12541255
}
12551256

1256-
if (!global->has_modal)
1257-
return;
1258-
12591257
meta_plugin_end_modal (global->plugin, timestamp);
12601258
global->has_modal = FALSE;
12611259

0 commit comments

Comments
 (0)