From: <hba...@us...> - 2010-05-31 00:47:02
|
Revision: 11041 http://plplot.svn.sourceforge.net/plplot/?rev=11041&view=rev Author: hbabcock Date: 2010-05-31 00:46:56 +0000 (Mon, 31 May 2010) Log Message: ----------- Change xwin driver to not call plexit() when the window is closed by clicking on the close box. Instead all subsequent plotting commands sent to the stream are ignored. Modified Paths: -------------- trunk/drivers/xwin.c trunk/include/plxwd.h Modified: trunk/drivers/xwin.c =================================================================== --- trunk/drivers/xwin.c 2010-05-31 00:04:33 UTC (rev 11040) +++ trunk/drivers/xwin.c 2010-05-31 00:46:56 UTC (rev 11041) @@ -284,6 +284,7 @@ /* Get ready for plotting */ + dev->closed = FALSE; dev->xlen = xmax - xmin; dev->ylen = ymax - ymin; @@ -363,6 +364,9 @@ dbug_enter( "plD_line_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -428,6 +432,9 @@ dbug_enter( "plD_polyline_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -469,6 +476,9 @@ dbug_enter( "plD_eop_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -501,6 +511,9 @@ dbug_enter( "plD_bop_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -591,6 +604,9 @@ dbug_enter( "plD_state_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -703,8 +719,13 @@ void plD_esc_xw( PLStream *pls, PLINT op, void *ptr ) { + XwDev *dev = (XwDev *) pls->dev; + dbug_enter( "plD_esc_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -1484,8 +1505,9 @@ if ( event->xclient.data.l[0] == XInternAtom( xwd->display, "WM_DELETE_WINDOW", False ) ) { - pls->nopause = TRUE; - plexit( "" ); + dev->exit_eventloop = TRUE; + dev->closed = TRUE; + return; } } Modified: trunk/include/plxwd.h =================================================================== --- trunk/include/plxwd.h 2010-05-31 00:04:33 UTC (rev 11040) +++ trunk/include/plxwd.h 2010-05-31 00:46:56 UTC (rev 11041) @@ -103,6 +103,8 @@ int drawing_xhairs; /* Set during xhair draws */ XPoint xhair_x[2], xhair_y[2]; /* Crosshair lines */ + int closed; /* Set if the stream is closed */ + void ( *MasterEH )( PLStream *, XEvent * ); /* Master X event handler */ #ifdef HAVE_PTHREAD pthread_t updater; /* The X events updater thread id */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |