r12486 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Thu Jun 16 13:46:43 2011
New Revision: 12486
URL: http://source.netsurf-browser.org?rev=12486&view=rev
Log:
Reinstate waiting for visitor windows to close if the public screen could not be
closed. Do it properly this time, with signals.
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=12486&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Thu Jun 16 13:46:43 2011
@@ -30,6 +30,7 @@
#include "desktop/tree.h"
#include "image/ico.h"
#include "render/form.h"
+#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utf8.h"
#include "utils/utils.h"
@@ -145,6 +146,7 @@
BOOL locked_screen = FALSE;
BOOL screen_closed = FALSE;
+ULONG screen_signal = -1;
struct MsgPort *applibport = NULL;
ULONG applibsig = 0;
@@ -310,6 +312,8 @@
ASLFR_RejectIcons,TRUE,
ASLFR_InitialDrawer,option_download_dir,
TAG_DONE);
+
+ screen_signal = AllocSignal(-1);
}
void ami_set_options(void)
@@ -546,6 +550,7 @@
SA_Type,CUSTOMSCREEN,
SA_PubName,"NetSurf",
SA_LikeWorkbench,TRUE,
+ SA_PubSig, screen_signal,
TAG_DONE);
if(scrn)
@@ -1652,7 +1657,8 @@
// WINDOW_Icon, dobj,
TAG_DONE);
RA_Iconify(gwin->objects[OID_MAIN]);
- screen_closed = CloseScreen(scrn);
+ if(locked_screen == FALSE)
+ screen_closed = CloseScreen(scrn);
}
break;
@@ -2109,7 +2115,8 @@
}
else
{
- if(CloseScreen(scrn)) scrn = NULL;
+ if(locked_screen == FALSE)
+ if(CloseScreen(scrn)) scrn = NULL;
}
}
@@ -2147,6 +2154,17 @@
/* last window closed, so exit */
netsurf_quit = true;
}
+}
+
+void ami_gui_close_screen(struct Screen *scrn)
+{
+ ULONG scrnsig = 1 << screen_signal;
+
+ if(CloseScreen(scrn)) return;
+
+ LOG(("Waiting for visitor windows to close..."));
+ Wait(scrnsig);
+ CloseScreen(scrn);
}
void gui_quit(void)
@@ -2172,9 +2190,9 @@
ami_close_fonts();
- /* Have a go at closing the public screen, apparently this is OK to do
- even if it isn't our screen (ie. locked_screen != NULL) */
- CloseScreen(scrn);
+ /* If it is our public screen, close it or wait until the visitor windows leave */
+ if(locked_screen == FALSE) ami_gui_close_screen(scrn);
+ FreeSignal(screen_signal);
FreeVec(nsscreentitle);