summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkImgGIF.c2
-rw-r--r--library/listbox.tcl2
-rw-r--r--library/menu.tcl28
-rw-r--r--library/tearoff.tcl2
-rw-r--r--library/ttk/menubutton.tcl2
-rw-r--r--macosx/tkMacOSXImage.c10
-rw-r--r--macosx/tkMacOSXWindowEvent.c17
-rw-r--r--unix/Makefile.in2
-rw-r--r--win/makefile.vc2
-rw-r--r--win/tkWinDraw.c4
10 files changed, 41 insertions, 30 deletions
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index b9b5273..594ec1e 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -1086,7 +1086,7 @@ DoExtension(
/* Add extension to dict */
if (NULL != metadataOutObj
&& extensionStreamName[0] != '\0' ) {
- Tcl_Obj *ValueObj;
+ Tcl_Obj *ValueObj = NULL;
int length = 0;
for (;;) {
count = GetDataBlock(gifConfPtr, chan, buf);
diff --git a/library/listbox.tcl b/library/listbox.tcl
index 110a856..bb948ff 100644
--- a/library/listbox.tcl
+++ b/library/listbox.tcl
@@ -458,7 +458,7 @@ proc ::tk::ListboxCancel w {
}
set first [$w index anchor]
set last $Priv(listboxPrev)
- if {$last eq ""} {
+ if {$last < 0} {
# Not actually doing any selection right now
return
}
diff --git a/library/menu.tcl b/library/menu.tcl
index 205410f..ecb7a56 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -487,8 +487,7 @@ proc ::tk::MenuMotion {menu x y state} {
}
set index [$menu index @$x,$y]
if {[info exists Priv(menuActivated)] \
- && $index ne "none" \
- && $index ne "" \
+ && $index >= 0 \
&& $index ne $activeindex} {
set mode [option get $menu clickToFocus ClickToFocus]
if {[string is false $mode]} {
@@ -528,7 +527,7 @@ proc ::tk::MenuButtonDown menu {
if {![winfo viewable $menu]} {
return
}
- if {[$menu index active] eq "none" || [$menu index active] eq ""} {
+ if {[$menu index active] < 0} {
if {[$menu cget -type] ne "menubar" } {
set Priv(window) {}
}
@@ -586,7 +585,7 @@ proc ::tk::MenuButtonDown menu {
proc ::tk::MenuLeave {menu rootx rooty state} {
variable ::tk::Priv
set Priv(window) {}
- if {[$menu index active] eq "none" || [$menu index active] eq ""} {
+ if {[$menu index active] < 0} {
return
}
if {[$menu type active] eq "cascade" \
@@ -654,7 +653,7 @@ proc ::tk::MenuInvoke {w buttonRelease} {
}
} else {
set active [$w index active]
- if {$Priv(popup) eq "" || $active ne "none" || $active ne ""} {
+ if {$Priv(popup) eq "" || $active >= 0} {
MenuUnpost $w
}
uplevel #0 [list $w invoke active]
@@ -798,8 +797,7 @@ proc ::tk::MenuNextMenu {menu direction} {
if {[winfo class $mb] eq "Menubutton" \
&& [$mb cget -state] ne "disabled" \
&& [$mb cget -menu] ne "" \
- && [[$mb cget -menu] index last] ne "" \
- && [[$mb cget -menu] index last] ne "none"} {
+ && [[$mb cget -menu] index last] >= 0} {
break
}
if {$mb eq $w} {
@@ -821,13 +819,14 @@ proc ::tk::MenuNextMenu {menu direction} {
# -1 means go to the next higher entry.
proc ::tk::MenuNextEntry {menu count} {
- if {[$menu index last] eq "none" || [$menu index last] eq ""} {
+ set last [$menu index last]
+ if {$last < 0} {
return
}
set length [expr {[$menu index last]+1}]
set quitAfter $length
set active [$menu index active]
- if {$active eq "none" || $active eq "none"} {
+ if {$active < 0} {
set i 0
} else {
set i [expr {$active + $count}]
@@ -1028,9 +1027,6 @@ proc ::tk::TraverseWithinMenu {w char} {
}
set char [string tolower $char]
set last [$w index last]
- if {$last eq "none" || $last eq ""} {
- return
- }
for {set i 0} {$i <= $last} {incr i} {
if {[catch {set char2 [string index \
[$w entrycget $i -label] [$w entrycget $i -underline]]}]} {
@@ -1070,13 +1066,10 @@ proc ::tk::MenuFirstEntry menu {
return
}
tk_menuSetFocus $menu
- if {[$menu index active] ne "none" || [$menu index active] ne ""} {
+ if {[$menu index active] >= 0} {
return
}
set last [$menu index last]
- if {$last eq "none" || $last eq ""} {
- return
- }
for {set i 0} {$i <= $last} {incr i} {
if {([catch {set state [$menu entrycget $i -state]}] == 0) \
&& $state ne "disabled" && [$menu type $i] ne "tearoff"} {
@@ -1116,9 +1109,6 @@ proc ::tk::MenuFindName {menu s} {
return $i
}
set last [$menu index last]
- if {$last eq "none" || $last eq ""} {
- return
- }
for {set i 0} {$i <= $last} {incr i} {
if {![catch {$menu entrycget $i -label} label]} {
if {$label eq $s} {
diff --git a/library/tearoff.tcl b/library/tearoff.tcl
index 605074f..c368da2 100644
--- a/library/tearoff.tcl
+++ b/library/tearoff.tcl
@@ -135,7 +135,7 @@ proc ::tk::MenuDup {src dst type} {
}
eval $cmd
set last [$src index last]
- if {$last eq "none" || $last eq ""} {
+ if {$last < 0} {
return
}
for {set i [$src cget -tearoff]} {$i <= $last} {incr i} {
diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl
index a245df8..5809d12 100644
--- a/library/ttk/menubutton.tcl
+++ b/library/ttk/menubutton.tcl
@@ -228,7 +228,7 @@ proc ttk::menubutton::TransferGrab {mb} {
#
proc ttk::menubutton::FindMenuEntry {menu s} {
set last [$menu index last]
- if {$last eq "none" || $last eq ""} {
+ if {$last < 0} {
return ""
}
for {set i 0} {$i <= $last} {incr i} {
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c
index c41b3a6..934ada6 100644
--- a/macosx/tkMacOSXImage.c
+++ b/macosx/tkMacOSXImage.c
@@ -409,12 +409,12 @@ XCreateImage(
* Source Atop Composition (kCGBlendModeSourceAtop in Apple's Core
* Graphics).
*
- * The TkpPutRGBAfunction is used by TkImgPhotoDisplay to render photo
+ * The TkpPutRGBAImage function is used by TkImgPhotoDisplay to render photo
* images if the compile-time variable TK_CAN_RENDER_RGBA is defined in
* a platform's tkXXXXPort.h header, as is the case for the macOS Aqua port.
*
* Results:
- * These functions always return Success.
+ * These functions return either BadDrawable or Success.
*
* Side effects:
* Draws the image on the specified drawable.
@@ -443,6 +443,7 @@ TkMacOSXPutImage(
{
TkMacOSXDrawingContext dc;
MacDrawable *macDraw = (MacDrawable *)drawable;
+ int result = Success;
display->request++;
if (!TkMacOSXSetupDrawingContext(drawable, gc, &dc)) {
@@ -460,7 +461,6 @@ TkMacOSXPutImage(
CGContextSetBlendMode(dc.context, kCGBlendModeSourceAtop);
}
if (img) {
-
bounds = CGRectMake(0, 0, image->width, image->height);
srcRect = CGRectMake(src_x, src_y, width, height);
dstRect = CGRectMake(dest_x, dest_y, width, height);
@@ -470,12 +470,14 @@ TkMacOSXPutImage(
CFRelease(img);
} else {
TkMacOSXDbgMsg("Invalid source drawable");
+ result = BadDrawable;
}
} else {
TkMacOSXDbgMsg("Invalid destination drawable");
+ result = BadDrawable;
}
TkMacOSXRestoreDrawingContext(&dc);
- return Success;
+ return result;
}
int XPutImage(Display* display, Drawable drawable, GC gc, XImage* image,
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 8b24a65..eb4f95a 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -291,6 +291,16 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
}
@end
+
+/*
+ * Idle task which forces focus to a particular window.
+ */
+
+static void RefocusGrabWindow(void *data) {
+ TkWindow *winPtr = (TkWindow *) data;
+ TkpChangeFocus(winPtr, 1);
+}
+
#pragma mark TKApplication(TKApplicationEvent)
@implementation TKApplication(TKApplicationEvent)
@@ -308,6 +318,10 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
* When the application is activated with Command-Tab it will create a
* zombie window for every Tk window which has been withdrawn. So iterate
* through the list of windows and order out any withdrawn window.
+ * If one of the windows is the grab window for its display we focus
+ * it. This is done as at idle, in case the app was reactivated by
+ * clicking a different window. In that case we need to wait until the
+ * mouse event has been processed before focussing the grab window.
*/
for (NSWindow *win in [NSApp windows]) {
@@ -318,6 +332,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
if (winPtr->wmInfoPtr->hints.initial_state == WithdrawnState) {
[win orderOut:nil];
}
+ if (winPtr->dispPtr->grabWinPtr == winPtr) {
+ Tcl_DoWhenIdle(RefocusGrabWindow, winPtr);
+ }
}
}
diff --git a/unix/Makefile.in b/unix/Makefile.in
index c8b94c2..eed07a5 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -287,7 +287,7 @@ CC_SEARCH_FLAGS = @CC_SEARCH_FLAGS@
LD_SEARCH_FLAGS = @LD_SEARCH_FLAGS@
# support for embedded libraries on Darwin / Mac OS X
-DYLIB_INSTALL_DIR = ${LIB_RUNTIME_DIR}
+DYLIB_INSTALL_DIR = $(libdir)
# support for building the Aqua resource file
TK_RSRC_FILE = @TK_RSRC_FILE@
diff --git a/win/makefile.vc b/win/makefile.vc
index e6fc2a4..dfc0139 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -541,7 +541,7 @@ zipfs mkzip {$@} {$(LIBTKVFS)} {$(LIBTKVFS)}
$(CAT32): $(_TCLDIR)\win\cat.c
$(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE /DUNICODE /D_UNICODE -Fo$(TMP_DIR)\ $?
- $(CONEXECMD) /DCONSOLE -stack:16384 $(TMP_DIR)\cat.obj
+ $(CONEXECMD) -stack:16384 $(TMP_DIR)\cat.obj
$(_VC_MANIFEST_EMBED_EXE)
#---------------------------------------------------------------------
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 97f7b33..531f06b 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -586,7 +586,9 @@ TkPutImage(
ckfree(infoPtr);
}
if (!bitmap) {
- Tcl_Panic("Fail to allocate bitmap");
+ DeleteDC(dcMem);
+ TkWinReleaseDrawableDC(d, dc, &state);
+ return BadValue;
}
bitmap = (HBITMAP)SelectObject(dcMem, bitmap);
BitBlt(dc, dest_x, dest_y, (int) width, (int) height, dcMem, src_x, src_y,