summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-12-13 06:28:45 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-12-13 06:28:45 (GMT)
commit3629f83ae3503a60d013a42049853f664b650b0c (patch)
treec125f009c1d584c78c4679a1029750f986847f2e
parent4ab5dcf151a4b668fb170ae82adea3af495130d2 (diff)
downloadtk-3629f83ae3503a60d013a42049853f664b650b0c.zip
tk-3629f83ae3503a60d013a42049853f664b650b0c.tar.gz
tk-3629f83ae3503a60d013a42049853f664b650b0c.tar.bz2
merge updates from HEAD
-rw-r--r--ChangeLog32
-rw-r--r--changes18
-rw-r--r--doc/ttk_intro.n31
-rw-r--r--doc/ttk_panedwindow.n6
-rw-r--r--doc/ttk_style.n14
-rw-r--r--doc/ttk_treeview.n7
-rw-r--r--doc/ttk_widget.n19
-rw-r--r--generic/tkText.c88
-rw-r--r--generic/tkText.h8
-rw-r--r--macosx/tkMacOSXMouseEvent.c25
-rw-r--r--macosx/tkMacOSXSubwindows.c37
-rw-r--r--macosx/tkMacOSXWm.c109
-rw-r--r--tests/text.test37
13 files changed, 313 insertions, 118 deletions
diff --git a/ChangeLog b/ChangeLog
index dbcba4c..77af294 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,36 @@
+2007-12-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkText.c (DeleteIndexRange, TextEditCmd, UpdateDirtyFlag):
+ * tests/text.test (text-25.10.1,25.11.[12]):
+ Don't require [update idle] to trigger Modified event [Bug 1809538]
+ Modified virtual event should only fire on state change [Bug 1799782]
+ Make sure we delete chars before triggering <<Modified>> [Bug 1737288]
+
+2007-12-12 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): Revert 2007-10-26
+ change to window class of transient toplevels that are not also
+ overrideredirect. [Bug 1845899]
+
+ * macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): Implement more
+ * macosx/tkMacOSXMouseEvent.c (BringWindowForward): X11-like transient
+ * macosx/tkMacOSXSubwindows.c (XDestroyWindow): behaviour by adding
+ transient windows to a window group owned by the master window, this
+ ensures transients always remain in front of and are collapsed with the
+ master; bring master to front when selecting transient windows; restore
+ default window group of transients if master destroyed. [Bug 1845899]
+
+2007-12-12 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/ttk_intro.n, doc/ttk_style.n, doc/ttk_widget.n:
+ Various minor updates.
+
+2007-12-12 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updated for 8.5.0 release.
+
2007-12-11 Joe English <jenglish@users.sourceforge.net>
+
* generic/ttk/ttkTheme.c(StyleElementOptionsCmd):
Use Ttk_GetElement() to find element instead of direct
hash table access.
diff --git a/changes b/changes
index 0b57dfe..51a7dee 100644
--- a/changes
+++ b/changes
@@ -2,7 +2,7 @@ This file summarizes all changes made to Tk since version 1.0 was
released on March 13, 1991. Changes that aren't backward compatible
are marked specially.
-RCS: @(#) $Id: changes,v 1.107.2.4 2007/11/21 16:46:25 dgp Exp $
+RCS: @(#) $Id: changes,v 1.107.2.5 2007/12/13 06:28:46 dgp Exp $
3/16/91 (bug fix) Modified tkWindow.c to remove Tk's Tcl commands from
the interpreter when the main window is deleted (otherwise there will
@@ -6443,3 +6443,19 @@ Many significant improvements to the documentation and demos (fellows, hobbs,
steffen, kupries)
--- Released 8.5b3, Novemeber 19, 2007 --- See ChangeLog for details ---
+
+2007-11-25 (bug fix)[1343984] ttk::notebook bugs (english,boudaillier)
+
+2007-11-26 (bug fix)[1822391] [photo put] segfault w/ PPM data (kenny)
+
+2007-11-26 (bug fix)[1822076] [tk_saveFile] and path w/spaces (bauer,kenny)
+
+2007-12-04 (new feature)[1844143] Danish message catalog (berg)
+
+2007-12-11 (bug fix)[1602537] crash in [$text replace] (goth,porter,fellows)
+
+2007-12-12 (bug fix)[1845899] Aqua: [wm transient] (steffen)
+
+Several documentation and release notes improvements
+
+--- Released 8.5.0, December 14, 2007 --- See ChangeLog for details ---
diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n
index 771d7b1..183af18 100644
--- a/doc/ttk_intro.n
+++ b/doc/ttk_intro.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: ttk_intro.n,v 1.3.2.3 2007/11/01 16:37:16 dgp Exp $
+'\" RCS: @(#) $Id: ttk_intro.n,v 1.3.2.4 2007/12/13 06:28:47 dgp Exp $
'\"
.so man.macros
.TH ttk::intro n 8.5 Tk "Tk Themed Widget"
@@ -33,8 +33,7 @@ Adapt to display limitations (low-color, grayscale, monochrome, tiny screens)
.IP \(bu
Accessibility (high contrast, large type)
.IP \(bu
-Application suite
-.QW branding
+Application suite branding
.IP \(bu
Blend in with the rest of the desktop (Gnome, KDE, Java)
.IP \(bu
@@ -46,7 +45,7 @@ For example, a vertical scrollbar widget contains \fBuparrow\fR,
.PP
Element names use a recursive dotted notation.
For example, \fBuparrow\fR identifies a generic arrow element,
-and \fBScrollbar.arrow\fR and \fBCombobox.uparrow\fR identify
+and \fBScrollbar.uparrow\fR and \fBCombobox.uparrow\fR identify
widget-specific elements.
When looking for an element, the style engine looks for
the specific name first, and if an element of that name is
@@ -59,15 +58,15 @@ For example, the \fBtext\fR element
(which displays a text string) has
\fB\-text\fR, \fB\-font\fR, \fB\-foreground\fR, \fB\-background\fR,
\fB\-underline\fR, and \fB\-width\fR options.
-The value of an element resource is taken from:
-.IP \(bu
-A dynamic setting specified by \fBstyle map\fR and the current state;
+The value of an element option is taken from:
.IP \(bu
An option of the same name and type in the widget containing the element;
.IP \(bu
-The default setting specified by \fBstyle default\fR; or
+A dynamic setting specified by \fBstyle map\fR and the current state;
+.IP \(bu
+The default setting specified by \fBstyle configure\fR; or
.IP \(bu
-The element's built-in default value for the resource.
+The element's built-in default value for the option.
.SH "LAYOUTS"
A \fIlayout\fR specifies which elements make up a widget
and how they are arranged.
@@ -79,7 +78,7 @@ and placed within the parcel according to the \fB\-sticky\fR
option.
For example, the layout for a horizontal scrollbar
.CS
-style layout Horizontal.TScrollbar {
+ttk::style layout Horizontal.TScrollbar {
Scrollbar.trough \-children {
Scrollbar.leftarrow \-side left \-sticky w
Scrollbar.rightarrow \-side right \-sticky e
@@ -88,7 +87,7 @@ style layout Horizontal.TScrollbar {
}
.CE
By default, the layout for a widget is the same as its class name.
-Some widgets may override this (for example, the \fBscrollbar\fR
+Some widgets may override this (for example, the \fBttk::scrollbar\fR
widget chooses different layouts based on the \fB\-orient\fR option).
.SH "STATES"
In standard Tk, many widgets have a \fB\-state\fR option
@@ -110,7 +109,7 @@ A \fIstate specification\fR is a list of symbolic state names
indicating which bits are set, each optionally prefixed with an
exclamation point indicating that the bit is cleared instead.
.PP
-For example, the class bindings for the \fBtbutton\fR
+For example, the class bindings for the \fBttk::button\fR
widget are:
.CS
bind TButton <Enter> { %W state active }
@@ -137,12 +136,12 @@ but not by much).
\fINote to self: rewrite that paragraph. It's horrible.\fR
.SH "STYLES"
Each widget is associated with a \fIstyle\fR,
-which specifies values for element resources.
+which specifies values for element options.
Style names use a recursive dotted notation like layouts and elements;
by default, widgets use the class name to look up a style in the current theme.
For example:
.CS
-style default TButton \e
+ttk::style configure TButton \e
\-background #d9d9d9 \e
\-foreground black \e
\-relief raised \e
@@ -151,10 +150,10 @@ style default TButton \e
Many elements are displayed differently depending on the widget state.
For example, buttons have a different background when they are active,
a different foreground when disabled, and a different relief when pressed.
-The \fBstyle map\fR command specifies dynamic resources
+The \fBstyle map\fR command specifies dynamic option settings
for a particular style:
.CS
-style map TButton \e
+ttk::style map TButton \e
\-background [list disabled #d9d9d9 active #ececec] \e
\-foreground [list disabled #a3a3a3] \e
\-relief [list {pressed !disabled} sunken] \e
diff --git a/doc/ttk_panedwindow.n b/doc/ttk_panedwindow.n
index 9840e64..3fbe76b 100644
--- a/doc/ttk_panedwindow.n
+++ b/doc/ttk_panedwindow.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: ttk_panedwindow.n,v 1.4.2.4 2007/11/01 16:37:16 dgp Exp $
+'\" RCS: @(#) $Id: ttk_panedwindow.n,v 1.4.2.5 2007/12/13 06:28:47 dgp Exp $
'\"
.so man.macros
.TH ttk::panedwindow n 8.5 Tk "Tk Themed Widget"
@@ -15,8 +15,8 @@ ttk::panedwindow \- Multi-pane container window
.nf
\fBttk::panedwindow\fR \fIpathName \fR?\fIoptions\fR?
.br
-\fIpathName \fBadd\fR \fIpathName.subwindow\fR ?\fIoptions...\fR?
-\fIpathName \fBinsert\fR \fIindex\fR \fIpathName.subwindow\fR ?\fIoptions...\fR?
+\fIpathName \fBadd\fR \fIwindow\fR ?\fIoptions...\fR?
+\fIpathName \fBinsert\fR \fIindex\fR \fIwindow\fR ?\fIoptions...\fR?
.fi
.BE
.SH DESCRIPTION
diff --git a/doc/ttk_style.n b/doc/ttk_style.n
index 4804d1b..c9aae75 100644
--- a/doc/ttk_style.n
+++ b/doc/ttk_style.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: ttk_style.n,v 1.3.2.4 2007/12/05 18:11:41 dgp Exp $
+'\" RCS: @(#) $Id: ttk_style.n,v 1.3.2.5 2007/12/13 06:28:47 dgp Exp $
'\"
.so man.macros
.TH ttk::style n 8.5 Tk "Tk Themed Widget"
@@ -21,7 +21,7 @@ available at http://tktable.sourceforge.net/tile/tile-tcl2004.pdf
Each widget is assigned a \fIstyle\fR,
which specifies the set of elements making up the widget
and how they are arranged, along with dynamic and default
-settings for element resources.
+settings for element options.
By default, the style name is the same as the widget's class;
this may be overridden by the \fB\-style\fR option.
.PP
@@ -30,10 +30,10 @@ which controls the overall look and feel of an application.
.SH DESCRIPTION
The \fBttk::style\fR command takes the following arguments:
.TP
-\fBttk::style configure \fIstyle\fR ?\fI\-option\fR? ?\fIvalue option value...\fR?
+\fBttk::style configure \fIstyle\fR ?\fI\-option\fR ?\fIvalue option value...\fR? ?
Sets the default value of the specified option(s) in \fIstyle\fR.
.TP
-\fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value\fB }\fR ... ?
+\fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value...\fB }\fR?
Sets dynamic values of the specified option(s) in \fIstyle\fR.
Each \fIstatespec / value\fR pair is examined in order;
the value corresponding to the first matching \fIstatespec\fR
@@ -82,7 +82,7 @@ Typically \fIscript\fR simply defines styles and elements,
though arbitrary Tcl code may appear.
.TP
\fBttk::style theme names\fR
-Returns a list of the available themes.
+Returns a list of all known themes.
.TP
\fBttk::style theme use\fR \fIthemeName\fR
Sets the current theme to \fIthemeName\fR, and refreshes all widgets.
@@ -99,10 +99,10 @@ Specifies which side of the cavity to place the element;
one of \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR.
If omitted, the element occupies the entire cavity.
.TP
-\fB\-sticky [\fInswe\fB]\fR
+\fB\-sticky\fR \fB[\fInswe\fB]\fR
Specifies where the element is placed inside its allocated parcel.
.TP
-\fB\-children {\fIsublayout... \fB}\fR
+\fB\-children { \fIsublayout... \fB}\fR
Specifies a list of elements to place inside the element.
.\" Also: -border, -unit, -expand: may go away.
.PP
diff --git a/doc/ttk_treeview.n b/doc/ttk_treeview.n
index ad6f924..2bfe559 100644
--- a/doc/ttk_treeview.n
+++ b/doc/ttk_treeview.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: ttk_treeview.n,v 1.5.2.4 2007/12/10 18:39:28 dgp Exp $
+'\" RCS: @(#) $Id: ttk_treeview.n,v 1.5.2.5 2007/12/13 06:28:47 dgp Exp $
'\"
.so man.macros
.TH ttk::treeview n 8.5 Tk "Tk Themed Widget"
@@ -429,7 +429,8 @@ Generated just after setting the focus item to \fB\-open false\fR.
.PP
The \fBfocus\fR and \fBselection\fR widget commands can be used
to determine the affected item or items.
-In Tk 8.5, the affected item is also passed as the \fB\-detail\fR field
-of the virtual event.
+'\" Not yet:
+'\" In Tk 8.5, the affected item is also passed as the \fB\-detail\fR field
+'\" of the virtual event.
.SH "SEE ALSO"
ttk::widget(n), listbox(n), image(n), bind(n)
diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n
index ffc5979..42ba755 100644
--- a/doc/ttk_widget.n
+++ b/doc/ttk_widget.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: ttk_widget.n,v 1.3.2.3 2007/11/01 16:37:16 dgp Exp $
+'\" RCS: @(#) $Id: ttk_widget.n,v 1.3.2.4 2007/12/13 06:28:47 dgp Exp $
'\"
.so man.macros
.TH ttk::widget n 8.5 Tk "Tk Themed Widget"
@@ -40,14 +40,12 @@ See \fIoptions(n)\fR in the Tk reference manual for the full description.
.OP \-style style Style
May be used to specify a custom widget style.
.SH "SCROLLABLE WIDGET OPTIONS"
-.PP
The following options are supported by widgets that
are controllable by a scrollbar.
See \fIscrollbar(n)\fR for more information
.OP \-xscrollcommand xScrollCommand ScrollCommand
A command prefix, used to communicate with horizontal scrollbars.
.RS
-.PP
When the view in the widget's window changes, the widget will
generate a Tcl command by concatenating the scroll command and
two numbers.
@@ -67,7 +65,7 @@ This will cause the scrollbar to be updated whenever the view in the
window changes.
.PP
If this option is set to the empty string (the default),
-then no command is be executed.
+then no command will be executed.
.RE
.OP \-yscrollcommand yScrollCommand ScrollCommand
A command prefix, used to communicate with vertical scrollbars.
@@ -121,10 +119,11 @@ If zero or unspecified, the natural width of the text label is used.
.OP \-state state State
May be set to \fBnormal\fR or \fBdisabled\fR
to control the \fBdisabled\fR state bit.
-This is a
-.QW write-only
-option: setting it changes the widget state, but the \fBstate\fR
-widget command does not affect the state option.
+This is a write-only option:
+setting it changes the widget state,
+but the \fBstate\fR widget command
+does not affect the \fB\-state\fR option.
+
.SH COMMANDS
.TP
\fIpathName \fBcget\fR \fIoption\fR
@@ -155,11 +154,12 @@ If \fIscript\fR is specified, equivalent to
if {[\fIpathName\fR instate \fIstateSpec\fR]} \fIscript\fR
.CE
.TP
-\fIpathName \fBstate\fR ?\fIstateSpec\fR
+\fIpathName \fBstate\fR ?\fIstateSpec\fR?
Modify or inquire widget state.
If \fIstateSpec\fR is present, sets the widget state:
for each flag in \fIstateSpec\fR, sets the corresponding flag
or clears it if prefixed by an exclamation point.
+.RS
Returns a new state spec indicating which flags were changed:
.CS
set changes [\fIpathName \fRstate \fIspec\fR]
@@ -168,6 +168,7 @@ set changes [\fIpathName \fRstate \fIspec\fR]
will restore \fIpathName\fR to the original state.
If \fIstateSpec\fR is not specified,
returns a list of the currently-enabled state flags.
+.RE
.SH "WIDGET STATES"
The widget state is a bitmap of independent state flags.
Widget state flags include:
diff --git a/generic/tkText.c b/generic/tkText.c
index 1783b63..c67ab38 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.75.2.2 2007/12/12 14:13:09 dgp Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.75.2.3 2007/12/13 06:28:47 dgp Exp $
*/
#include "default.h"
@@ -388,6 +388,7 @@ static int TextEditRedo(TkText *textPtr);
static Tcl_Obj * TextGetText(CONST TkText *textPtr,
CONST TkTextIndex *index1,
CONST TkTextIndex *index2, int visibleOnly);
+static void GenerateModifiedEvent(TkText *textPtr);
static void UpdateDirtyFlag(TkSharedText *sharedPtr);
static void TextPushUndoAction(TkText *textPtr,
Tcl_Obj *undoString, int insert,
@@ -3120,11 +3121,11 @@ DeleteIndexRange(
get = TextGetText(textPtr, &index1, &index2, 0);
TextPushUndoAction(textPtr, get, 0, &index1, &index2);
}
- UpdateDirtyFlag(sharedTextPtr);
-
sharedTextPtr->stateEpoch++;
TkBTreeDeleteIndexRange(sharedTextPtr->tree, &index1, &index2);
+
+ UpdateDirtyFlag(sharedTextPtr);
}
resetViewCount = 0;
@@ -4986,7 +4987,6 @@ TextEditCmd(
return TCL_ERROR;
} else {
int setModified;
- XEvent event;
if (Tcl_GetBooleanFromObj(interp, objv[3],
&setModified) != TCL_OK) {
@@ -4994,30 +4994,17 @@ TextEditCmd(
}
/*
- * Set or reset the dirty info and trigger a Modified event.
+ * Set or reset the dirty info, but trigger a Modified event only
+ * if it has changed. Ensure a rationalized value for the bit.
*/
- if (setModified) {
- textPtr->sharedTextPtr->isDirty = 1;
- textPtr->sharedTextPtr->modifiedSet = 1;
- } else {
- textPtr->sharedTextPtr->isDirty = 0;
- textPtr->sharedTextPtr->modifiedSet = 0;
- }
-
- /*
- * Send an event that the text was modified. This is equivalent to
- * "event generate $textWidget <<Modified>>"
- */
+ setModified = setModified ? 1 : 0;
- memset(&event, 0, sizeof(event));
- event.xany.type = VirtualEvent;
- event.xany.serial = NextRequest(Tk_Display(textPtr->tkwin));
- event.xany.send_event = False;
- event.xany.window = Tk_WindowId(textPtr->tkwin);
- event.xany.display = Tk_Display(textPtr->tkwin);
- ((XVirtualEvent *) &event)->name = Tk_GetUid("Modified");
- Tk_HandleEvent(&event);
+ textPtr->sharedTextPtr->isDirty = setModified;
+ if (textPtr->sharedTextPtr->modifiedSet != setModified) {
+ textPtr->sharedTextPtr->modifiedSet = setModified;
+ GenerateModifiedEvent(textPtr);
+ }
}
break;
case EDIT_REDO:
@@ -5148,6 +5135,41 @@ TextGetText(
/*
*----------------------------------------------------------------------
*
+ * GenerateModifiedEvent --
+ *
+ * Send an event that the text was modified. This is equivalent to
+ * event generate $textWidget <<Modified>>
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * May force the text window into existence.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+GenerateModifiedEvent(
+ TkText *textPtr) /* Information about text widget. */
+{
+ XEvent event;
+
+ Tk_MakeWindowExist(textPtr->tkwin);
+
+ memset(&event, 0, sizeof(event));
+ event.xany.type = VirtualEvent;
+ event.xany.serial = NextRequest(Tk_Display(textPtr->tkwin));
+ event.xany.send_event = False;
+ event.xany.window = Tk_WindowId(textPtr->tkwin);
+ event.xany.display = Tk_Display(textPtr->tkwin);
+ ((XVirtualEvent *) &event)->name = Tk_GetUid("Modified");
+ Tk_HandleEvent(&event);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* UpdateDirtyFlag --
*
* Increases the dirtyness of the text widget
@@ -5176,21 +5198,7 @@ UpdateDirtyFlag(
TkText *textPtr;
for (textPtr = sharedTextPtr->peers; textPtr != NULL;
textPtr = textPtr->next) {
- /*
- * Send an event that the text was modified. This is equivalent to
- * event generate $textWidget <<Modified>>
- */
-
- XEvent event;
-
- memset(&event, 0, sizeof(event));
- event.xany.type = VirtualEvent;
- event.xany.serial = NextRequest(Tk_Display(textPtr->tkwin));
- event.xany.send_event = False;
- event.xany.window = Tk_WindowId(textPtr->tkwin);
- event.xany.display = Tk_Display(textPtr->tkwin);
- ((XVirtualEvent *) &event)->name = Tk_GetUid("Modified");
- Tk_HandleEvent(&event);
+ GenerateModifiedEvent(textPtr);
}
}
}
diff --git a/generic/tkText.h b/generic/tkText.h
index 2974009..46a5793 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.h,v 1.31.2.1 2007/06/25 19:12:13 dgp Exp $
+ * RCS: @(#) $Id: tkText.h,v 1.31.2.2 2007/12/13 06:28:47 dgp Exp $
*/
#ifndef _TKTEXT
@@ -566,9 +566,9 @@ typedef struct TkSharedText {
* statements. */
int autoSeparators; /* Non-zero means the separators will be
* inserted automatically. */
- int modifiedSet; /* Flag indicating that the 'dirtynesss' of
- * the text widget has been expplicitly set. */
- int isDirty; /* Flag indicating the 'dirtynesss' of the
+ int modifiedSet; /* Flag indicating that the 'dirtyness' of
+ * the text widget has been explicitly set. */
+ int isDirty; /* Flag indicating the 'dirtyness' of the
* text widget. If the flag is not zero,
* unsaved modifications have been applied to
* the text widget. */
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 8049432..08b7aa2 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.29.2.3 2007/07/10 21:54:28 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.29.2.4 2007/12/13 06:28:48 dgp Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -555,6 +555,29 @@ BringWindowForward(
ChkErr(GetWindowModality, frontWindow, &frontWindowModality, NULL);
}
if (frontWindowModality != kWindowModalityAppModal) {
+ Window window = TkMacOSXGetXWindow(wRef);
+
+ if (window != None) {
+ TkDisplay *dispPtr = TkGetDisplayList();
+ TkWindow * winPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display,
+ window);
+
+ if (winPtr && winPtr->wmInfoPtr &&
+ winPtr->wmInfoPtr->master != None) {
+ TkWindow *masterWinPtr = (TkWindow *)Tk_IdToWindow(
+ dispPtr->display, winPtr->wmInfoPtr->master);
+
+ if (masterWinPtr && masterWinPtr->window != None &&
+ TkMacOSXHostToplevelExists(masterWinPtr)) {
+ WindowRef masterMacWin =
+ TkMacOSXDrawableWindow(masterWinPtr->window);
+
+ if (masterMacWin) {
+ BringToFront(masterMacWin);
+ }
+ }
+ }
+ }
SelectWindow(wRef);
} else {
frontWindowOnly = 0;
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index a1b87bd..d0435c5 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.18.2.7 2007/11/12 19:22:39 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.18.2.8 2007/12/13 06:28:48 dgp Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -109,7 +109,42 @@ XDestroyWindow(
if (winRef) {
TkMacOSXWindowList *listPtr, *prevPtr;
+ WindowGroupRef group;
+
+ if (GetWindowProperty(winRef, 'Tk ', 'TsGp', sizeof(group),
+ NULL, &group) == noErr) {
+ TkDisplay *dispPtr = TkGetDisplayList();
+ ItemCount i = CountWindowGroupContents(group,
+ kWindowGroupContentsReturnWindows);
+
+ while (i > 0) {
+ WindowRef macWin;
+
+ ChkErr(GetIndexedWindow, group, i--, 0, &macWin);
+ if (macWin) {
+ WindowGroupRef newGroup = NULL;
+ Window window = TkMacOSXGetXWindow(macWin);
+
+ if (window != None) {
+ TkWindow * winPtr = (TkWindow *)Tk_IdToWindow(
+ dispPtr->display, window);
+
+ if (winPtr && winPtr->wmInfoPtr) {
+ newGroup = GetWindowGroupOfClass(
+ winPtr->wmInfoPtr->macClass);
+ }
+ }
+ if (!newGroup) {
+ newGroup = GetWindowGroupOfClass(
+ kDocumentWindowClass);
+ }
+ ChkErr(SetWindowGroup, macWin, newGroup);
+ }
+ }
+ ChkErr(SetWindowGroupOwner, group, NULL);
+ ChkErr(ReleaseWindowGroup, group);
+ }
TkMacOSXUnregisterMacWindow(winRef);
DisposeWindow(winRef);
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 6d2fd52..bb89bdc 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXWm.c,v 1.49.2.11 2007/11/12 19:22:39 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.49.2.12 2007/12/13 06:28:48 dgp Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -170,6 +170,7 @@ static void ApplyWindowClassAttributeChanges(TkWindow *winPtr,
WindowRef macWindow, WindowClass oldClass,
WindowAttributes oldAttributes, int create);
static void ApplyMasterOverrideChanges(TkWindow *winPtr, WindowRef macWindow);
+static WindowGroupRef WmGetWindowGroup(TkWindow *winPtr);
static void GetMinSize(TkWindow *winPtr, int *minWidthPtr, int *minHeightPtr);
static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, int *maxHeightPtr);
static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin);
@@ -852,11 +853,10 @@ static int WmSetAttribute(
if (boolean) {
wmPtr->flags |= WM_TOPMOST;
- group = GetWindowGroupOfClass(kUtilityWindowClass);
} else {
wmPtr->flags &= ~WM_TOPMOST;
- group = GetWindowGroupOfClass(wmPtr->macClass);
}
+ group = WmGetWindowGroup(winPtr);
if (group && group != GetWindowGroup(macWindow)) {
ChkErr(SetWindowGroup, macWindow, group);
}
@@ -6040,55 +6040,100 @@ ApplyMasterOverrideChanges(
WmInfo *wmPtr = winPtr->wmInfoPtr;
WindowClass oldClass = wmPtr->macClass;
WindowAttributes oldAttributes = wmPtr->attributes;
- const int wasOverrideredirect = (oldClass == kSimpleWindowClass &&
- oldAttributes == kWindowNoActivatesAttribute);
- const int wasTransient = (oldClass == kPlainWindowClass &&
- oldAttributes == kWindowNoAttributes);
- const int wasDefault = (oldClass == kDocumentWindowClass);
/*
* FIX: We need an UpdateWrapper equivalent to make this 100% correct
*/
+
if (winPtr->atts.override_redirect) {
- if (wasDefault || (wmPtr->master != None && wasTransient)) {
+ if (oldClass == kDocumentWindowClass) {
wmPtr->macClass = kSimpleWindowClass;
wmPtr->attributes = kWindowNoAttributes;
}
wmPtr->attributes |= kWindowNoActivatesAttribute;
} else {
- if (wmPtr->master != None) {
- if (wasDefault || wasOverrideredirect) {
- wmPtr->macClass = kPlainWindowClass;
- wmPtr->attributes = kWindowNoAttributes;
- }
- } else {
- if (wasTransient || wasOverrideredirect) {
- wmPtr->macClass = kDocumentWindowClass;
- wmPtr->attributes = kWindowStandardDocumentAttributes
- | kWindowLiveResizeAttribute;
- }
+ if (oldClass == kSimpleWindowClass &&
+ oldAttributes == kWindowNoActivatesAttribute) {
+ wmPtr->macClass = kDocumentWindowClass;
+ wmPtr->attributes = kWindowStandardDocumentAttributes
+ | kWindowLiveResizeAttribute;
}
wmPtr->attributes &= ~kWindowNoActivatesAttribute;
}
- if (!macWindow) {
- if (winPtr->window == None) {
- return;
- }
- if (!TkMacOSXHostToplevelExists(winPtr)) {
- return;
- }
+ if (!macWindow && winPtr->window != None &&
+ TkMacOSXHostToplevelExists(winPtr)) {
macWindow = TkMacOSXDrawableWindow(winPtr->window);
}
if (macWindow) {
- Tcl_Obj *val;
+ WindowGroupRef group;
ApplyWindowClassAttributeChanges(winPtr, macWindow, oldClass,
oldAttributes, 0);
- val = Tcl_NewBooleanObj(winPtr->atts.override_redirect &&
- wmPtr->master != None);
- WmSetAttribute(winPtr, macWindow, NULL, WMATT_TOPMOST, val);
- Tcl_DecrRefCount(val);
+
+ if (winPtr->atts.override_redirect && wmPtr->master != None) {
+ wmPtr->flags |= WM_TOPMOST;
+ } else {
+ wmPtr->flags &= ~WM_TOPMOST;
+ }
+ group = WmGetWindowGroup(winPtr);
+ if (group && group != GetWindowGroup(macWindow)) {
+ ChkErr(SetWindowGroup, macWindow, group);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmGetWindowGroup --
+ *
+ * Gets the window group a toplevel should be placed in.
+ *
+ * Results:
+ * A WindowGroupRef.
+ *
+ * Side effects:
+ * A transient window group for the master (if any) may be created.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static WindowGroupRef
+WmGetWindowGroup(
+ TkWindow *winPtr)
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ WindowGroupRef group = NULL;
+
+ if (wmPtr->flags & WM_TOPMOST) {
+ group = GetWindowGroupOfClass(kUtilityWindowClass);
+ } else if (wmPtr->master != None) {
+ TkDisplay *dispPtr = TkGetDisplayList();
+ TkWindow *masterWinPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display,
+ wmPtr->master);
+
+ if (masterWinPtr && masterWinPtr->window != None &&
+ TkMacOSXHostToplevelExists(masterWinPtr)) {
+ WindowRef masterMacWin =
+ TkMacOSXDrawableWindow(masterWinPtr->window);
+
+ if (masterMacWin && GetWindowProperty(masterMacWin, 'Tk ', 'TsGp',
+ sizeof(group), NULL, &group) != noErr) {
+ ChkErr(CreateWindowGroup, 0, &group);
+ if (group) {
+ ChkErr(SetWindowGroupParent, group,
+ GetWindowGroup(masterMacWin));
+ ChkErr(SetWindowGroupOwner, group, masterMacWin);
+ ChkErr(SetWindowProperty, masterMacWin, 'Tk ', 'TsGp',
+ sizeof(group), &group);
+ }
+ }
+ }
+ }
+ if (!group) {
+ group = GetWindowGroupOfClass(wmPtr->macClass);
}
+ return group;
}
/*
diff --git a/tests/text.test b/tests/text.test
index 6a05a3b..d5d9ce8 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: text.test,v 1.46.2.1 2007/12/12 14:13:10 dgp Exp $
+# RCS: @(#) $Id: text.test,v 1.46.2.2 2007/12/13 06:28:48 dgp Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -3041,6 +3041,21 @@ test text-25.10 {TextEditCmd procedure, set modified flag} {
.t edit modified 1
.t edit modified
} {1}
+test text-25.10.1 {TextEditCmd procedure, set modified flag repeat} {
+ catch {destroy .t}
+ text .t
+ pack .t
+ set ::retval {}
+ bind .t <<Modified>> "lappend ::retval modified"
+ # Shouldn't require [update idle] to trigger event [Bug 1809538]
+ lappend ::retval [.t edit modified]
+ .t edit modified 1
+ update idletasks
+ lappend ::retval [.t edit modified]
+ .t edit modified 1 ; # binding should only fire once [Bug 1799782]
+ update idletasks
+ lappend ::retval [.t edit modified]
+} {0 modified 1 1}
test text-25.11 {<<Modified>> virtual event} {
set ::retval unmodified
catch {destroy .t}
@@ -3051,6 +3066,26 @@ test text-25.11 {<<Modified>> virtual event} {
.t insert end "nothing special\n"
set ::retval
} {modified}
+test text-25.11.1 {<<Modified>> virtual event - insert before Modified} {
+ set ::retval {}
+ destroy .t
+ pack [text .t -undo 1]
+ bind .t <<Modified>> { set ::retval [.t get 1.0 end-1c] }
+ update idletasks
+ .t insert end "nothing special"
+ set ::retval
+} {nothing special}
+test text-25.11.2 {<<Modified>> virtual event - delete before Modified} {
+ # Bug 1737288, make sure we delete chars before triggering <<Modified>>
+ set ::retval {}
+ destroy .t
+ pack [text .t -undo 1]
+ bind .t <<Modified>> { set ::retval [.t get 1.0 end-1c] }
+ .t insert end "nothing special"
+ .t edit modified 0
+ .t delete 1.0 1.2
+ set ::retval
+} {thing special}
test text-25.12 {<<Selection>> virtual event} {
set ::retval no_selection
catch {destroy .t}