Make x11drv fail to load when it can't open the display, instead of

killing the whole process.
This commit is contained in:
Alexandre Julliard 2004-07-13 03:49:52 +00:00
parent 92462c2b84
commit 642584c560
4 changed files with 21 additions and 27 deletions

View File

@ -39,7 +39,7 @@ Pixmap BITMAP_stock_pixmap; /* pixmap for the default stock bitmap */
/*********************************************************************** /***********************************************************************
* X11DRV_BITMAP_Init * X11DRV_BITMAP_Init
*/ */
BOOL X11DRV_BITMAP_Init(void) void X11DRV_BITMAP_Init(void)
{ {
Pixmap tmpPixmap; Pixmap tmpPixmap;
@ -62,7 +62,6 @@ BOOL X11DRV_BITMAP_Init(void)
} }
} }
wine_tsx11_unlock(); wine_tsx11_unlock();
return TRUE;
} }
/*********************************************************************** /***********************************************************************

View File

@ -48,13 +48,13 @@ unsigned int text_caps = (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
/********************************************************************** /**********************************************************************
* X11DRV_GDI_Initialize * X11DRV_GDI_Initialize
*/ */
BOOL X11DRV_GDI_Initialize( Display *display ) void X11DRV_GDI_Initialize( Display *display )
{ {
gdi_display = display; gdi_display = display;
palette_size = X11DRV_PALETTE_Init(); palette_size = X11DRV_PALETTE_Init();
if (!X11DRV_BITMAP_Init()) return FALSE; X11DRV_BITMAP_Init();
/* Initialize XRender */ /* Initialize XRender */
X11DRV_XRender_Init(); X11DRV_XRender_Init();
@ -65,7 +65,6 @@ BOOL X11DRV_GDI_Initialize( Display *display )
X11DRV_FONT_Init( &log_pixels_x, &log_pixels_y ); X11DRV_FONT_Init( &log_pixels_x, &log_pixels_y );
horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 ); horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 );
vert_size = MulDiv( screen_height, 254, log_pixels_y * 10 ); vert_size = MulDiv( screen_height, 254, log_pixels_y * 10 );
return TRUE;
} }
/********************************************************************** /**********************************************************************

View File

@ -192,7 +192,7 @@ extern BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev);
/* X11 driver internal functions */ /* X11 driver internal functions */
extern BOOL X11DRV_BITMAP_Init(void); extern void X11DRV_BITMAP_Init(void);
extern void X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y ); extern void X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y );
struct tagBITMAPOBJ; struct tagBITMAPOBJ;
@ -303,8 +303,8 @@ extern INT X11DRV_DCICommand(INT cbInput, const struct _DCICMD *lpCmd, LPVOID lp
* X11 GDI driver * X11 GDI driver
*/ */
BOOL X11DRV_GDI_Initialize( Display *display ); extern void X11DRV_GDI_Initialize( Display *display );
void X11DRV_GDI_Finalize(void); extern void X11DRV_GDI_Finalize(void);
extern Display *gdi_display; /* display to use for all GDI functions */ extern Display *gdi_display; /* display to use for all GDI functions */

View File

@ -334,7 +334,7 @@ static void setup_options(void)
/*********************************************************************** /***********************************************************************
* X11DRV process initialisation routine * X11DRV process initialisation routine
*/ */
static void process_attach(void) static BOOL process_attach(void)
{ {
Display *display; Display *display;
@ -343,12 +343,8 @@ static void process_attach(void)
/* Open display */ /* Open display */
if (!(display = XOpenDisplay( NULL ))) if (!(display = XOpenDisplay( NULL ))) return FALSE;
{
MESSAGE( "x11drv: Can't open display: %s\n", XDisplayName(NULL) );
MESSAGE( "Please ensure that your X server is running and that $DISPLAY is set correctly.\n" );
ExitProcess(1);
}
fcntl( ConnectionNumber(display), F_SETFD, 1 ); /* set close on exec flag */ fcntl( ConnectionNumber(display), F_SETFD, 1 ); /* set close on exec flag */
screen = DefaultScreenOfDisplay( display ); screen = DefaultScreenOfDisplay( display );
visual = DefaultVisual( display, DefaultScreen(display) ); visual = DefaultVisual( display, DefaultScreen(display) );
@ -366,11 +362,11 @@ static void process_attach(void)
XFree( depth_list ); XFree( depth_list );
if (i >= depth_count) if (i >= depth_count)
{ {
MESSAGE( "x11drv: Depth %d not supported on this screen.\n", screen_depth ); WARN( "invalid depth %d, using default\n", screen_depth );
ExitProcess(1); screen_depth = 0;
} }
} }
else screen_depth = DefaultDepthOfScreen( screen ); if (!screen_depth) screen_depth = DefaultDepthOfScreen( screen );
/* Initialize OpenGL */ /* Initialize OpenGL */
X11DRV_OpenGL_Init(display); X11DRV_OpenGL_Init(display);
@ -397,11 +393,7 @@ static void process_attach(void)
} }
/* initialize GDI */ /* initialize GDI */
if(!X11DRV_GDI_Initialize( display )) X11DRV_GDI_Initialize( display );
{
ERR( "Couldn't Initialize GDI.\n" );
ExitProcess(1);
}
#ifdef HAVE_LIBXXF86VM #ifdef HAVE_LIBXXF86VM
/* initialize XVidMode */ /* initialize XVidMode */
@ -415,6 +407,8 @@ static void process_attach(void)
/* initialize DGA2 */ /* initialize DGA2 */
X11DRV_XF86DGA2_Init(); X11DRV_XF86DGA2_Init();
#endif #endif
return TRUE;
} }
@ -518,10 +512,12 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
*/ */
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
{ {
BOOL ret = TRUE;
switch(reason) switch(reason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
process_attach(); ret = process_attach();
break; break;
case DLL_THREAD_DETACH: case DLL_THREAD_DETACH:
thread_detach(); thread_detach();
@ -530,7 +526,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
process_detach(); process_detach();
break; break;
} }
return TRUE; return ret;
} }
/*********************************************************************** /***********************************************************************