Commit 642584c5 authored by Alexandre Julliard's avatar Alexandre Julliard

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

killing the whole process.
parent 92462c2b
......@@ -39,7 +39,7 @@ Pixmap BITMAP_stock_pixmap; /* pixmap for the default stock bitmap */
/***********************************************************************
* X11DRV_BITMAP_Init
*/
BOOL X11DRV_BITMAP_Init(void)
void X11DRV_BITMAP_Init(void)
{
Pixmap tmpPixmap;
......@@ -62,7 +62,6 @@ BOOL X11DRV_BITMAP_Init(void)
}
}
wine_tsx11_unlock();
return TRUE;
}
/***********************************************************************
......
......@@ -48,13 +48,13 @@ unsigned int text_caps = (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
/**********************************************************************
* X11DRV_GDI_Initialize
*/
BOOL X11DRV_GDI_Initialize( Display *display )
void X11DRV_GDI_Initialize( Display *display )
{
gdi_display = display;
palette_size = X11DRV_PALETTE_Init();
if (!X11DRV_BITMAP_Init()) return FALSE;
X11DRV_BITMAP_Init();
/* Initialize XRender */
X11DRV_XRender_Init();
......@@ -65,7 +65,6 @@ BOOL X11DRV_GDI_Initialize( Display *display )
X11DRV_FONT_Init( &log_pixels_x, &log_pixels_y );
horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 );
vert_size = MulDiv( screen_height, 254, log_pixels_y * 10 );
return TRUE;
}
/**********************************************************************
......
......@@ -192,7 +192,7 @@ extern BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev);
/* 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 );
struct tagBITMAPOBJ;
......@@ -303,8 +303,8 @@ extern INT X11DRV_DCICommand(INT cbInput, const struct _DCICMD *lpCmd, LPVOID lp
* X11 GDI driver
*/
BOOL X11DRV_GDI_Initialize( Display *display );
void X11DRV_GDI_Finalize(void);
extern void X11DRV_GDI_Initialize( Display *display );
extern void X11DRV_GDI_Finalize(void);
extern Display *gdi_display; /* display to use for all GDI functions */
......
......@@ -334,7 +334,7 @@ static void setup_options(void)
/***********************************************************************
* X11DRV process initialisation routine
*/
static void process_attach(void)
static BOOL process_attach(void)
{
Display *display;
......@@ -343,12 +343,8 @@ static void process_attach(void)
/* Open display */
if (!(display = XOpenDisplay( NULL )))
{
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);
}
if (!(display = XOpenDisplay( NULL ))) return FALSE;
fcntl( ConnectionNumber(display), F_SETFD, 1 ); /* set close on exec flag */
screen = DefaultScreenOfDisplay( display );
visual = DefaultVisual( display, DefaultScreen(display) );
......@@ -365,12 +361,12 @@ static void process_attach(void)
if (depth_list[i] == screen_depth) break;
XFree( depth_list );
if (i >= depth_count)
{
MESSAGE( "x11drv: Depth %d not supported on this screen.\n", screen_depth );
ExitProcess(1);
}
{
WARN( "invalid depth %d, using default\n", screen_depth );
screen_depth = 0;
}
}
else screen_depth = DefaultDepthOfScreen( screen );
if (!screen_depth) screen_depth = DefaultDepthOfScreen( screen );
/* Initialize OpenGL */
X11DRV_OpenGL_Init(display);
......@@ -397,11 +393,7 @@ static void process_attach(void)
}
/* initialize GDI */
if(!X11DRV_GDI_Initialize( display ))
{
ERR( "Couldn't Initialize GDI.\n" );
ExitProcess(1);
}
X11DRV_GDI_Initialize( display );
#ifdef HAVE_LIBXXF86VM
/* initialize XVidMode */
......@@ -415,6 +407,8 @@ static void process_attach(void)
/* initialize DGA2 */
X11DRV_XF86DGA2_Init();
#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 ret = TRUE;
switch(reason)
{
case DLL_PROCESS_ATTACH:
process_attach();
ret = process_attach();
break;
case DLL_THREAD_DETACH:
thread_detach();
......@@ -530,7 +526,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
process_detach();
break;
}
return TRUE;
return ret;
}
/***********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment