diff --git a/ChangeLog b/ChangeLog index d60d9a0..7627c92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-04-22 Adam Fedor + + * configure.in: Check for gdi32. + + * Source/win32/WIN32Server.m (window::::): Update for new interface - + frame is frame rect, not content rect. + + * Source/x11/XGServer.m (-_initXContext): Look for + display attributes in server_info. + * Source/x11/XGServerWindow.m (-window::::): Update for new interface. + 2002-04-21 Fred Kiefer * Headers/win32 diff --git a/Source/win32/WIN32Server.m b/Source/win32/WIN32Server.m index d68241a..95fdae4 100644 --- a/Source/win32/WIN32Server.m +++ b/Source/win32/WIN32Server.m @@ -269,11 +269,13 @@ DWORD windowStyleForGSStyle(int style) @implementation WIN32Server (WindowOps) - (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style + : (int) screen { HWND hwnd; RECT r; DWORD wstyle = windowStyleForGSStyle(style); + frame = [NSWindow contentRectForFrameRect: frame styleMask: _styleMask]; r = GSScreenRectToMS(frame); AdjustWindowRectEx(&r, wstyle, NO, 0); diff --git a/Source/x11/XGServer.m b/Source/x11/XGServer.m index 1d86c0b..c38f706 100644 --- a/Source/x11/XGServer.m +++ b/Source/x11/XGServer.m @@ -118,12 +118,27 @@ extern int XGErrorHandler(Display *display, XErrorEvent *err); Display *dpy; int screen_number; NSString *display_name; + NSRange disnum; RContext *rcontext; RContextAttributes *attribs; XColor testColor; unsigned char r, g, b; - display_name = [server_info objectForKey: @"DisplayName"]; + display_name = [server_info objectForKey: GSDisplayName]; + if (display_name == nil) + { + NSString *dn = [server_info objectForKey: GSDisplayNumber]; + NSString *sn = [server_info objectForKey: GSScreenNumber]; + if (dn || sn) + { + if (dn == NULL) + dn = @"0"; + if (sn == NULL) + sn = @"0"; + display_name = [NSString stringWithFormat: @":%@.%@", dn, sn]; + } + } + if (display_name == nil) { NSString *host; @@ -214,6 +229,13 @@ extern int XGErrorHandler(Display *display, XErrorEvent *err); else NSDebugLog(@"Opened display %@", display_name); + [server_info setObject: display_name forKey: GSDisplayName]; + disnum = [display_name rangeOfString: @":"]; + if (disnum.location >= 0) + [server_info setObject: [display_name substringFromIndex: disnum.location] + forKey: GSDisplayNumber]; + [server_info setObject: [display_name pathExtension] forKey: GSScreenNumber]; + /* Get the visual information */ attribs = NULL; //attribs = [self _getXDefaults]; @@ -325,8 +347,8 @@ extern int XGErrorHandler(Display *display, XErrorEvent *err); */ - (id) initWithAttributes: (NSDictionary *)info { - [self _initXContext]; [super initWithAttributes: info]; + [self _initXContext]; [self setupRunLoopInputSourcesForMode: NSDefaultRunLoopMode]; [self setupRunLoopInputSourcesForMode: NSConnectionReplyMode]; diff --git a/Source/x11/XGServerWindow.m b/Source/x11/XGServerWindow.m index 80bef7e..fbc73a8 100644 --- a/Source/x11/XGServerWindow.m +++ b/Source/x11/XGServerWindow.m @@ -879,6 +879,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, } - (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style + : (int)screen { static int last_win_num = 0; gswindow_device_t *window; @@ -890,6 +891,8 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, NSDebugLLog(@"XGTrace", @"DPSwindow: %@ %d", NSStringFromRect(frame), type); root = [self _rootWindowForScreen: XSCR]; + frame = [NSWindow contentRectForFrameRect: frame styleMask: style]; + /* We're not allowed to create a zero rect window */ if (NSWidth(frame) <= 0 || NSHeight(frame) <= 0) { diff --git a/configure b/configure index 0d24c52..ec75d52 100755 --- a/configure +++ b/configure @@ -2720,6 +2720,59 @@ fi CPPFLAGS="$save_CPPFLAGS" +#-------------------------------------------------------------------- +# Window's graphics library +#-------------------------------------------------------------------- +save_header=${CPPFLAGS} +save_libs=${LIBS} +CPPFLAGS="${GRAPHIC_CFLAGS} ${GRAPHIC_LFLAGS} ${CPPFLAGS}" +LIBS="${GRAPHIC_LIBS} ${LIBS}" +echo $ac_n "checking for main in -lgdi32""... $ac_c" 1>&6 +echo "configure:2732: checking for main in -lgdi32" >&5 +ac_lib_var=`echo gdi32'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lgdi32 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_gdi32=yes +else + echo "$ac_t""no" 1>&6 +have_gdi32=no +fi + +if test "$have_gdi32" = yes; then + GRAPHIC_LIBS="-lgdi32 ${GRAPHIC_LIBS}" +fi +CPPFLAGS="${save_header}" +LIBS="${save_libs}" + +#-------------------------------------------------------------------- +# Set definitions +#-------------------------------------------------------------------- WITH_WRASTER=no if test $gs_cv_have_wraster = yes -a $set_x_paths = no; then cat >> confdefs.h <<\EOF @@ -2788,7 +2841,7 @@ fi echo $ac_n "checking Backend Server""... $ac_c" 1>&6 -echo "configure:2792: checking Backend Server" >&5 +echo "configure:2845: checking Backend Server" >&5 if test "x$enable_win32" = "xyes"; then BUILD_WIN32=yes @@ -2811,7 +2864,7 @@ EOF fi echo $ac_n "checking Backend Graphics""... $ac_c" 1>&6 -echo "configure:2815: checking Backend Graphics" >&5 +echo "configure:2868: checking Backend Graphics" >&5 if test "x$enable_winlib" = "xyes"; then BUILD_WINLIB=yes @@ -2819,8 +2872,7 @@ if test "x$enable_winlib" = "xyes"; then #define BUILD_WINLIB 1 EOF - echo "$ac_t""winlib" 1>&6 - GRAPHIC_LIBS=-lgdi32 + echo "$ac_t""win32" 1>&6 enable_xdps=no enable_xlib=no fi @@ -2855,7 +2907,7 @@ if test "${with_name+set}" = set; then fi echo $ac_n "checking Backend name""... $ac_c" 1>&6 -echo "configure:2858: checking Backend name" >&5 +echo "configure:2911: checking Backend name" >&5 if test "x$with_name" = "x"; then BACKEND_NAME=back else diff --git a/configure.in b/configure.in index fd45502..3e1a76a 100644 --- a/configure.in +++ b/configure.in @@ -360,6 +360,23 @@ CPPFLAGS="$CPPFLAGS $GRAPHIC_CFLAGS" AC_CHECK_HEADER(X11/extensions/XShm.h, AC_DEFINE(XSHM)) CPPFLAGS="$save_CPPFLAGS" +#-------------------------------------------------------------------- +# Window's graphics library +#-------------------------------------------------------------------- +save_header=${CPPFLAGS} +save_libs=${LIBS} +CPPFLAGS="${GRAPHIC_CFLAGS} ${GRAPHIC_LFLAGS} ${CPPFLAGS}" +LIBS="${GRAPHIC_LIBS} ${LIBS}" +AC_CHECK_LIB(gdi32, main, have_gdi32=yes, have_gdi32=no) +if test "$have_gdi32" = yes; then + GRAPHIC_LIBS="-lgdi32 ${GRAPHIC_LIBS}" +fi +CPPFLAGS="${save_header}" +LIBS="${save_libs}" + +#-------------------------------------------------------------------- +# Set definitions +#-------------------------------------------------------------------- WITH_WRASTER=no if test $gs_cv_have_wraster = yes -a $set_x_paths = no; then AC_DEFINE(WITH_WRASTER)