diff options
author | culler <culler> | 2021-04-30 19:13:17 (GMT) |
---|---|---|
committer | culler <culler> | 2021-04-30 19:13:17 (GMT) |
commit | 0c96fec6cef8ca37727111c74c448f0609044303 (patch) | |
tree | 620b1a5107c0d5c14d98a52e6042b94697ae1445 | |
parent | a723a9e97cc86c5cbee7c26aca2d344ad18c12a1 (diff) | |
download | tk-0c96fec6cef8ca37727111c74c448f0609044303.zip tk-0c96fec6cef8ca37727111c74c448f0609044303.tar.gz tk-0c96fec6cef8ca37727111c74c448f0609044303.tar.bz2 |
Fix [ff9c815a83]: 8 Aqua unixWm tests fail if the dock is positioned on the left side. Also fixes a segfault at exit in ximage.c.
-rw-r--r-- | tests/unixWm.test | 27 | ||||
-rw-r--r-- | xlib/ximage.c | 12 |
2 files changed, 22 insertions, 17 deletions
diff --git a/tests/unixWm.test b/tests/unixWm.test index 698a4f4..4f94cc1 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -33,24 +33,27 @@ proc makeToplevels {} { } } -# On macOS windows are not allowed to overlap the menubar at the top -# of the screen. So tests which move a window and then check whether -# it got moved to the requested location should use a y coordinate -# larger than the height of the menubar (normally 23 pixels). +# On macOS windows are not allowed to overlap the menubar at the top of the +# screen or the dock. So tests which move a window and then check whether it +# got moved to the requested location should use a y coordinate larger than the +# height of the menubar (normally 23 pixels) and an x coordinate larger than the +# width of the dock, if it happens to be on the left. if {[tk windowingsystem] eq "aqua"} { set mb [expr [menubarheight] + 1] + set X 100 set Y0 $mb set Y2 [expr $mb + 2] set Y5 [expr $mb + 5] } else { + set X 20 set Y0 0 set Y2 2 set Y5 5 } set i 1 -foreach geom "+$Y0+80 +80+$Y0 +0+$Y0" { +foreach geom "+$X+80 +80+$Y0 +$X+$Y0" { destroy .t test unixWm-1.$i {initial window position} unix { toplevel .t -width 200 -height 150 @@ -104,7 +107,7 @@ foreach geom "+20+80 +80+$Y0 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" { } set i 1 -foreach geom "+20+80 +100+40 +0+$Y0" { +foreach geom "+$X+80 +$X+40 +$X+$Y0" { test unixWm-4.$i {moving window while withdrawn} unix { wm withdraw .t update idletasks @@ -188,27 +191,27 @@ test unixWm-5.7 {compounded state changes} {unix nonPortable} { destroy .t toplevel .t -width 200 -height 100 -wm geom .t +10+$Y0 +wm geom .t +100+$Y0 wm minsize .t 1 1 update test unixWm-6.1 {size changes} unix { .t config -width 180 -height 150 update wm geom .t -} 180x150+10+$Y0 +} 180x150+100+$Y0 test unixWm-6.2 {size changes} unix { wm geom .t 250x60 .t config -width 170 -height 140 update wm geom .t -} 250x60+10+$Y0 +} 250x60+100+$Y0 test unixWm-6.3 {size changes} unix { wm geom .t 250x60 .t config -width 170 -height 140 wm geom .t {} update wm geom .t -} 170x140+10+$Y0 +} 170x140+100+$Y0 test unixWm-6.4 {size changes} {unix nonPortable userInteraction} { wm minsize .t 1 1 update @@ -1364,14 +1367,14 @@ test unixWm-40.1 {Tk_SetGrid procedure, set grid dimensions before turning on gr test unixWm-40.2 {Tk_SetGrid procedure, turning on grid when dimensions already set} unix { destroy .t toplevel .t - wm geometry .t 200x100+0+$Y0 + wm geometry .t 200x100+100+$Y0 listbox .t.l -height 20 -width 20 pack .t.l -fill both -expand 1 update .t.l configure -setgrid 1 update wm geometry .t -} "20x20+0+$Y0" +} "20x20+100+$Y0" test unixWm-41.1 {ConfigureEvent procedure, internally generated size changes} unix { destroy .t diff --git a/xlib/ximage.c b/xlib/ximage.c index aaab946..b3a8f20 100644 --- a/xlib/ximage.c +++ b/xlib/ximage.c @@ -51,11 +51,13 @@ XCreateBitmapFromData( } ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width, height, 8, (width + 7) / 8); - ximage->bitmap_bit_order = LSBFirst; - _XInitImageFuncPtrs(ximage); - TkPutImage(NULL, 0, display, pix, gc, ximage, 0, 0, 0, 0, width, height); - ximage->data = NULL; - XDestroyImage(ximage); + if (ximage) { + ximage->bitmap_bit_order = LSBFirst; + _XInitImageFuncPtrs(ximage); + TkPutImage(NULL, 0, display, pix, gc, ximage, 0, 0, 0, 0, width, height); + ximage->data = NULL; + XDestroyImage(ximage); + } XFreeGC(display, gc); return pix; } |